Skip to main content

svd

Function svd 

Source
pub fn svd<T: LinalgScalar>(
    a: &[T],
    batch: usize,
    m: usize,
    n: usize,
    full_matrices: bool,
    compute_uv: bool,
    jacobi: bool,
) -> (Vec<T::LinalgReal>, Vec<T>, Vec<T>)
Expand description

The singular value decomposition A = U diag(s) V^H of each m x n matrix of a batch (what JAX computes with LAPACK’s gesdd), by bidiagonalization and the QR algorithm (LAPACK’s gesvd), or with jacobi, by one-sided Jacobi rotations.

Returns the real singular values (min(m, n) per matrix, in descending order), and, with compute_uv, U and V^H: m x m and n x n with full_matrices, m x k and k x n otherwise (k = min(m, n)). Matrices with infinities or NaNs, and matrices on which the QR algorithm does not converge, give NaNs.

§Panics

Panics if a does not have batch * m * n elements.