pub trait Tensor<T, V: Copy + Unit + Add<Output = V> + Sub<Output = V> + PartialOrd, A: Address<V, DIMENSION>, const DIMENSION: usize>: IndexMut<A, Output = T> {
// Required methods
fn range(&self) -> Range<A>;
fn get(&self, address: A) -> Option<&T>;
fn get_mut(&mut self, address: A) -> Option<&mut T>;
// Provided method
fn contains(&self, address: A) -> bool { ... }
}Expand description
Tensor is a generic multidimensional data store trait. Think of it as a shared interface for a vector, a matrix, a cube, and a hypercube.
Required Methods§
Sourcefn range(&self) -> Range<A>
fn range(&self) -> Range<A>
range provides the bounds of the address space for the Tensor. The lower (inclusive bound) is the origin, conceptually placed at the left of a vector, the upper left of a matrix, and so on. That lower bound is conventionally zero-based, but does not have to be. The upper bound (exclusive) is the right side of the vector, the lower right of the matrix, etc. Be aware that while Range provides iterator functionality, once you move beyond single-dimension Tensors, that iterator does not provide the correct iteration of available addresses.