Skip to main content

Naive

Struct Naive 

Source
pub struct Naive;
Expand description

Simple backend, mostly for demonstratration purposes

Trait Implementations§

Source§

impl<T: ComplexFloat<Real = T> + PartialOrd + Add<Output = T> + Mul<Output = T> + Zero + Copy> Argmax<T> for Naive

Source§

fn argmax_write<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, output: &mut Vec<usize>, ) -> bool

Source§

fn argmax<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, ) -> Option<Vec<usize>>

Index of max xᵢ (argmaxᵢ xᵢ)
Source§

fn argmax_abs_write<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, output: &mut Vec<usize>, ) -> bool

Source§

fn argmax_abs<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, ) -> Option<Vec<usize>>

Index of max |xᵢ| (argmaxᵢ |xᵢ|)
Source§

impl<T> Contract<T> for Naive
where T: ComplexFloat + Zero + One + 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 Naive

Source§

fn default() -> Naive

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

impl<T, D0: Dim, D1: Dim> MatVec<T, D0, D1> for Naive
where T: ComplexFloat,

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 Naive
where T: ComplexFloat, 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 Naive
where T: ComplexFloat + Zero + One + MulAdd<Output = T>,

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§

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§

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

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 Naive

§

impl RefUnwindSafe for Naive

§

impl Send for Naive

§

impl Sync for Naive

§

impl Unpin for Naive

§

impl UnsafeUnpin for Naive

§

impl UnwindSafe for Naive

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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