pub struct Naive;Expand description
Simple backend, mostly for demonstratration purposes
Trait Implementations§
Source§impl<T: ComplexFloat<Real = T> + 'static + PartialOrd + Add<Output = T> + Mul<Output = T> + Zero + Copy> Argmax<T> for Naive
impl<T: ComplexFloat<Real = T> + 'static + PartialOrd + Add<Output = T> + Mul<Output = T> + Zero + Copy> Argmax<T> for Naive
fn argmax_overwrite<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>>
fn argmax<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, ) -> Option<Vec<usize>>
Index of max xᵢ (argmaxᵢ xᵢ)
fn argmax_abs_overwrite<Lx: Layout, S: Shape>( &self, x: &Slice<T, S, Lx>, output: &mut Vec<usize>, ) -> bool
Source§impl<T> MatMul<T> for Naivewhere
T: ComplexFloat,
impl<T> MatMul<T> for Naivewhere
T: ComplexFloat,
Source§fn contract_all<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract_all<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, ) -> impl ContractBuilder<'a, T, La, Lb>
Contracts all axes of the first tensor with all axes of the second tensor.
Source§fn contract_n<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
n: usize,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract_n<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, n: usize, ) -> impl ContractBuilder<'a, T, La, Lb>
Contracts the last n axes of the first tensor with the first n axes of the second tensor.
§Example
For two matrices (2D tensors), contract_n(1) performs standard matrix multiplication.
Source§fn contract<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
axes_a: impl Into<Box<[usize]>>,
axes_b: impl Into<Box<[usize]>>,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, axes_a: impl Into<Box<[usize]>>, axes_b: impl Into<Box<[usize]>>, ) -> impl ContractBuilder<'a, T, La, Lb>
Specifies exactly which axes to contract_all.
§Example
specific([1, 2], [3, 4]) contracts axis 1 and 2 of a
with axes 3 and 4 of b.
fn matmul<'a, La, Lb>( &self, a: &'a DSlice<T, 2, La>, b: &'a DSlice<T, 2, Lb>, ) -> impl MatMulBuilder<'a, T, La, Lb>
Source§impl<T: ComplexFloat + 'static + Add<Output = T> + Mul<Output = T> + Zero + Copy> VecOps<T> for Naive
impl<T: ComplexFloat + 'static + Add<Output = T> + Mul<Output = T> + Zero + Copy> VecOps<T> for Naive
Source§fn add_to_scaled<Lx: Layout, Ly: Layout>(
&self,
_alpha: T,
_x: &DSlice<T, 1, Lx>,
_y: &mut DSlice<T, 1, Ly>,
)
fn add_to_scaled<Lx: Layout, Ly: Layout>( &self, _alpha: T, _x: &DSlice<T, 1, Lx>, _y: &mut DSlice<T, 1, Ly>, )
Accumulate a scaled vector:
y := α·x + ySource§fn dot<Lx: Layout, Ly: Layout>(
&self,
x: &DSlice<T, 1, Lx>,
y: &DSlice<T, 1, Ly>,
) -> T
fn dot<Lx: Layout, Ly: Layout>( &self, x: &DSlice<T, 1, Lx>, y: &DSlice<T, 1, Ly>, ) -> T
Dot product:
∑xᵢyᵢSource§fn dotc<Lx: Layout, Ly: Layout>(
&self,
_x: &DSlice<T, 1, Lx>,
_y: &DSlice<T, 1, Ly>,
) -> T
fn dotc<Lx: Layout, Ly: Layout>( &self, _x: &DSlice<T, 1, Lx>, _y: &DSlice<T, 1, Ly>, ) -> T
Conjugated dot product:
∑(xᵢ * conj(yᵢ))Source§fn norm1<Lx: Layout>(&self, _x: &DSlice<T, 1, Lx>) -> T::Realwhere
T: ComplexFloat,
fn norm1<Lx: Layout>(&self, _x: &DSlice<T, 1, Lx>) -> T::Realwhere
T: ComplexFloat,
L1 norm:
∑|xᵢ|Source§fn copy<Lx: Layout, Ly: Layout>(
&self,
_x: &DSlice<T, 1, Lx>,
_y: &mut DSlice<T, 1, Ly>,
)
fn copy<Lx: Layout, Ly: Layout>( &self, _x: &DSlice<T, 1, Lx>, _y: &mut DSlice<T, 1, Ly>, )
Copy vector:
y := x (TODO)Source§fn scal<Lx: Layout>(&self, _alpha: T, _x: &mut DSlice<T, 1, Lx>)
fn scal<Lx: Layout>(&self, _alpha: T, _x: &mut DSlice<T, 1, Lx>)
Scale vector:
x := α·xᵢ (TODO)Auto Trait Implementations§
impl Freeze for Naive
impl RefUnwindSafe for Naive
impl Send for Naive
impl Sync for Naive
impl Unpin for Naive
impl UnwindSafe for Naive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoCloned<T> for T
impl<T> IntoCloned<T> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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