Trait ndarray::Dimension[][src]

pub trait Dimension: Clone + Eq + Debug + Send + Sync + Default + IndexMut<usize, Output = usize> + Add<Self, Output = Self> + AddAssign + for<'x> AddAssign<&'x Self> + Sub<Self, Output = Self> + SubAssign + for<'x> SubAssign<&'x Self> + Mul<usize, Output = Self> + Mul<Self, Output = Self> + MulAssign + for<'x> MulAssign<&'x Self> + MulAssign<usize> + DimMax<Ix0, Output = Self> + DimMax<Self, Output = Self> + DimMax<IxDyn, Output = IxDyn> + DimMax<Self::Smaller, Output = Self> + DimMax<Self::Larger, Output = Self::Larger> + DimAdd<Self> + DimAdd<Self::Smaller> + DimAdd<Self::Larger> + DimAdd<Ix0, Output = Self> + DimAdd<Ix1, Output = Self::Larger> + DimAdd<IxDyn, Output = IxDyn> {
    type Pattern: IntoDimension<Dim = Self> + Clone + Debug + PartialEq + Eq + Default;
    type Smaller: Dimension;
    type Larger: Dimension + RemoveAxis;

    const NDIM: Option<usize>;

    fn ndim(&self) -> usize;
fn into_pattern(self) -> Self::Pattern;
fn zeros(ndim: usize) -> Self;
fn __private__(&self) -> PrivateMarker; fn size(&self) -> usize { ... }
fn size_checked(&self) -> Option<usize> { ... }
fn as_array_view(&self) -> ArrayView1<'_, Ix> { ... }
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix> { ... }
fn into_dyn(self) -> IxDyn { ... } }
Expand description

Array shape and index trait.

This trait defines a number of methods and operations that can be used on dimensions and indices.

Note: This trait can not be implemented outside the crate

Associated Types

type Pattern: IntoDimension<Dim = Self> + Clone + Debug + PartialEq + Eq + Default[src]

Expand description

Pattern matching friendly form of the dimension value.

  • For Ix1: usize,
  • For Ix2: (usize, usize)
  • and so on..
  • For IxDyn: IxDyn

type Smaller: Dimension[src]

Expand description

Next smaller dimension (if applicable)

type Larger: Dimension + RemoveAxis[src]

Expand description

Next larger dimension

Associated Constants

const NDIM: Option<usize>[src]

Expand description

For fixed-size dimension representations (e.g. Ix2), this should be Some(ndim), and for variable-size dimension representations (e.g. IxDyn), this should be None.

Required methods

fn ndim(&self) -> usize[src]

Expand description

Returns the number of dimensions (number of axes).

fn into_pattern(self) -> Self::Pattern[src]

Expand description

Convert the dimension into a pattern matching friendly value.

fn zeros(ndim: usize) -> Self[src]

Expand description

Creates a dimension of all zeros with the specified ndim.

This method is useful for generalizing over fixed-size and variable-size dimension representations.

Panics if Self has a fixed size that is not ndim.

fn __private__(&self) -> PrivateMarker[src]

Expand description

This trait is private to implement; this method exists to make it impossible to implement outside the crate.

Provided methods

fn size(&self) -> usize[src]

Expand description

Compute the size of the dimension (number of elements)

fn size_checked(&self) -> Option<usize>[src]

Expand description

Compute the size while checking for overflow.

fn as_array_view(&self) -> ArrayView1<'_, Ix>[src]

Expand description

Borrow as a read-only array view.

fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>[src]

Expand description

Borrow as a read-write array view.

fn into_dyn(self) -> IxDyn[src]

Expand description

Convert the dimensional into a dynamic dimensional (IxDyn).

Implementors

impl Dimension for Dim<[Ix; 0]>[src]

const NDIM: Option<usize>[src]

type Pattern = ()

type Smaller = Self

type Larger = Ix1

fn ndim(&self) -> usize[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn _fastest_varying_stride_order(&self) -> Self[src]

fn into_pattern(self) -> Self::Pattern[src]

fn zeros(ndim: usize) -> Self[src]

fn next_for(&self, _index: Self) -> Option<Self>[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, _ignore: Axis) -> Self::Smaller[src]

impl Dimension for Dim<[Ix; 1]>[src]

const NDIM: Option<usize>[src]

type Pattern = Ix

type Smaller = Ix0

type Larger = Ix2

fn ndim(&self) -> usize[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn into_pattern(self) -> Self::Pattern[src]

fn zeros(ndim: usize) -> Self[src]

fn next_for(&self, index: Self) -> Option<Self>[src]

fn equal(&self, rhs: &Self) -> bool[src]

fn size(&self) -> usize[src]

fn size_checked(&self) -> Option<usize>[src]

fn default_strides(&self) -> Self[src]

fn _fastest_varying_stride_order(&self) -> Self[src]

fn min_stride_axis(&self, _: &Self) -> Axis[src]

fn max_stride_axis(&self, _: &Self) -> Axis[src]

fn first_index(&self) -> Option<Self>[src]

fn stride_offset(index: &Self, stride: &Self) -> isize[src]

fn stride_offset_checked(&self, stride: &Self, index: &Self) -> Option<isize>[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

fn from_dimension<D2: Dimension>(d: &D2) -> Option<Self>[src]

impl Dimension for Dim<[Ix; 2]>[src]

const NDIM: Option<usize>[src]

type Pattern = (Ix, Ix)

type Smaller = Ix1

type Larger = Ix3

fn ndim(&self) -> usize[src]

fn into_pattern(self) -> Self::Pattern[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn zeros(ndim: usize) -> Self[src]

fn next_for(&self, index: Self) -> Option<Self>[src]

fn equal(&self, rhs: &Self) -> bool[src]

fn size(&self) -> usize[src]

fn size_checked(&self) -> Option<usize>[src]

fn last_elem(&self) -> usize[src]

fn set_last_elem(&mut self, i: usize)[src]

fn default_strides(&self) -> Self[src]

fn fortran_strides(&self) -> Self[src]

fn _fastest_varying_stride_order(&self) -> Self[src]

fn min_stride_axis(&self, strides: &Self) -> Axis[src]

fn first_index(&self) -> Option<Self>[src]

fn stride_offset(index: &Self, strides: &Self) -> isize[src]

fn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

impl Dimension for Dim<[Ix; 3]>[src]

const NDIM: Option<usize>[src]

type Pattern = (Ix, Ix, Ix)

type Smaller = Ix2

type Larger = Ix4

fn ndim(&self) -> usize[src]

fn into_pattern(self) -> Self::Pattern[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn size(&self) -> usize[src]

fn zeros(ndim: usize) -> Self[src]

fn next_for(&self, index: Self) -> Option<Self>[src]

fn stride_offset(index: &Self, strides: &Self) -> isize[src]

fn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>[src]

fn _fastest_varying_stride_order(&self) -> Self[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

impl Dimension for Dim<[Ix; 4]>[src]

const NDIM: Option<usize>[src]

type Pattern = (Ix, Ix, Ix, Ix)

type Smaller = Dim<[Ix; 3]>

type Larger = Ix5

fn ndim(&self) -> usize[src]

fn into_pattern(self) -> Self::Pattern[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn zeros(ndim: usize) -> Self[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

impl Dimension for Dim<[Ix; 5]>[src]

const NDIM: Option<usize>[src]

type Pattern = (Ix, Ix, Ix, Ix, Ix)

type Smaller = Dim<[Ix; 4]>

type Larger = Ix6

fn ndim(&self) -> usize[src]

fn into_pattern(self) -> Self::Pattern[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn zeros(ndim: usize) -> Self[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

impl Dimension for Dim<[Ix; 6]>[src]

const NDIM: Option<usize>[src]

type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix)

type Smaller = Dim<[Ix; 5]>

type Larger = IxDyn

fn ndim(&self) -> usize[src]

fn into_pattern(self) -> Self::Pattern[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn zeros(ndim: usize) -> Self[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

impl Dimension for IxDyn[src]

IxDyn is a “dynamic” index, pretty hard to use when indexing, and memory wasteful, but it allows an arbitrary and dynamic number of axes.

const NDIM: Option<usize>[src]

type Pattern = Self

type Smaller = Self

type Larger = Self

fn ndim(&self) -> usize[src]

fn slice(&self) -> &[Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn slice_mut(&mut self) -> &mut [Ix]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn into_pattern(self) -> Self::Pattern[src]

fn zeros(ndim: usize) -> Self[src]

fn insert_axis(&self, axis: Axis) -> Self::Larger[src]

fn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]

fn from_dimension<D2: Dimension>(d: &D2) -> Option<Self>[src]

fn into_dyn(self) -> IxDyn[src]