SVD

Trait SVD 

Source
pub trait SVD<T> {
    // Required methods
    fn svd<L: Layout>(&self, a: &mut DSlice<T, 2, L>) -> SVDResult<T>;
    fn svd_s<L: Layout>(
        &self,
        a: &mut DSlice<T, 2, L>,
    ) -> Result<DTensor<T, 2>, SVDError>;
    fn svd_overwrite<L: Layout, Ls: Layout, Lu: Layout, Lvt: Layout>(
        &self,
        a: &mut DSlice<T, 2, L>,
        s: &mut DSlice<T, 2, Ls>,
        u: &mut DSlice<T, 2, Lu>,
        vt: &mut DSlice<T, 2, Lvt>,
    ) -> Result<(), SVDError>;
    fn svd_overwrite_s<L: Layout, Ls: Layout>(
        &self,
        a: &mut DSlice<T, 2, L>,
        s: &mut DSlice<T, 2, Ls>,
    ) -> Result<(), SVDError>;
}
Expand description

Singular value decomposition for matrix factorization and analysis

Required Methods§

Source

fn svd<L: Layout>(&self, a: &mut DSlice<T, 2, L>) -> SVDResult<T>

Compute full SVD with new allocated matrices

Source

fn svd_s<L: Layout>( &self, a: &mut DSlice<T, 2, L>, ) -> Result<DTensor<T, 2>, SVDError>

Compute only singular values with new allocated matrix

Source

fn svd_overwrite<L: Layout, Ls: Layout, Lu: Layout, Lvt: Layout>( &self, a: &mut DSlice<T, 2, L>, s: &mut DSlice<T, 2, Ls>, u: &mut DSlice<T, 2, Lu>, vt: &mut DSlice<T, 2, Lvt>, ) -> Result<(), SVDError>

Compute full SVD, overwriting existing matrices The matrix A is decomposed as A = U * S * V^T where:

  • s contains the singular values (diagonal matrix S)
  • u contains the left singular vectors (matrix U)
  • vt contains the transposed right singular vectors (matrix V^T)
Source

fn svd_overwrite_s<L: Layout, Ls: Layout>( &self, a: &mut DSlice<T, 2, L>, s: &mut DSlice<T, 2, Ls>, ) -> Result<(), SVDError>

Compute only singular values, overwriting existing matrix Computes only the diagonal elements of the S matrix from the SVD decomposition.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§