• incanter

1.2.3-SNAPSHOT

# 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

### 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