1.2.3-SNAPSHOT permalink Arrow_down_16x16

half-vectorize

incanter.core

  • (half-vectorize mat)
Returns the half-vectorization (i.e. vech) of the given matrix.
The half-vectorization, vech(A), of a symmetric nxn matrix A
is the n(n+1)/2 x 1 column vector obtained by vectorizing only
the upper triangular part of A.

For instance:
(= (half-vectorize (matrix [[a b] [b d]])) (matrix [a b d]))

Examples:
(def A (matrix [[1 2] [2 4]]))
(half-vectorize A)

References:
http://en.wikipedia.org/wiki/Vectorization_(mathematics)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/core.clj:785 top

(defn half-vectorize
  " Returns the half-vectorization (i.e. vech) of the given matrix.
    The half-vectorization, vech(A), of a symmetric nxn matrix A
    is the n(n+1)/2 x 1 column vector obtained by vectorizing only
    the upper triangular part of A.

    For instance:
      (= (half-vectorize (matrix [[a b] [b d]])) (matrix [a b d]))

    Examples:
      (def A (matrix [[1 2] [2 4]]))
      (half-vectorize A)

    References:
      http://en.wikipedia.org/wiki/Vectorization_(mathematics)
  "
  ([mat]
   (for [j (range (nrow mat)) i (range j (nrow mat))] (sel mat i j))))
Vars in incanter.core/half-vectorize: defn for
Used in 0 other vars

Comments top

No comments for half-vectorize. Log in to add a comment.