1.2.3-SNAPSHOT permalink Arrow_down_16x16

vectorize

incanter.core

  • (vectorize mat)
Returns the vectorization (i.e. vec) of the given matrix.
The vectorization of an m-by-n matrix A, denoted by vec(A)
is the m*n-by-1 column vector obtain by stacking the columns
of the matrix A on top of one another.

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

Examples:
(def A (matrix [[1 2] [3 4]]))
(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:764 top

(defn vectorize
  " Returns the vectorization (i.e. vec) of the given matrix.
    The vectorization of an m-by-n matrix A, denoted by vec(A)
    is the m*n-by-1 column vector obtain by stacking the columns
    of the matrix A on top of one another.

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

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

    References:
      http://en.wikipedia.org/wiki/Vectorization_(mathematics)
  "
  ([mat]
   (mapcat identity (trans mat))))
Vars in incanter.core/vectorize: defn identity mapcat
Used in 0 other vars

Comments top

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