Skip to main content

VecOps

Trait VecOps 

Source
pub trait VecOps<T, D1: Dim> {
    type Real;

    // Required methods
    fn add_to_scaled<Lx: Layout, Ly: Layout>(
        &self,
        alpha: T,
        x: &Slice<T, (D1,), Lx>,
        y: &mut Slice<T, (D1,), Ly>,
    );
    fn dot<Lx: Layout, Ly: Layout>(
        &self,
        x: &Slice<T, (D1,), Lx>,
        y: &Slice<T, (D1,), Ly>,
    ) -> T;
    fn dotc<Lx: Layout, Ly: Layout>(
        &self,
        x: &Slice<T, (D1,), Lx>,
        y: &Slice<T, (D1,), Ly>,
    ) -> T;
    fn norm2<Lx: Layout>(&self, x: &Slice<T, (D1,), Lx>) -> Self::Real;
    fn norm1<Lx: Layout>(&self, x: &Slice<T, (D1,), Lx>) -> Self::Real;
    fn rot<Lx: Layout, Ly: Layout>(
        &self,
        x: &mut Slice<T, (D1,), Lx>,
        y: &mut Slice<T, (D1,), Ly>,
        c: Self::Real,
        s: T,
    );
}
Expand description

Vector operations and basic linear algebra utilities

Required Associated Types§

Source

type Real

Real scalar type used for norm results and real rotation coefficients.

This type is chosen by the backend implementation for the scalar type T.

Required Methods§

Source

fn add_to_scaled<Lx: Layout, Ly: Layout>( &self, alpha: T, x: &Slice<T, (D1,), Lx>, y: &mut Slice<T, (D1,), Ly>, )

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

Source

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

Dot product: ∑xᵢyᵢ

Source

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

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

Source

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

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

Source

fn norm1<Lx: Layout>(&self, x: &Slice<T, (D1,), 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, (D1,), Lx>, y: &mut Slice<T, (D1,), Ly>, c: Self::Real, s: T, )

Givens rotation

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: ComplexFloat + Add<Output = T> + Mul<Output = T> + Zero + Copy, D: Dim> VecOps<T, D> for Naive