num::svd_truncated¶
Defined in header <linear/svd/svd.hpp>
svd_result svd_truncated(const mat<real> &A, idx k, idx oversampling = 10,
rng_state *rng = nullptr);
Randomized rank-\(k\) SVD \(A \approx U_k \Sigma_k V_k^T\), from a Gaussian range finder of dimension \(k + \text{oversampling}\).
Parameters¶
A: Input \(m \times n\) dense matrix.k: Target rank (\(0 < k \le \min(m, n)\)).oversampling: Extra random test vectors (default: 10).rng: Optional generator for reproducible sampling.
Return value¶
svd_result containing rank-\(k\) truncated factors \(U_k, \Sigma_k, V_k^T\).
Exceptions¶
std::invalid_argument: If \(k\) is out of range.