Skip to main content

Factor

Trait Factor 

Source
pub trait Factor: Scalar {
    // Required methods
    fn matrix_lu_into(a: &[Self], n: usize, work: &mut LuWork<Self>);
    fn matrix_lu_solve(
        lu: Lu<Self, &[Self], &[usize]>,
        b: &[Self],
        k: usize,
    ) -> Vec<Self>;
    fn matrix_lu_inverse_into(
        lu: Lu<Self, &[Self], &[usize]>,
        x: &mut Vec<Self>,
        out: &mut [Self],
    );
    fn matrix_cholesky(a: &[Self], n: usize) -> Option<Vec<Self>>;
    fn matrix_qr(
        a: &[Self],
        size: [usize; 2],
        complete: bool,
    ) -> (Vec<Self>, Vec<Self>);
    fn matrix_qr_into(
        a: &[Self],
        size: [usize; 2],
        complete: bool,
        work: &mut QrWork<Self>,
        q: &mut [Self],
        r: &mut [Self],
    );
    fn matrix_svd(a: &[Self], size: [usize; 2], vectors: bool) -> Svd<Self>;
    fn matrix_truncated_svd(a: &[Self], size: [usize; 2], k: usize) -> Svd<Self>;
    fn matrix_svd_solve(
        svd: Svd<Self, &[Self], &[Self::Real]>,
        b: Option<&[Self]>,
        k: usize,
    ) -> Vec<Self>;
    fn matrix_lstsq(
        a: &[Self],
        b: &[Self],
        size: [usize; 2],
        k: usize,
    ) -> (Vec<Self>, Vec<Self::Real>);
    fn matrix_eigh(a: &[Self], n: usize, vectors: bool) -> Option<Eigh<Self>>;
    fn matrix_eig(
        a: &[Self],
        n: usize,
        vectors: bool,
    ) -> Option<Eig<Self::Real>>;
}
Expand description

An item type whose matrices rustymath factors: f32, f64, or a complex number with parts of either type. Only rustymath implements it, and the functions of this module call it. Its methods compile in rustymath.

Required Methods§

Source

fn matrix_lu_into(a: &[Self], n: usize, work: &mut LuWork<Self>)

The LU factorization of the n×n matrix a, into work’s buffers.

Source

fn matrix_lu_solve( lu: Lu<Self, &[Self], &[usize]>, b: &[Self], k: usize, ) -> Vec<Self>

The solution of a x = b for the matrix that lu factors and the n×k matrix b.

Source

fn matrix_lu_inverse_into( lu: Lu<Self, &[Self], &[usize]>, x: &mut Vec<Self>, out: &mut [Self], )

The inverse of the matrix that lu factors, written into out, with x as scratch.

Source

fn matrix_cholesky(a: &[Self], n: usize) -> Option<Vec<Self>>

The Cholesky factor of the n×n matrix a, or None where a isn’t positive definite.

Source

fn matrix_qr( a: &[Self], size: [usize; 2], complete: bool, ) -> (Vec<Self>, Vec<Self>)

The QR factorization of the matrix a of size [m, n]: thin, or complete where complete is true.

Source

fn matrix_qr_into( a: &[Self], size: [usize; 2], complete: bool, work: &mut QrWork<Self>, q: &mut [Self], r: &mut [Self], )

matrix_qr’s Q and R, written into q and r, with work’s buffers.

Source

fn matrix_svd(a: &[Self], size: [usize; 2], vectors: bool) -> Svd<Self>

The thin SVD of the matrix a of size [m, n], with its singular vectors only where vectors is true.

Source

fn matrix_truncated_svd(a: &[Self], size: [usize; 2], k: usize) -> Svd<Self>

An approximation to the thin SVD’s first k singular values and vectors of the matrix a of size [m, n].

Source

fn matrix_svd_solve( svd: Svd<Self, &[Self], &[Self::Real]>, b: Option<&[Self]>, k: usize, ) -> Vec<Self>

The least-squares solution of a x = b for the matrix that svd factors and the m×k matrix b, or without b its n×m pseudoinverse.

Source

fn matrix_lstsq( a: &[Self], b: &[Self], size: [usize; 2], k: usize, ) -> (Vec<Self>, Vec<Self::Real>)

The least-squares solution of a x = b, and a’s singular values, for the matrix a of size [m, n] and the m×k matrix b.

Source

fn matrix_eigh(a: &[Self], n: usize, vectors: bool) -> Option<Eigh<Self>>

The eigen decomposition of the Hermitian n×n matrix a, from its lower triangle, with its eigenvectors only where vectors is true, or None where it doesn’t converge.

Source

fn matrix_eig(a: &[Self], n: usize, vectors: bool) -> Option<Eig<Self::Real>>

The eigen decomposition of the n×n matrix a, with its eigenvectors only where vectors is true, or None where it doesn’t converge.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Factor for f32

Source§

fn matrix_lu_into(a: &[f32], n: usize, work: &mut LuWork<f32>)

Source§

fn matrix_lu_solve( lu: Lu<f32, &[f32], &[usize]>, b: &[f32], k: usize, ) -> Vec<f32>

Source§

fn matrix_lu_inverse_into( lu: Lu<f32, &[f32], &[usize]>, x: &mut Vec<f32>, out: &mut [f32], )

Source§

fn matrix_cholesky(a: &[f32], n: usize) -> Option<Vec<f32>>

Source§

fn matrix_qr( a: &[f32], size: [usize; 2], complete: bool, ) -> (Vec<f32>, Vec<f32>)

Source§

fn matrix_qr_into( a: &[f32], size: [usize; 2], complete: bool, work: &mut QrWork<f32>, q: &mut [f32], r: &mut [f32], )

Source§

fn matrix_svd(a: &[f32], size: [usize; 2], vectors: bool) -> Svd<f32>

Source§

fn matrix_truncated_svd(a: &[f32], size: [usize; 2], k: usize) -> Svd<f32>

Source§

fn matrix_svd_solve( svd: Svd<f32, &[f32], &[<f32 as Scalar>::Real]>, b: Option<&[f32]>, k: usize, ) -> Vec<f32>

Source§

fn matrix_lstsq( a: &[f32], b: &[f32], size: [usize; 2], k: usize, ) -> (Vec<f32>, Vec<<f32 as Scalar>::Real>)

Source§

fn matrix_eigh(a: &[f32], n: usize, vectors: bool) -> Option<Eigh<f32>>

Source§

fn matrix_eig( a: &[f32], n: usize, vectors: bool, ) -> Option<Eig<<f32 as Scalar>::Real>>

Source§

impl Factor for f64

Source§

fn matrix_lu_into(a: &[f64], n: usize, work: &mut LuWork<f64>)

Source§

fn matrix_lu_solve( lu: Lu<f64, &[f64], &[usize]>, b: &[f64], k: usize, ) -> Vec<f64>

Source§

fn matrix_lu_inverse_into( lu: Lu<f64, &[f64], &[usize]>, x: &mut Vec<f64>, out: &mut [f64], )

Source§

fn matrix_cholesky(a: &[f64], n: usize) -> Option<Vec<f64>>

Source§

fn matrix_qr( a: &[f64], size: [usize; 2], complete: bool, ) -> (Vec<f64>, Vec<f64>)

Source§

fn matrix_qr_into( a: &[f64], size: [usize; 2], complete: bool, work: &mut QrWork<f64>, q: &mut [f64], r: &mut [f64], )

Source§

fn matrix_svd(a: &[f64], size: [usize; 2], vectors: bool) -> Svd<f64>

Source§

fn matrix_truncated_svd(a: &[f64], size: [usize; 2], k: usize) -> Svd<f64>

Source§

fn matrix_svd_solve( svd: Svd<f64, &[f64], &[<f64 as Scalar>::Real]>, b: Option<&[f64]>, k: usize, ) -> Vec<f64>

Source§

fn matrix_lstsq( a: &[f64], b: &[f64], size: [usize; 2], k: usize, ) -> (Vec<f64>, Vec<<f64 as Scalar>::Real>)

Source§

fn matrix_eigh(a: &[f64], n: usize, vectors: bool) -> Option<Eigh<f64>>

Source§

fn matrix_eig( a: &[f64], n: usize, vectors: bool, ) -> Option<Eig<<f64 as Scalar>::Real>>

Implementors§