pub trait Dimension: Clone + Eq + Debug + Send + Sync + Default + IndexMut<usize, Output = usize> + Add<Self, Output = Self> + AddAssign<Self> + for<'x> AddAssign<&'x Self> + Sub<Self, Output = Self> + SubAssign<Self> + for<'x> SubAssign<&'x Self> + Mul<usize, Output = Self, Output = Self> + Mul<Self> + MulAssign<Self> + for<'x> MulAssign<&'x Self> + MulAssign<usize> + DimMax<Dim<[usize; 0]>, Output = Self, Output = Self, Output = Dim<IxDynImpl>, Output = Self, Output = Self::Larger> + DimMax<Self> + DimMax<Dim<IxDynImpl>> + DimMax<Self::Smaller> + DimMax<Self::Larger> + DimAdd<Self, Output = Self, Output = Self::Larger, Output = Dim<IxDynImpl>> + DimAdd<Self::Smaller> + DimAdd<Self::Larger> + DimAdd<Dim<[usize; 0]>> + DimAdd<Dim<[usize; 1]>> + DimAdd<Dim<IxDynImpl>> {
type Pattern: IntoDimension + Clone + Debug + PartialEq<Self::Pattern> + Eq + Default
where
<Self::Pattern as IntoDimension>::Dim == Self;
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) -> ArrayBase<ViewRepr<&usize>, Dim<[usize; 1]>> { ... }
fn as_array_view_mut(
&mut self
) -> ArrayBase<ViewRepr<&mut usize>, Dim<[usize; 1]>> { ... }
fn into_dyn(self) -> Dim<IxDynImpl> { ... }
}
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
Pattern matching friendly form of the dimension value.
- For
Ix1
:usize
, - For
Ix2
:(usize, usize)
- and so on..
- For
IxDyn
:IxDyn
type Larger: Dimension + RemoveAxis
type Larger: Dimension + RemoveAxis
Next larger dimension
Associated Constants
Required methods
fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
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
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_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
Borrow as a read-only array view.
Borrow as a read-write array view.