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> { type SliceArg: ?Sized + AsRef<[Si]>; type Pattern: IntoDimension<Dim = Self>; type Smaller: Dimension; type Larger: Dimension; fn into_pattern(self) -> Self::Pattern; 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 { ... } }
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<[Si]>
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
:[Si; 1]
- For
Ix2
:[Si; 2]
- and so on..
- For
IxDyn
:[Si]
The easiest way to create a &SliceArg
is using the macro
s![]
.
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
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]> type SliceArg = [Si; 0]; type Pattern = (); type Smaller = Self; type Larger = Ix1;
impl Dimension for Dim<[Ix; 1]> type SliceArg = [Si; 1]; type Pattern = Ix; type Smaller = Ix0; type Larger = Ix2;
impl Dimension for Dim<[Ix; 2]> type SliceArg = [Si; 2]; type Pattern = (Ix, Ix); type Smaller = Ix1; type Larger = Ix3;
impl Dimension for Dim<[Ix; 3]> type SliceArg = [Si; 3]; type Pattern = (Ix, Ix, Ix); type Smaller = Ix2; type Larger = Ix4;
impl Dimension for Dim<[Ix; 4]> type SliceArg = [Si; 4]; type Pattern = (Ix, Ix, Ix, Ix); type Smaller = Dim<[Ix; 3]>; type Larger = Ix5;
impl Dimension for Dim<[Ix; 5]> type SliceArg = [Si; 5]; type Pattern = (Ix, Ix, Ix, Ix, Ix); type Smaller = Dim<[Ix; 4]>; type Larger = Ix6;
impl Dimension for Dim<[Ix; 6]> type SliceArg = [Si; 6]; type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix); type Smaller = Dim<[Ix; 5]>; type Larger = IxDyn;
impl Dimension for IxDyn type SliceArg = [Si]; type Pattern = Self; type Smaller = Self; type Larger = Self;