Struct ndarray::Dim
[−]
[src]
pub struct Dim<I: ?Sized> { /* fields omitted */ }
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]));
Trait Implementations
impl Index<usize> for Dim<[Ix; 0]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 0]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 0]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 1]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 1]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 1]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 2]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 2]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 2]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 3]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 3]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 3]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 4]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 4]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 4]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 5]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 5]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 5]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl Index<usize> for Dim<[Ix; 6]>
[src]
type Output = usize
The returned type after indexing
fn index(&self, index: usize) -> &Self::Output
The method for the indexing (container[index]
) operation
impl IndexMut<usize> for Dim<[Ix; 6]>
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation
impl Zero for Dim<[Ix; 6]>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl<I: Copy + ?Sized> Copy for Dim<I>
[src]
impl<I: Clone + ?Sized> Clone for Dim<I>
[src]
fn clone(&self) -> Dim<I>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<I: PartialEq + ?Sized> PartialEq for Dim<I>
[src]
fn eq(&self, __arg_0: &Dim<I>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Dim<I>) -> bool
This method tests for !=
.
impl<I: Eq + ?Sized> Eq for Dim<I>
[src]
impl<I: Default + ?Sized> Default for Dim<I>
[src]
impl<I: ?Sized> PartialEq<I> for Dim<I> where I: PartialEq
[src]
fn eq(&self, rhs: &I) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<I> Debug for Dim<I> where I: Debug
[src]
impl<I> Add for Dim<I> where Dim<I>: Dimension
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Self
The method for the +
operator
impl<I> AddAssign for Dim<I> where Dim<I>: Dimension
[src]
fn add_assign(&mut self, rhs: Self)
The method for the +=
operator
impl<'a, I> AddAssign<&'a Dim<I>> for Dim<I> where Dim<I>: Dimension
[src]
fn add_assign(&mut self, rhs: &Self)
The method for the +=
operator
impl Add<Ix> for Dim<[Ix; 1]>
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Ix) -> Self
The method for the +
operator
impl AddAssign<Ix> for Dim<[Ix; 1]>
[src]
fn add_assign(&mut self, rhs: Ix)
The method for the +=
operator
impl<I> Sub for Dim<I> where Dim<I>: Dimension
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Self
The method for the -
operator
impl<I> SubAssign for Dim<I> where Dim<I>: Dimension
[src]
fn sub_assign(&mut self, rhs: Self)
The method for the -=
operator
impl<'a, I> SubAssign<&'a Dim<I>> for Dim<I> where Dim<I>: Dimension
[src]
fn sub_assign(&mut self, rhs: &Self)
The method for the -=
operator
impl Sub<Ix> for Dim<[Ix; 1]>
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Ix) -> Self
The method for the -
operator
impl SubAssign<Ix> for Dim<[Ix; 1]>
[src]
fn sub_assign(&mut self, rhs: Ix)
The method for the -=
operator
impl<I> Mul for Dim<I> where Dim<I>: Dimension
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Self
The method for the *
operator
impl<I> MulAssign for Dim<I> where Dim<I>: Dimension
[src]
fn mul_assign(&mut self, rhs: Self)
The method for the *=
operator
impl<'a, I> MulAssign<&'a Dim<I>> for Dim<I> where Dim<I>: Dimension
[src]
fn mul_assign(&mut self, rhs: &Self)
The method for the *=
operator
impl<I> Mul<Ix> for Dim<I> where Dim<I>: Dimension
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Ix) -> Self
The method for the *
operator
impl<I> MulAssign<Ix> for Dim<I> where Dim<I>: Dimension
[src]
fn mul_assign(&mut self, rhs: Ix)
The method for the *=
operator
impl Dimension for Dim<[Ix; 0]>
[src]
type SliceArg = [Si; 0]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = ()
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
fn _fastest_varying_stride_order(&self) -> Self
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn next_for(&self, _index: Self) -> Option<Self>
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.
impl Dimension for Dim<[Ix; 1]>
[src]
type SliceArg = [Si; 1]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = Ix
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn next_for(&self, index: Self) -> Option<Self>
fn equal(&self, rhs: &Self) -> bool
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 default_strides(&self) -> Self
fn _fastest_varying_stride_order(&self) -> Self
fn first_index(&self) -> Option<Self>
fn stride_offset(index: &Self, stride: &Self) -> isize
fn stride_offset_checked(&self, stride: &Self, index: &Self) -> Option<isize>
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.
impl Dimension for Dim<[Ix; 2]>
[src]
type SliceArg = [Si; 2]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = (Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
fn next_for(&self, index: Self) -> Option<Self>
fn equal(&self, rhs: &Self) -> bool
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 last_elem(&self) -> usize
fn set_last_elem(&mut self, i: usize)
fn default_strides(&self) -> Self
fn fortran_strides(&self) -> Self
fn _fastest_varying_stride_order(&self) -> Self
fn is_contiguous(dim: &Self, strides: &Self) -> bool
fn first_index(&self) -> Option<Self>
fn stride_offset(index: &Self, strides: &Self) -> isize
fn stride_offset_checked(&self, strides: &Self, index: &Self) -> Option<isize>
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.
impl Dimension for Dim<[Ix; 3]>
[src]
type SliceArg = [Si; 3]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = (Ix, Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
fn size(&self) -> usize
Compute the size of the dimension (number of elements)
fn next_for(&self, index: Self) -> Option<Self>
fn stride_offset(index: &Self, strides: &Self) -> isize
fn _fastest_varying_stride_order(&self) -> Self
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.
impl Dimension for Dim<[Ix; 4]>
[src]
type SliceArg = [Si; 4]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = (Ix, Ix, Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
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.
impl Dimension for Dim<[Ix; 5]>
[src]
type SliceArg = [Si; 5]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = (Ix, Ix, Ix, Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
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.
impl Dimension for Dim<[Ix; 6]>
[src]
type SliceArg = [Si; 6]
SliceArg
is the type which is used to specify slicing for this dimension. Read more
type Pattern = (Ix, Ix, Ix, Ix, Ix, Ix)
Pattern matching friendly form of the dimension value. Read more
fn ndim(&self) -> usize
fn into_pattern(self) -> Self::Pattern
Convert the dimension into a pattern matching friendly value.
fn slice(&self) -> &[Ix]
fn slice_mut(&mut self) -> &mut [Ix]
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.
impl<J> Index<J> for Dim<Vec<usize>> where Vec<usize>: Index<J>
[src]
type Output = Vec<usize>::Output
The returned type after indexing
fn index(&self, index: J) -> &Self::Output
The method for the indexing (container[index]
) operation
impl<J> IndexMut<J> for Dim<Vec<usize>> where Vec<usize>: IndexMut<J>
[src]
fn index_mut(&mut self, index: J) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation