pub struct ArrayView2<'a, T> { /* private fields */ }Expand description
Immutable 2D array view.
Implementations§
Source§impl<'a, T> ArrayView2<'a, T>
impl<'a, T> ArrayView2<'a, T>
Sourcepub fn new(
data: &'a [T],
shape: [usize; 2],
strides: [isize; 2],
offset: isize,
) -> Result<Self>
pub fn new( data: &'a [T], shape: [usize; 2], strides: [isize; 2], offset: isize, ) -> Result<Self>
Create a checked immutable view.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Distance in elements between consecutive rows.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Distance in elements between consecutive columns.
Sourcepub fn leading_dimension(&self) -> isize
pub fn leading_dimension(&self) -> isize
Leading dimension for the current row-major-style view.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Whether the view is compact row-major contiguous.
Sourcepub fn as_slice(&self) -> Option<&'a [T]>
pub fn as_slice(&self) -> Option<&'a [T]>
Borrow the backing slice if this view covers it contiguously.
Sourcepub fn get(&self, row: usize, col: usize) -> Option<&'a T>
pub fn get(&self, row: usize, col: usize) -> Option<&'a T>
Get a copied reference at (row, col).
Sourcepub fn row_slice(&self, row: usize) -> Result<Option<&'a [T]>>
pub fn row_slice(&self, row: usize) -> Result<Option<&'a [T]>>
Borrow a row as a contiguous slice when the row layout permits it.
Sourcepub fn rows_range(&self, start: usize, end: usize) -> Result<Self>
pub fn rows_range(&self, start: usize, end: usize) -> Result<Self>
Slice a half-open row range.
Sourcepub fn cols_range(&self, start: usize, end: usize) -> Result<Self>
pub fn cols_range(&self, start: usize, end: usize) -> Result<Self>
Slice a half-open column range.
Source§impl<T: Clone> ArrayView2<'_, T>
impl<T: Clone> ArrayView2<'_, T>
Sourcepub fn to_row_major(&self) -> Array2<T>
pub fn to_row_major(&self) -> Array2<T>
Copy this view into compact row-major storage.
Sourcepub fn to_col_major_vec(&self) -> Vec<T>
pub fn to_col_major_vec(&self) -> Vec<T>
Copy this view into a column-major vector.
Trait Implementations§
Source§impl<'a, T: Clone> Clone for ArrayView2<'a, T>
impl<'a, T: Clone> Clone for ArrayView2<'a, T>
Source§fn clone(&self) -> ArrayView2<'a, T>
fn clone(&self) -> ArrayView2<'a, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a, T: Debug> Debug for ArrayView2<'a, T>
impl<'a, T: Debug> Debug for ArrayView2<'a, T>
Source§impl<T: Float> LinearOperator<T> for ArrayView2<'_, T>
impl<T: Float> LinearOperator<T> for ArrayView2<'_, T>
Source§fn matmat(&self, x: ArrayView2<'_, T>, y: ArrayViewMut2<'_, T>) -> Result<()>
fn matmat(&self, x: ArrayView2<'_, T>, y: ArrayViewMut2<'_, T>) -> Result<()>
Compute
Y = A X.Source§fn t_matmat(&self, x: ArrayView2<'_, T>, y: ArrayViewMut2<'_, T>) -> Result<()>
fn t_matmat(&self, x: ArrayView2<'_, T>, y: ArrayViewMut2<'_, T>) -> Result<()>
Compute
Y = A^T X.impl<'a, T: Copy> Copy for ArrayView2<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for ArrayView2<'a, T>
impl<'a, T> RefUnwindSafe for ArrayView2<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for ArrayView2<'a, T>where
T: Sync,
impl<'a, T> Sync for ArrayView2<'a, T>where
T: Sync,
impl<'a, T> Unpin for ArrayView2<'a, T>
impl<'a, T> UnsafeUnpin for ArrayView2<'a, T>
impl<'a, T> UnwindSafe for ArrayView2<'a, T>where
T: RefUnwindSafe,
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> 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