pub struct Dim<I: ?Sized> { /* private fields */ }
Expand description
Dimension description.
Dim
describes the number of axes and the length of each axis
in an array. It is also used as an index type.
See also the Dimension
trait for its methods and
operations.
Examples
To create an array with a particular dimension, you’d just pass
a tuple (in this example (3, 2) is used), which is converted to
Dim
by the array constructor.
use ndarray::Array2;
use ndarray::Dim;
let mut array = Array2::zeros((3, 2));
array[[0, 0]] = 1.;
assert_eq!(array.raw_dim(), Dim([3, 2]));
Implementations
Trait Implementations
sourceimpl<'a, I> AddAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<'a, I> AddAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
Performs the +=
operation. Read more
sourceimpl<I> AddAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<I> AddAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl AddAssign<usize> for Dim<[Ix; 1]>
impl AddAssign<usize> for Dim<[Ix; 1]>
sourcefn add_assign(&mut self, rhs: Ix)
fn add_assign(&mut self, rhs: Ix)
Performs the +=
operation. Read more
sourceimpl Dimension for Dim<[Ix; 0]>
impl Dimension for Dim<[Ix; 0]>
sourceconst NDIM: Option<usize>
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
. Read more
type Smaller = Self
type Smaller = Self
Next smaller dimension (if applicable)
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 1]>
impl Dimension for Dim<[Ix; 1]>
sourceconst NDIM: Option<usize>
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
. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 2]>
impl Dimension for Dim<[Ix; 2]>
sourceconst NDIM: Option<usize>
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
. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 3]>
impl Dimension for Dim<[Ix; 3]>
sourceconst NDIM: Option<usize>
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
. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 4]>
impl Dimension for Dim<[Ix; 4]>
sourceconst NDIM: Option<usize>
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
. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 5]>
impl Dimension for Dim<[Ix; 5]>
sourceconst NDIM: Option<usize>
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
. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl Dimension for Dim<[Ix; 6]>
impl Dimension for Dim<[Ix; 6]>
sourceconst NDIM: Option<usize>
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
. Read more
type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix)
type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
sourcefn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
sourcefn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
sourcefn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
sourcefn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
sourcefn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
sourcefn __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. Read more
sourceimpl<'a, I> MulAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<'a, I> MulAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn mul_assign(&mut self, rhs: &Self)
fn mul_assign(&mut self, rhs: &Self)
Performs the *=
operation. Read more
sourceimpl<I> MulAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<I> MulAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *=
operation. Read more
sourceimpl<I> MulAssign<usize> for Dim<I> where
Dim<I>: Dimension,
impl<I> MulAssign<usize> for Dim<I> where
Dim<I>: Dimension,
sourcefn mul_assign(&mut self, rhs: Ix)
fn mul_assign(&mut self, rhs: Ix)
Performs the *=
operation. Read more
sourceimpl RemoveAxis for Dim<IxDynImpl>
impl RemoveAxis for Dim<IxDynImpl>
fn remove_axis(&self, axis: Axis) -> Self
sourceimpl RemoveAxis for Dim<[Ix; 1]>
impl RemoveAxis for Dim<[Ix; 1]>
fn remove_axis(&self, axis: Axis) -> Ix0
sourceimpl RemoveAxis for Dim<[Ix; 2]>
impl RemoveAxis for Dim<[Ix; 2]>
fn remove_axis(&self, axis: Axis) -> Ix1
sourceimpl RemoveAxis for Dim<[Ix; 3]>
impl RemoveAxis for Dim<[Ix; 3]>
fn remove_axis(&self, axis: Axis) -> Self::Smaller
sourceimpl RemoveAxis for Dim<[Ix; 4]>
impl RemoveAxis for Dim<[Ix; 4]>
fn remove_axis(&self, axis: Axis) -> Self::Smaller
sourceimpl RemoveAxis for Dim<[Ix; 5]>
impl RemoveAxis for Dim<[Ix; 5]>
fn remove_axis(&self, axis: Axis) -> Self::Smaller
sourceimpl RemoveAxis for Dim<[Ix; 6]>
impl RemoveAxis for Dim<[Ix; 6]>
fn remove_axis(&self, axis: Axis) -> Self::Smaller
sourceimpl<T, Dout> SliceArg<Dim<[usize; 0]>> for SliceInfo<T, Ix0, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 0]>> for SliceInfo<T, Ix0, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 1]>> for SliceInfo<T, Ix1, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 1]>> for SliceInfo<T, Ix1, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 2]>> for SliceInfo<T, Ix2, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 2]>> for SliceInfo<T, Ix2, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 3]>> for SliceInfo<T, Ix3, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 3]>> for SliceInfo<T, Ix3, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 4]>> for SliceInfo<T, Ix4, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 4]>> for SliceInfo<T, Ix4, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 5]>> for SliceInfo<T, Ix5, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 5]>> for SliceInfo<T, Ix5, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Dout> SliceArg<Dim<[usize; 6]>> for SliceInfo<T, Ix6, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
impl<T, Dout> SliceArg<Dim<[usize; 6]>> for SliceInfo<T, Ix6, Dout> where
T: AsRef<[SliceInfoElem]>,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl<T, Din, Dout> SliceArg<Dim<IxDynImpl>> for SliceInfo<T, Din, Dout> where
T: AsRef<[SliceInfoElem]>,
Din: Dimension,
Dout: Dimension,
impl<T, Din, Dout> SliceArg<Dim<IxDynImpl>> for SliceInfo<T, Din, Dout> where
T: AsRef<[SliceInfoElem]>,
Din: Dimension,
Dout: Dimension,
type OutDim = Dout
type OutDim = Dout
Dimensionality of the output array.
sourcefn __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. Read more
sourceimpl SliceArg<Dim<IxDynImpl>> for [SliceInfoElem]
impl SliceArg<Dim<IxDynImpl>> for [SliceInfoElem]
sourcefn __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. Read more
sourceimpl<'a, I> SubAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<'a, I> SubAssign<&'a Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
Performs the -=
operation. Read more
sourceimpl<I> SubAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
impl<I> SubAssign<Dim<I>> for Dim<I> where
Dim<I>: Dimension,
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
sourceimpl SubAssign<usize> for Dim<[Ix; 1]>
impl SubAssign<usize> for Dim<[Ix; 1]>
sourcefn sub_assign(&mut self, rhs: Ix)
fn sub_assign(&mut self, rhs: Ix)
Performs the -=
operation. Read more
impl<I: Copy + ?Sized> Copy for Dim<I>
impl<I: Eq + ?Sized> Eq for Dim<I>
impl NdIndex<Dim<[usize; 0]>> for ()
impl NdIndex<Dim<[usize; 0]>> for [Ix; 0]
impl NdIndex<Dim<[usize; 1]>> for Ix
impl NdIndex<Dim<[usize; 1]>> for [Ix; 1]
impl NdIndex<Dim<[usize; 2]>> for (Ix, Ix)
impl NdIndex<Dim<[usize; 2]>> for [Ix; 2]
impl NdIndex<Dim<[usize; 3]>> for (Ix, Ix, Ix)
impl NdIndex<Dim<[usize; 3]>> for [Ix; 3]
impl NdIndex<Dim<[usize; 4]>> for (Ix, Ix, Ix, Ix)
impl NdIndex<Dim<[usize; 4]>> for [Ix; 4]
impl NdIndex<Dim<[usize; 5]>> for (Ix, Ix, Ix, Ix, Ix)
impl NdIndex<Dim<[usize; 5]>> for [Ix; 5]
impl NdIndex<Dim<[usize; 6]>> for [Ix; 6]
impl NdIndex<Dim<IxDynImpl>> for Ix
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 0]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 4]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 5]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 5]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 6]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 6]
impl<'a> NdIndex<Dim<IxDynImpl>> for &'a IxDyn
impl<'a> NdIndex<Dim<IxDynImpl>> for &'a [Ix]
impl NdIndex<Dim<IxDynImpl>> for [Ix; 0]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 1]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 1]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 2]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 2]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 3]>
impl NdIndex<Dim<IxDynImpl>> for [Ix; 3]
impl NdIndex<Dim<IxDynImpl>> for Dim<[Ix; 4]>
impl<I: ?Sized> StructuralEq for Dim<I>
impl<I: ?Sized> StructuralPartialEq for Dim<I>
Auto Trait Implementations
impl<I: ?Sized> RefUnwindSafe for Dim<I> where
I: RefUnwindSafe,
impl<I: ?Sized> Send for Dim<I> where
I: Send,
impl<I: ?Sized> Sync for Dim<I> where
I: Sync,
impl<I: ?Sized> Unpin for Dim<I> where
I: Unpin,
impl<I: ?Sized> UnwindSafe for Dim<I> where
I: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more