Skip to main content

svd

Function svd 

Source
pub fn svd<B: Backend, T: LinalgScalar>(
    x: &Array<B, T>,
    full_matrices: bool,
    subset_by_index: Option<(usize, usize)>,
    algorithm: Option<SvdAlgorithm>,
) -> Svd<B, T>
Expand description

The singular value decomposition of each matrix, as lax.linalg.svd: (u, s, vt) with the real singular values s in descending order and x = u diag(s) vt. With full_matrices, u is [..., m, m] and vt is [..., n, n]; otherwise [..., m, k] and [..., k, n] for k = min(m, n). The signs (phases) make the component of largest magnitude of each column of u real and positive.

With subset_by_index (start, end) (not with full_matrices), only the singular values of indices start..end and their vectors are returned (computed from the whole decomposition; JAX supports it on TPU only), and they are not differentiable. algorithm chooses the algorithm as JAX’s (None for the platform’s default; natively, one-sided Jacobi rotations for SvdAlgorithm::Jacobi, the QR algorithm otherwise).

§Panics

Panics if x is not a batch of matrices, or the range is out of bounds or given with full_matrices.