pub struct Shape(/* private fields */);Implementations§
Source§impl Shape
impl Shape
pub fn num_elements(&self) -> usize
pub fn from_dims(dims: &[usize]) -> Shape
Sourcepub fn rank(&self) -> usize
pub fn rank(&self) -> usize
The rank is the number of dimensions, 0 for a scalar value, 1 for a vector, etc.
pub fn into_dims(self) -> Vec<usize>
Sourcepub fn elem_count(&self) -> usize
pub fn elem_count(&self) -> usize
The total number of elements, this is the product of all dimension sizes.
Sourcepub fn stride_contiguous(&self) -> Vec<usize>
pub fn stride_contiguous(&self) -> Vec<usize>
The strides given in number of elements for a contiguous n-dimensional arrays using this shape.
Sourcepub fn is_contiguous(&self, stride: &[usize]) -> bool
pub fn is_contiguous(&self, stride: &[usize]) -> bool
Returns true if the strides are C contiguous (aka row major).
Sourcepub fn is_fortran_contiguous(&self, stride: &[usize]) -> bool
pub fn is_fortran_contiguous(&self, stride: &[usize]) -> bool
Returns true if the strides are Fortran contiguous (aka column major).
Trait Implementations§
Source§impl Ord for Shape
impl Ord for Shape
Source§impl PartialOrd for Shape
impl PartialOrd for Shape
impl Eq for Shape
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more