|
numerics 0.1.0
|
Singular Value Decomposition – dense and randomized truncated. More...
#include "core/matrix.hpp"#include "core/policy.hpp"#include "core/util/math.hpp"#include "core/vector.hpp"#include "linalg/factorization/qr.hpp"#include <algorithm>#include <cmath>#include <stdexcept>Go to the source code of this file.
Classes | |
| struct | num::SVDResult |
| Result of a Singular Value Decomposition: A = U * diag(S) * V^T. More... | |
Namespaces | |
| namespace | num |
Functions | |
| SVDResult | num::svd (const Matrix &A, Backend backend=lapack_backend, real tol=1e-12, idx max_sweeps=100) |
| Full SVD of an mxn matrix. | |
| SVDResult | num::svd_truncated (const Matrix &A, idx k, Backend backend=default_backend, idx oversampling=10, Rng *rng=nullptr) |
| Randomized truncated SVD – top-k singular triplets. | |
Singular Value Decomposition – dense and randomized truncated.
Two algorithms:
svd(A) Full SVD via one-sided Jacobi: A = U * diag(S) * V^T svd_truncated(A,k) Randomized truncated SVD: top-k singular triplets
Full SVD (one-sided Jacobi)
The one-sided Jacobi algorithm applies Givens rotations to the columns of A (from the right) until the columns are mutually orthogonal.
Randomized truncated SVD
For large A where only the top-k singular triplets are needed. Algorithm (Halko, Martinsson, Tropp 2011):
Cost: O(mnk) vs O(mn*min(m,n)) for full SVD.
Definition in file svd.hpp.