Tensor

Trait Tensor 

Source
pub trait Tensor
where for<'a> Self: Sized + Add<Self, Output = Self> + Add<&'a Self, Output = Self> + AddAssign + AddAssign<&'a Self> + Clone + Debug + Default + Display + Div<TensorRank0, Output = Self> + DivAssign<TensorRank0> + DivAssign<&'a TensorRank0> + Mul<TensorRank0, Output = Self> + MulAssign<TensorRank0> + MulAssign<&'a TensorRank0> + Sub<Self, Output = Self> + Sub<&'a Self, Output = Self> + SubAssign + SubAssign<&'a Self> + Sum, Self::Item: Tensor,
{ type Item;
Show 14 methods // Required methods fn iter(&self) -> impl Iterator<Item = &Self::Item>; fn iter_mut(&mut self) -> impl Iterator<Item = &mut Self::Item>; fn len(&self) -> usize; fn size(&self) -> usize; // Provided methods fn error_count( &self, other: &Self, tol_abs: Scalar, tol_rel: Scalar, ) -> Option<usize> { ... } fn full_contraction(&self, tensor: &Self) -> TensorRank0 { ... } fn is_zero(&self) -> bool { ... } fn norm(&self) -> TensorRank0 { ... } fn norm_inf(&self) -> TensorRank0 { ... } fn norm_squared(&self) -> TensorRank0 { ... } fn normalize(&mut self) { ... } fn normalized(self) -> Self { ... } fn sub_abs(&self, other: &Self) -> Self { ... } fn sub_rel(&self, other: &Self) -> Self { ... }
}
Expand description

Common methods for tensors.

Required Associated Types§

Source

type Item

The type of item encountered when iterating over the tensor.

Required Methods§

Source

fn iter(&self) -> impl Iterator<Item = &Self::Item>

Returns an iterator.

The iterator yields all items from start to end. Read more

Source

fn iter_mut(&mut self) -> impl Iterator<Item = &mut Self::Item>

Returns an iterator that allows modifying each value.

The iterator yields all items from start to end. Read more

Source

fn len(&self) -> usize

Returns the number of elements, also referred to as the ‘length’.

Source

fn size(&self) -> usize

Returns the total number of entries.

Provided Methods§

Source

fn error_count( &self, other: &Self, tol_abs: Scalar, tol_rel: Scalar, ) -> Option<usize>

Returns number of different entries given absolute and relative tolerances.

Source

fn full_contraction(&self, tensor: &Self) -> TensorRank0

Returns the full contraction with another tensor.

Source

fn is_zero(&self) -> bool

Checks whether the tensor is the zero tensor.

Source

fn norm(&self) -> TensorRank0

Returns the tensor norm.

Source

fn norm_inf(&self) -> TensorRank0

Returns the infinity norm.

Source

fn norm_squared(&self) -> TensorRank0

Returns the tensor norm squared.

Source

fn normalize(&mut self)

Normalizes the tensor.

Source

fn normalized(self) -> Self

Returns the tensor normalized.

Source

fn sub_abs(&self, other: &Self) -> Self

Returns the positive difference of the two tensors.

Source

fn sub_rel(&self, other: &Self) -> Self

Returns the relative difference of the two tensors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Tensor for SquareMatrix

Source§

impl Tensor for Vector

Source§

impl Tensor for TensorRank0

Source§

impl<T1, T2> Tensor for TensorTuple<T1, T2>
where T1: Tensor, T2: Tensor,

Source§

type Item = <T1 as Tensor>::Item

Source§

impl<T> Tensor for TensorVector<T>
where T: Tensor,

Source§

type Item = T

Source§

impl<T, const N: usize> Tensor for TensorList<T, N>
where T: Tensor,

Source§

type Item = T

Source§

impl<const D: usize, const I: usize> Tensor for TensorRank1<D, I>

Source§

impl<const D: usize, const I: usize, const J: usize> Tensor for TensorRank2<D, I, J>

Source§

impl<const D: usize, const I: usize, const J: usize, const K: usize> Tensor for TensorRank3<D, I, J, K>

Source§

type Item = TensorRank2<D, J, K>

Source§

impl<const D: usize, const I: usize, const J: usize, const K: usize, const L: usize> Tensor for TensorRank4<D, I, J, K, L>

Source§

type Item = TensorRank3<D, J, K, L>