Shape

Trait Shape 

Source
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§

Source

fn size(&self) -> Self::Coord

The number of elements in an array with this shape.

Source

fn usize(&self) -> usize

The same as self.size() as usize.

Source

fn as_array(&self) -> [Self::Coord; N]

The dimensions of the shape.

Source

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.

Source

fn delinearize(&self, i: Self::Coord) -> [Self::Coord; N]

The inverse of linearize.

Implementors§

Source§

impl Shape<2> for RuntimePow2Shape<i8, 2>

Source§

impl Shape<2> for RuntimePow2Shape<i16, 2>

Source§

impl Shape<2> for RuntimePow2Shape<i32, 2>

Source§

impl Shape<2> for RuntimePow2Shape<i64, 2>

Source§

impl Shape<2> for RuntimePow2Shape<u8, 2>

Source§

impl Shape<2> for RuntimePow2Shape<u16, 2>

Source§

impl Shape<2> for RuntimePow2Shape<u32, 2>

Source§

impl Shape<2> for RuntimePow2Shape<u64, 2>

Source§

impl Shape<2> for RuntimePow2Shape<usize, 2>

Source§

impl Shape<2> for RuntimeShape<i8, 2>

Source§

impl Shape<2> for RuntimeShape<i16, 2>

Source§

impl Shape<2> for RuntimeShape<i32, 2>

Source§

impl Shape<2> for RuntimeShape<i64, 2>

Source§

impl Shape<2> for RuntimeShape<u8, 2>

Source§

impl Shape<2> for RuntimeShape<u16, 2>

Source§

impl Shape<2> for RuntimeShape<u32, 2>

Source§

impl Shape<2> for RuntimeShape<u64, 2>

Source§

impl Shape<2> for RuntimeShape<usize, 2>

Source§

impl Shape<3> for RuntimePow2Shape<i8, 3>

Source§

impl Shape<3> for RuntimePow2Shape<i16, 3>

Source§

impl Shape<3> for RuntimePow2Shape<i32, 3>

Source§

impl Shape<3> for RuntimePow2Shape<i64, 3>

Source§

impl Shape<3> for RuntimePow2Shape<u8, 3>

Source§

impl Shape<3> for RuntimePow2Shape<u16, 3>

Source§

impl Shape<3> for RuntimePow2Shape<u32, 3>

Source§

impl Shape<3> for RuntimePow2Shape<u64, 3>

Source§

impl Shape<3> for RuntimePow2Shape<usize, 3>

Source§

impl Shape<3> for RuntimeShape<i8, 3>

Source§

impl Shape<3> for RuntimeShape<i16, 3>

Source§

impl Shape<3> for RuntimeShape<i32, 3>

Source§

impl Shape<3> for RuntimeShape<i64, 3>

Source§

impl Shape<3> for RuntimeShape<u8, 3>

Source§

impl Shape<3> for RuntimeShape<u16, 3>

Source§

impl Shape<3> for RuntimeShape<u32, 3>

Source§

impl Shape<3> for RuntimeShape<u64, 3>

Source§

impl Shape<3> for RuntimeShape<usize, 3>

Source§

impl Shape<4> for RuntimePow2Shape<i8, 4>

Source§

impl Shape<4> for RuntimePow2Shape<i16, 4>

Source§

impl Shape<4> for RuntimePow2Shape<i32, 4>

Source§

impl Shape<4> for RuntimePow2Shape<i64, 4>

Source§

impl Shape<4> for RuntimePow2Shape<u8, 4>

Source§

impl Shape<4> for RuntimePow2Shape<u16, 4>

Source§

impl Shape<4> for RuntimePow2Shape<u32, 4>

Source§

impl Shape<4> for RuntimePow2Shape<u64, 4>

Source§

impl Shape<4> for RuntimePow2Shape<usize, 4>

Source§

impl Shape<4> for RuntimeShape<i8, 4>

Source§

impl Shape<4> for RuntimeShape<i16, 4>

Source§

impl Shape<4> for RuntimeShape<i32, 4>

Source§

impl Shape<4> for RuntimeShape<i64, 4>

Source§

impl Shape<4> for RuntimeShape<u8, 4>

Source§

impl Shape<4> for RuntimeShape<u16, 4>

Source§

impl Shape<4> for RuntimeShape<u32, 4>

Source§

impl Shape<4> for RuntimeShape<u64, 4>

Source§

impl Shape<4> for RuntimeShape<usize, 4>

Source§

impl<S, const N: usize> Shape<N> for S
where S: ConstShape<N>,

Source§

type Coord = <S as ConstShape<N>>::Coord