pub trait Shape<const N: usize> {
type Coord;
// Required methods
fn size(&self) -> Self::Coord;
fn usize(&self) -> usize;
fn as_array(&self) -> [Self::Coord; N];
fn linearize(&self, p: [Self::Coord; N]) -> Self::Coord;
fn delinearize(&self, i: Self::Coord) -> [Self::Coord; N];
}Expand description
The shape of an N-dimensional array.
Required Associated Types§
Required Methods§
Sourcefn linearize(&self, p: [Self::Coord; N]) -> Self::Coord
fn linearize(&self, p: [Self::Coord; N]) -> Self::Coord
Translate an N-dimensional vector into a single number T that can be used for linear indexing.
Sourcefn delinearize(&self, i: Self::Coord) -> [Self::Coord; N]
fn delinearize(&self, i: Self::Coord) -> [Self::Coord; N]
The inverse of linearize.