[−][src]Trait ndarray::Dimension
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 SliceArg: ?Sized + AsRef<[SliceOrIndex]>
SliceArg is the type which is used to specify slicing for this
dimension.
For the fixed size dimensions it is a fixed size array of the correct size, which you pass by reference. For the dynamic dimension it is a slice.
- For
Ix1:[SliceOrIndex; 1] - For
Ix2:[SliceOrIndex; 2] - and so on..
- For
IxDyn:[SliceOrIndex]
The easiest way to create a &SliceInfo<SliceArg, Do> is using the
s![] macro.
type Pattern: IntoDimension<Dim = Self>
Pattern matching friendly form of the dimension value.
- For
Ix1:usize, - For
Ix2:(usize, usize) - and so on..
- For
IxDyn:IxDyn
type Smaller: Dimension
Next smaller dimension (if applicable)
type Larger: Dimension
Next larger dimension
Associated Constants
const NDIM: Option<usize>
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 into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn __private__(&self) -> PrivateMarker
This trait is private to implement; this method exists to make it impossible to implement outside the crate.
Provided Methods
fn size(&self) -> usize
Compute the size of the dimension (number of elements)
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
fn as_array_view(&self) -> ArrayView1<Ix>
Borrow as a read-only array view.
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>
Borrow as a read-write array view.
fn into_dyn(self) -> IxDyn
Convert the dimensional into a dynamic dimensional (IxDyn).
Implementors
impl Dimension for Dim<[Ix; 0]>[src]
impl Dimension for Dim<[Ix; 0]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 0]
type Pattern = ()
type Smaller = Self
type Larger = Ix1
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn _fastest_varying_stride_order(&self) -> Self[src]
fn _fastest_varying_stride_order(&self) -> Selffn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn next_for(&self, _index: Self) -> Option<Self>[src]
fn next_for(&self, _index: Self) -> Option<Self>fn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, _ignore: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, _ignore: Axis) -> Self::Smallerfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 1]>[src]
impl Dimension for Dim<[Ix; 1]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 1]
type Pattern = Ix
type Smaller = Ix0
type Larger = Ix2
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn next_for(&self, index: Self) -> Option<Self>[src]
fn next_for(&self, index: Self) -> Option<Self>fn equal(&self, rhs: &Self) -> bool[src]
fn equal(&self, rhs: &Self) -> boolfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn default_strides(&self) -> Self[src]
fn default_strides(&self) -> Selffn _fastest_varying_stride_order(&self) -> Self[src]
fn _fastest_varying_stride_order(&self) -> Selffn min_stride_axis(&self, _: &Self) -> Axis[src]
fn min_stride_axis(&self, _: &Self) -> Axisfn max_stride_axis(&self, _: &Self) -> Axis[src]
fn max_stride_axis(&self, _: &Self) -> Axisfn first_index(&self) -> Option<Self>[src]
fn first_index(&self) -> Option<Self>fn stride_offset(index: &Self, stride: &Self) -> isize[src]
fn stride_offset(index: &Self, stride: &Self) -> isizefn stride_offset_checked(&self, stride: &Self, index: &Self) -> Option<isize>[src]
fn stride_offset_checked(&self, stride: &Self, index: &Self) -> Option<isize>fn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 2]>[src]
impl Dimension for Dim<[Ix; 2]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 2]
type Pattern = (Ix, Ix)
type Smaller = Ix1
type Larger = Ix3
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn next_for(&self, index: Self) -> Option<Self>[src]
fn next_for(&self, index: Self) -> Option<Self>fn equal(&self, rhs: &Self) -> bool[src]
fn equal(&self, rhs: &Self) -> boolfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn last_elem(&self) -> usize[src]
fn last_elem(&self) -> usizefn set_last_elem(&mut self, i: usize)[src]
fn set_last_elem(&mut self, i: usize)fn default_strides(&self) -> Self[src]
fn default_strides(&self) -> Selffn fortran_strides(&self) -> Self[src]
fn fortran_strides(&self) -> Selffn _fastest_varying_stride_order(&self) -> Self[src]
fn _fastest_varying_stride_order(&self) -> Selffn min_stride_axis(&self, strides: &Self) -> Axis[src]
fn min_stride_axis(&self, strides: &Self) -> Axisfn first_index(&self) -> Option<Self>[src]
fn first_index(&self) -> Option<Self>fn stride_offset(index: &Self, strides: &Self) -> isize[src]
fn stride_offset(index: &Self, strides: &Self) -> isizefn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>[src]
fn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>fn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 3]>[src]
impl Dimension for Dim<[Ix; 3]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 3]
type Pattern = (Ix, Ix, Ix)
type Smaller = Ix2
type Larger = Ix4
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn size(&self) -> usize[src]
fn size(&self) -> usizefn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn next_for(&self, index: Self) -> Option<Self>[src]
fn next_for(&self, index: Self) -> Option<Self>fn stride_offset(index: &Self, strides: &Self) -> isize[src]
fn stride_offset(index: &Self, strides: &Self) -> isizefn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>[src]
fn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>fn _fastest_varying_stride_order(&self) -> Self[src]
fn _fastest_varying_stride_order(&self) -> Selffn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 4]>[src]
impl Dimension for Dim<[Ix; 4]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 4]
type Pattern = (Ix, Ix, Ix, Ix)
type Smaller = Dim<[Ix; 3]>
type Larger = Ix5
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 5]>[src]
impl Dimension for Dim<[Ix; 5]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 5]
type Pattern = (Ix, Ix, Ix, Ix, Ix)
type Smaller = Dim<[Ix; 4]>
type Larger = Ix6
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for Dim<[Ix; 6]>[src]
impl Dimension for Dim<[Ix; 6]>const NDIM: Option<usize>[src]
type SliceArg = [SliceOrIndex; 6]
type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix)
type Smaller = Dim<[Ix; 5]>
type Larger = IxDyn
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarkerimpl Dimension for IxDyn[src]
impl Dimension for IxDynIxDyn 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 SliceArg = [SliceOrIndex]
type Pattern = Self
type Smaller = Self
type Larger = Self
fn ndim(&self) -> usize[src]
fn ndim(&self) -> usizefn slice(&self) -> &[Ix][src]
fn slice(&self) -> &[Ix]fn slice_mut(&mut self) -> &mut [Ix][src]
fn slice_mut(&mut self) -> &mut [Ix]fn into_pattern(self) -> Self::Pattern[src]
fn into_pattern(self) -> Self::Patternfn zero_index(&self) -> Self[src]
fn zero_index(&self) -> Selffn zero_index_with_ndim(ndim: usize) -> Self[src]
fn zero_index_with_ndim(ndim: usize) -> Selffn insert_axis(&self, axis: Axis) -> Self::Larger[src]
fn insert_axis(&self, axis: Axis) -> Self::Largerfn try_remove_axis(&self, axis: Axis) -> Self::Smaller[src]
fn try_remove_axis(&self, axis: Axis) -> Self::Smallerfn from_dimension<D2: Dimension>(d: &D2) -> Option<Self>[src]
fn from_dimension<D2: Dimension>(d: &D2) -> Option<Self>fn size(&self) -> usize[src]
fn size(&self) -> usizefn size_checked(&self) -> Option<usize>[src]
fn size_checked(&self) -> Option<usize>fn as_array_view(&self) -> ArrayView1<Ix>[src]
fn as_array_view(&self) -> ArrayView1<Ix>fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>[src]
fn as_array_view_mut(&mut self) -> ArrayViewMut1<Ix>fn into_dyn(self) -> IxDyn[src]
fn into_dyn(self) -> IxDynfn __private__(&self) -> PrivateMarker[src]
fn __private__(&self) -> PrivateMarker