[−][src]Module smartcore::linalg::svd
Singular value decomposition.
SVD Decomposition
Any m by n matrix \(A\) can be factored into:
\[A = U \Sigma V^T\]
Where columns of \(U\) are eigenvectors of \(AA^T\) (left-singular vectors of A), \(V\) are eigenvectors of \(A^TA\) (right-singular vectors of A), and the diagonal values in the \(\Sigma\) matrix are known as the singular values of the original matrix.
Example:
use smartcore::linalg::naive::dense_matrix::*; use smartcore::linalg::svd::*; let A = DenseMatrix::from_2d_array(&[ &[0.9, 0.4, 0.7], &[0.4, 0.5, 0.3], &[0.7, 0.3, 0.8] ]); let svd = A.svd().unwrap(); let u: DenseMatrix<f64> = svd.U; let v: DenseMatrix<f64> = svd.V; let s: Vec<f64> = svd.s;
References:
Structs
| SVD | Results of SVD decomposition |
Traits
| SVDDecomposableMatrix | Trait that implements SVD decomposition routine for any matrix. |