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§
source§impl<'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,
source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
Performs the
+=
operation. Read moresource§impl<I> AddAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
impl<I> AddAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl AddAssign<usize> for Dim<[Ix; 1]>
impl AddAssign<usize> for Dim<[Ix; 1]>
source§fn add_assign(&mut self, rhs: Ix)
fn add_assign(&mut self, rhs: Ix)
Performs the
+=
operation. Read moresource§impl<'de, I> Deserialize<'de> for Dim<I>where
I: Deserialize<'de>,
impl<'de, I> Deserialize<'de> for Dim<I>where
I: Deserialize<'de>,
Requires crate feature "serde-1"
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Dimension for Dim<[Ix; 0]>
impl Dimension for Dim<[Ix; 0]>
source§const 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 SliceArg = [SliceOrIndex; 0]
type SliceArg = [SliceOrIndex; 0]
SliceArg
is the type which is used to specify slicing for this
dimension. Read moresource§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 1]>
impl Dimension for Dim<[Ix; 1]>
source§const 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 SliceArg = [SliceOrIndex; 1]
type SliceArg = [SliceOrIndex; 1]
SliceArg
is the type which is used to specify slicing for this
dimension. Read moresource§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 2]>
impl Dimension for Dim<[Ix; 2]>
source§const 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 SliceArg = [SliceOrIndex; 2]
type SliceArg = [SliceOrIndex; 2]
SliceArg
is the type which is used to specify slicing for this
dimension. Read moresource§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 3]>
impl Dimension for Dim<[Ix; 3]>
source§const 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 SliceArg = [SliceOrIndex; 3]
type SliceArg = [SliceOrIndex; 3]
SliceArg
is the type which is used to specify slicing for this
dimension. Read more§type Pattern = (usize, usize, usize)
type Pattern = (usize, usize, usize)
Pattern matching friendly form of the dimension value. Read more
source§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 4]>
impl Dimension for Dim<[Ix; 4]>
source§const 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 SliceArg = [SliceOrIndex; 4]
type SliceArg = [SliceOrIndex; 4]
SliceArg
is the type which is used to specify slicing for this
dimension. Read more§type Pattern = (usize, usize, usize, usize)
type Pattern = (usize, usize, usize, usize)
Pattern matching friendly form of the dimension value. Read more
source§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 5]>
impl Dimension for Dim<[Ix; 5]>
source§const 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 SliceArg = [SliceOrIndex; 5]
type SliceArg = [SliceOrIndex; 5]
SliceArg
is the type which is used to specify slicing for this
dimension. Read more§type Pattern = (usize, usize, usize, usize, usize)
type Pattern = (usize, usize, usize, usize, usize)
Pattern matching friendly form of the dimension value. Read more
source§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl Dimension for Dim<[Ix; 6]>
impl Dimension for Dim<[Ix; 6]>
source§const 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 SliceArg = [SliceOrIndex; 6]
type SliceArg = [SliceOrIndex; 6]
SliceArg
is the type which is used to specify slicing for this
dimension. Read more§type Pattern = (usize, usize, usize, usize, usize, usize)
type Pattern = (usize, usize, usize, usize, usize, usize)
Pattern matching friendly form of the dimension value. Read more
source§fn into_pattern(self) -> Self::Pattern
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
source§fn zeros(ndim: usize) -> Self
fn zeros(ndim: usize) -> Self
Creates a dimension of all zeros with the specified ndim. Read more
source§fn size_checked(&self) -> Option<usize>
fn size_checked(&self) -> Option<usize>
Compute the size while checking for overflow.
source§fn as_array_view(&self) -> ArrayView1<'_, Ix>
fn as_array_view(&self) -> ArrayView1<'_, Ix>
Borrow as a read-only array view.
source§fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
fn as_array_view_mut(&mut self) -> ArrayViewMut1<'_, Ix>
Borrow as a read-write array view.
source§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. Read more
source§impl<'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,
source§fn mul_assign(&mut self, rhs: &Self)
fn mul_assign(&mut self, rhs: &Self)
Performs the
*=
operation. Read moresource§impl<I> MulAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
impl<I> MulAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl<I> MulAssign<usize> for Dim<I>where
Dim<I>: Dimension,
impl<I> MulAssign<usize> for Dim<I>where
Dim<I>: Dimension,
source§fn mul_assign(&mut self, rhs: Ix)
fn mul_assign(&mut self, rhs: Ix)
Performs the
*=
operation. Read moresource§impl<I: PartialEq + ?Sized> PartialEq<Dim<I>> for Dim<I>
impl<I: PartialEq + ?Sized> PartialEq<Dim<I>> for Dim<I>
source§impl<I> PartialEq<I> for Dim<I>where
I: PartialEq + ?Sized,
impl<I> PartialEq<I> for Dim<I>where
I: PartialEq + ?Sized,
source§impl RemoveAxis for Dim<IxDynImpl>
impl RemoveAxis for Dim<IxDynImpl>
fn remove_axis(&self, axis: Axis) -> Self
source§impl<'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,
source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
Performs the
-=
operation. Read moresource§impl<I> SubAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
impl<I> SubAssign<Dim<I>> for Dim<I>where
Dim<I>: Dimension,
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moresource§impl SubAssign<usize> for Dim<[Ix; 1]>
impl SubAssign<usize> for Dim<[Ix; 1]>
source§fn sub_assign(&mut self, rhs: Ix)
fn sub_assign(&mut self, rhs: Ix)
Performs the
-=
operation. Read more