1.2.3-SNAPSHOT permalink Arrow_down_16x16

decomp-svd

incanter.core

  • (decomp-svd mat)
Returns the Singular Value Decomposition (SVD) of the given matrix. Equivalent to
R's svd function.

Returns:
a map containing:
:S -- the diagonal matrix of singular values
:U -- the left singular vectors U
:V -- the right singular vectors V


Examples:

(use 'incanter.core)
(def foo (matrix (range 9) 3))
(decomp-foo foo)


References:
http://en.wikipedia.org/wiki/Singular_value_decomposition
http://incanter.org/docs/parallelcolt/api/cern/colt/matrix/tdouble/algo/decomposition/DoubleSingularValueDecompositionDC.html

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:889 top

(defn decomp-svd
" Returns the Singular Value Decomposition (SVD) of the given matrix. Equivalent to
  R's svd function.

  Returns:
    a map containing:
      :S -- the diagonal matrix of singular values
      :U -- the left singular vectors U
      :V -- the right singular vectors V


  Examples:

  (use 'incanter.core)
  (def foo (matrix (range 9) 3))
  (decomp-foo foo)


  References:
    http://en.wikipedia.org/wiki/Singular_value_decomposition
    http://incanter.org/docs/parallelcolt/api/cern/colt/matrix/tdouble/algo/decomposition/DoubleSingularValueDecompositionDC.html
"
  ([mat]
    (let [result (DenseDoubleSingularValueDecomposition. mat, true, true)]
      {:S (diag (Matrix. (.getS result)))
       :U (Matrix. (.getU result))
       :V (Matrix. (.getV result))})))
Vars in incanter.core/decomp-svd: defn let
Used in 0 other vars

Comments top

No comments for decomp-svd. Log in to add a comment.