Skip to main content

Faer

Struct Faer 

Source
pub struct Faer;
Expand description

Faer backend.

Implements the linear algebra traits from mdarray_linalg by delegating to the pure-Rust faer library. This backend supports the broadest range of operations — from basic BLAS to full decompositions and tensor contractions — without requiring any system BLAS/LAPACK installation.

Trait Implementations§

Source§

impl<T> Contract<T> for Faer
where T: ComplexFloat + ComplexField + Zero + One + 'static + MulAdd<Output = T> + AddAssign + Sum,

Source§

fn matmul<'a, D0, D1, D2, La, Lb>( &self, a: &'a Slice<T, (D0, D1), La>, b: &'a Slice<T, (D1, D2), Lb>, ) -> impl MatmulBuilder<'a, T, D0, D1, D2, La, Lb>
where La: Layout, Lb: Layout, D0: Dim, D1: Dim, D2: Dim,

Matrix multiplication. Read more
Source§

fn contract_all<'a, Sa, Sb, La, Lb>( &self, a: &'a Slice<T, Sa, La>, b: &'a Slice<T, Sb, Lb>, ) -> T
where T: 'a, Sa: Shape, Sb: Shape, La: Layout, Lb: Layout,

Contracts all axes of a with all axes of b. Read more
Source§

fn contract_n<'a, Sa, Sb, La, Lb>( &self, a: &'a Slice<T, Sa, La>, b: &'a Slice<T, Sb, Lb>, n: usize, ) -> impl ContractBuilder<'a, T, Sa, Sb, La, Lb>
where T: 'a, Sa: Shape, Sb: Shape, La: Layout, Lb: Layout,

Contracts the last n axes of a with the first n axes of b. Read more
Source§

fn contract_pairs<'a, Sa, Sb, La, Lb>( &self, a: &'a Slice<T, Sa, La>, b: &'a Slice<T, Sb, Lb>, axes_a: &'a [usize], axes_b: &'a [usize], ) -> impl ContractBuilder<'a, T, Sa, Sb, La, Lb>
where T: 'a, Sa: Shape, Sb: Shape, La: Layout, Lb: Layout,

Contracts explicit pairs of axes. Read more
Source§

fn contract<'a, Sa, Sb, La, Lb>( &self, a: &'a Slice<T, Sa, La>, b: &'a Slice<T, Sb, Lb>, indices_a: &'a [u8], indices_b: &'a [u8], indices_c: &'a [u8], ) -> impl ContractBuilder<'a, T, Sa, Sb, La, Lb>
where T: 'a, Sa: Shape, Sb: Shape, La: Layout, Lb: Layout,

Fully general contraction of two tensors, à la einsum. Read more
Source§

impl Default for Faer

Source§

fn default() -> Faer

Returns the “default value” for a type. Read more
Source§

impl<T, D0: Dim, D1: Dim> Eig<T, D0, D1> for Faer

Source§

fn eig<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<EigDecomp<Self::SpectralScalar, D0, D1>, EigError>

Compute eigenvalues and right eigenvectors with new allocated matrices The matrix A satisfies: A * v = λ * v where v are the right eigenvectors

Source§

fn eig_values<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<Array<Self::SpectralScalar, (D0,)>, EigError>

Compute only eigenvalues with new allocated vectors

Source§

fn eigh<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<EighDecomp<T, Self::RealScalar, D0, D1>, EigError>

Compute eigenvalues and eigenvectors of a Hermitian matrix (input should be complex)

Source§

fn schur<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<SchurDecomp<T, D0, D1>, SchurError>

Compute Schur decomposition with new allocated matrices

Source§

fn schur_write<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, t: &mut Slice<T, (D0, D1), Dense>, z: &mut Slice<T, (D0, D1), Dense>, ) -> Result<(), SchurError>

Compute Schur decomposition overwriting existing matrices

Source§

fn schur_complex<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<SchurDecomp<Self::SpectralScalar, D0, D1>, SchurError>

Compute Schur (complex) decomposition with new allocated matrices

Source§

fn schur_complex_write<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, t: &mut Slice<Self::SpectralScalar, (D0, D1), Dense>, z: &mut Slice<Self::SpectralScalar, (D0, D1), Dense>, ) -> Result<(), SchurError>

Compute Schur (complex) decomposition overwriting existing matrices

Source§

type SpectralScalar = Complex<<T as ComplexFloat>::Real>

Spectral scalar type used for general eigenvalues/eigenvectors and complex Schur decompositions.
Source§

type RealScalar = <T as ComplexFloat>::Real

Real scalar type used for self-adjoint eigenvalues.
Source§

fn eig_full<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<EigDecomp<Self::SpectralScalar, D0, D1>, EigError>

Compute eigenvalues and both left/right eigenvectors with new allocated matrices. The matrix A satisfies: A * vr = λ * vr and vl^H * A = λ * vl^H.
Source§

impl<T, D0: Dim, D1: Dim> LU<T, D0, D1> for Faer

Source§

fn lu<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> (Array<T, (D0, D0)>, Array<T, (D0, D1)>, Array<T, (D0, D0)>)

Computes LU decomposition with new allocated matrices: L, U, P (permutation matrix)

Source§

fn lu_write<L: Layout, Ll: Layout, Lu: Layout, Lp: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, l: &mut Slice<T, (D0, D0), Ll>, u: &mut Slice<T, (D0, D1), Lu>, p: &mut Slice<T, (D0, D0), Lp>, )

Computes LU decomposition overwriting existing matrices

Source§

fn inv<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<Array<T, (D0, D1)>, InvError>

Computes inverse with new allocated matrix

Source§

fn inv_write<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<(), InvError>

Computes inverse overwriting the input matrix

Source§

fn det<L: Layout>(&self, a: &mut Slice<T, (D0, D1), L>) -> T

Computes the determinant of a square matrix. Panics if the matrix is non-square.

Source§

fn cholesky<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<Array<T, (D0, D1)>, InvError>

Computes the Cholesky decomposition, returning a lower-triangular matrix

Source§

fn cholesky_write<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> Result<(), InvError>

Computes the Cholesky decomposition in-place, overwriting the input matrix

Source§

impl<T, D0: Dim, D1: Dim> MatVec<T, D0, D1> for Faer
where T: FaerVectorScalar + One,

Source§

fn matvec<'a, La, Lx>( &self, a: &'a Slice<T, (D0, D1), La>, x: &'a Slice<T, (D1,), Lx>, ) -> impl MatVecBuilder<'a, T, La, Lx, D0, D1>
where La: Layout, Lx: Layout,

Source§

impl<T, Dx, Dy> Outer<T, Dx, Dy> for Faer
where T: FaerVectorScalar + One, Dx: Dim, Dy: Dim,

Source§

fn outer<'a, Lx, Ly>( &self, x: &'a Slice<T, (Dx,), Lx>, y: &'a Slice<T, (Dy,), Ly>, ) -> impl OuterBuilder<'a, T, Lx, Ly, Dx, Dy>
where Lx: Layout, Ly: Layout,

Source§

impl<T, D0: Dim, D1: Dim> QR<T, D0, D1> for Faer

Source§

fn qr<L: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, ) -> (Array<T, (D0, usize)>, Array<T, (usize, D1)>)

Compute QR decomposition with new allocated matrices
Source§

fn qr_write<D2: Dim, L: Layout, Lq: Layout, Lr: Layout>( &self, a: &mut Slice<T, (D0, D1), L>, q: &mut Slice<T, (D0, D2), Lq>, r: &mut Slice<T, (D2, D1), Lr>, )

Compute QR decomposition overwriting existing matrices
Source§

impl<T, D> SVD<T, D> for Faer

Source§

fn svd<L: Layout>( &self, a: &mut Slice<T, (D, D), L>, ) -> Result<SVDDecomp<T, Self::SingularValue, D>, SVDError>

Compute full SVD with new allocated matrices

Source§

fn svd_thin<L: Layout>( &self, a: &mut Slice<T, (D, D), L>, ) -> Result<SVDDecomp<T, Self::SingularValue, D>, SVDError>

Compute thin SVD with new allocated matrices

Source§

fn svd_s<L: Layout>( &self, a: &mut Slice<T, (D, D), L>, ) -> Result<Array<Self::SingularValue, (D,)>, SVDError>

Compute only singular values with new allocated matrix

Source§

fn svd_write<L: Layout, Ls: Layout, Lu: Layout, Lvt: Layout>( &self, a: &mut Slice<T, (D, D), L>, s: &mut Slice<Self::SingularValue, (D,), Ls>, u: &mut Slice<T, (D, D), Lu>, vt: &mut Slice<T, (D, D), Lvt>, ) -> Result<(), SVDError>

Compute full SVD, overwriting existing matrices

Source§

fn svd_write_s<L: Layout, Ls: Layout>( &self, a: &mut Slice<T, (D, D), L>, s: &mut Slice<Self::SingularValue, (D,), Ls>, ) -> Result<(), SVDError>

Compute only singular values, overwriting existing matrix

Source§

type SingularValue = T

Scalar type used for singular values. Read more
Source§

impl<T, D: Dim> Solve<T, D> for Faer

Source§

fn solve<R: Dim, La: Layout, Lb: Layout>( &self, a: &mut Slice<T, (D, D), La>, b: &Slice<T, (D, R), Lb>, ) -> Result<Array<T, (D, R)>, SolveError>

Solves linear system AX = B with new allocated solution matrix.

Source§

fn solve_write<R: Dim, La: Layout, Lb: Layout>( &self, a: &mut Slice<T, (D, D), La>, b: &mut Slice<T, (D, R), Lb>, ) -> Result<(), SolveError>

Solves linear system AX = B, overwriting B with the solution X.

Source§

impl<T, D: Dim> VecOps<T, D> for Faer
where T: FaerVectorScalar + Zero + Copy,

Source§

type Real = <T as ComplexFloat>::Real

Real scalar type used for norm results and real rotation coefficients. Read more
Source§

fn add_to_scaled<Lx: Layout, Ly: Layout>( &self, _alpha: T, _x: &Slice<T, (D,), Lx>, _y: &mut Slice<T, (D,), Ly>, )

Accumulate a scaled vector: y := α·x + y
Source§

fn dot<Lx: Layout, Ly: Layout>( &self, x: &Slice<T, (D,), Lx>, y: &Slice<T, (D,), Ly>, ) -> T

Dot product: ∑xᵢyᵢ
Source§

fn dotc<Lx: Layout, Ly: Layout>( &self, x: &Slice<T, (D,), Lx>, y: &Slice<T, (D,), Ly>, ) -> T

Conjugated dot product: ∑conj(xᵢ) * yᵢ (BLAS convention)
Source§

fn norm2<Lx: Layout>(&self, x: &Slice<T, (D,), Lx>) -> Self::Real

L2 norm: √(∑|xᵢ|²)
Source§

fn norm1<Lx: Layout>(&self, x: &Slice<T, (D,), Lx>) -> Self::Real

L1 norm (Manhattan) for complex numbers: ∑(|re(xᵢ)| + |im(xᵢ)|). For real numbers this reduces to ∑|xᵢ|.
Source§

fn rot<Lx: Layout, Ly: Layout>( &self, _x: &mut Slice<T, (D,), Lx>, _y: &mut Slice<T, (D,), Ly>, _c: Self::Real, _s: T, )

Givens rotation

Auto Trait Implementations§

§

impl Freeze for Faer

§

impl RefUnwindSafe for Faer

§

impl Send for Faer

§

impl Sync for Faer

§

impl Unpin for Faer

§

impl UnsafeUnpin for Faer

§

impl UnwindSafe for Faer

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V