rsvd_ndarray

Function rsvd_ndarray 

Source
pub fn rsvd_ndarray<T>(
    a: &Array2<T>,
    k: usize,
) -> LapackResult<RandomizedSvdResult<T>>
where T: Field + Clone + Zeroable + Real,
Expand description

Computes a randomized SVD approximation of a matrix.

Uses randomized projections to compute a rank-k approximation efficiently, particularly useful for large matrices where only the top singular values are needed.

§Arguments

  • a - The input matrix (m×n)
  • k - Target rank (number of singular values to compute)

§Returns

Truncated SVD with k singular values and vectors

§Algorithm

Uses the Halko-Martinsson-Tropp randomized algorithm:

  1. Generate random test matrix Ω
  2. Compute Y = A × Ω to sample column space
  3. QR factorize Y to get orthonormal basis Q
  4. Project B = Q^T × A
  5. Compute full SVD of B
  6. Recover U = Q × Ũ