pub struct Layout { /* private fields */ }
Implementations§
Source§impl Layout
impl Layout
pub fn new(shape: Shape, stride: Vec<usize>, start_offset: usize) -> Self
pub fn contiguous_with_offset<S: Into<Shape>>( shape: S, start_offset: usize, ) -> Self
pub fn contiguous<S: Into<Shape>>(shape: S) -> Self
pub fn dims(&self) -> &[usize]
Sourcepub fn dim<D: Dim>(&self, dim: D) -> Result<usize>
pub fn dim<D: Dim>(&self, dim: D) -> Result<usize>
The dimension size for a specified dimension index.
pub fn shape(&self) -> &Shape
pub fn stride(&self) -> &[usize]
pub fn start_offset(&self) -> usize
Sourcepub fn contiguous_offsets(&self) -> Option<(usize, usize)>
pub fn contiguous_offsets(&self) -> Option<(usize, usize)>
Returns the appropriate start and stop offset if the data is stored in a C contiguous (aka row major) way.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Returns true if the data is stored in a C contiguous (aka row major) way. Note that this does not implies that the start offset is 0 or that there are no extra elements at the end of the storage.
Sourcepub fn is_fortran_contiguous(&self) -> bool
pub fn is_fortran_contiguous(&self) -> bool
Returns true if the data is stored in a Fortran contiguous (aka column major) way.
pub fn narrow(&self, dim: usize, start: usize, len: usize) -> Result<Self>
pub fn transpose(&self, dim1: usize, dim2: usize) -> Result<Self>
pub fn permute(&self, idxs: &[usize]) -> Result<Self>
pub fn broadcast_as<S: Into<Shape>>(&self, shape: S) -> Result<Self>
Trait Implementations§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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