Crates.io | rsvd |
lib.rs | rsvd |
version | 0.1.2 |
source | src |
created_at | 2023-07-28 15:17:48.548581 |
updated_at | 2023-07-28 15:48:10.567239 |
description | randomized singular value decomposition (rSVD) |
homepage | |
repository | https://github.com/ekg/rsvd |
max_upload_size | |
id | 928585 |
size | 10,936 |
A Rust library for computing an approximate singular value decomposition (SVD) of a matrix using randomized algorithms.
The singular value decomposition (SVD) is a matrix factorization technique that is useful for many applications in data analysis and scientific computing. However, computing the full SVD can be very computationally intensive for large matrices.
Randomized algorithms provide an efficient way to compute an approximate SVD that captures most of the action of the original matrix in significantly less time. The key ideas behind randomized SVD are:
This technique allows the SVD to be approximated in O(mn log k) time instead of the O(mn min(m,n)) operations required for the full SVD, where m and n are the dimensions of the input matrix and k is the target rank.
The main function is rsvd()
, which takes a matrix, target rank k, and oversampling parameter p. It returns the approximate SVD factors U, S, and V^T.
use ndarray::{Array2, array};
use rsvd::rsvd;
let a = array!([1., 2., 3.],
[8., 9., 4.],
[7., 6., 5.]);
let (u, s, vt) = rsvd(&a, 2, 0, None);
Randomized SVD is useful for many applications that involve large data matrices:
By efficiently approximating the SVD to capture the top k singular values/vectors, randomized SVD allows these techniques to scale to massive datasets.
The SVD also provides a powerful tool for analyzing and understanding the properties of a dataset contained in the matrix. The singular values indicate the importance of each component, while the singular vectors identify the principal components.