Trait TensorVec

Source
pub trait TensorVec
where Self: FromIterator<Self::Item> + Index<usize, Output = Self::Item> + IndexMut<usize>,
{ type Item; type Slice<'a>; // Required methods fn append(&mut self, other: &mut Self); fn capacity(&self) -> usize; fn is_empty(&self) -> bool; fn len(&self) -> usize; fn new(slice: Self::Slice<'_>) -> Self; fn push(&mut self, item: Self::Item); fn remove(&mut self, _index: usize) -> Self::Item; fn retain<F>(&mut self, f: F) where F: FnMut(&Self::Item) -> bool; fn swap_remove(&mut self, _index: usize) -> Self::Item; fn zero(len: usize) -> Self; }
Expand description

Common methods for tensors derived from Vec.

Required Associated Types§

Source

type Item

The type of element encountered when iterating over the tensor.

Source

type Slice<'a>

The type of slice corresponding to the tensor.

Required Methods§

Source

fn append(&mut self, other: &mut Self)

Moves all the elements of other into self, leaving other empty.

Source

fn capacity(&self) -> usize

Returns the total number of elements the vector can hold without reallocating.

Source

fn is_empty(&self) -> bool

Returns true if the vector contains no elements.

Source

fn len(&self) -> usize

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

Source

fn new(slice: Self::Slice<'_>) -> Self

Returns a tensor given a slice.

Source

fn push(&mut self, item: Self::Item)

Appends an element to the back of the Vec.

Source

fn remove(&mut self, _index: usize) -> Self::Item

Removes an element from the Vec and returns it, shifting elements to the left.

Source

fn retain<F>(&mut self, f: F)
where F: FnMut(&Self::Item) -> bool,

Retains only the elements specified by the predicate.

Source

fn swap_remove(&mut self, _index: usize) -> Self::Item

Removes an element from the Vec and returns it, replacing it with the last element.

Source

fn zero(len: usize) -> Self

Returns the zero tensor.

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 TensorVec for SquareMatrix

Source§

type Item = Vector

Source§

type Slice<'a> = &'a [&'a [f64]]

Source§

impl TensorVec for Vector

Source§

type Item = f64

Source§

type Slice<'a> = &'a [f64]

Source§

impl<const D: usize, const I: usize> TensorVec for TensorRank1Vec2D<D, I>

Source§

type Item = TensorRank1Vec<D, I>

Source§

type Slice<'a> = &'a [&'a [[f64; D]]]

Source§

impl<const D: usize, const I: usize> TensorVec for TensorRank1Vec<D, I>

Source§

type Item = TensorRank1<D, I>

Source§

type Slice<'a> = &'a [[f64; D]]

Source§

impl<const D: usize, const I: usize, const J: usize> TensorVec for TensorRank2Vec2D<D, I, J>

Source§

type Item = TensorRank2Vec<D, I, J>

Source§

type Slice<'a> = &'a [&'a [[[f64; D]; D]]]

Source§

impl<const D: usize, const I: usize, const J: usize> TensorVec for TensorRank2Vec<D, I, J>

Source§

type Item = TensorRank2<D, I, J>

Source§

type Slice<'a> = &'a [[[f64; D]; D]]