pub struct Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,{ /* private fields */ }Expand description
Immutable view on a matrix that stores elements of type T.
Note that a Submatrix never owns the data, but always behaves like
a reference. In particular, this means that Submatrix is Copy,
unconditionally. The equivalent to a mutable reference is given by
SubmatrixMut.
This view is designed to work with various underlying representations
of the matrix, as described by AsPointerToSlice.
Implementations§
Source§impl<'a, V, T> Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,
 
impl<'a, V, T> Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,
Sourcepub fn submatrix(self, rows: Range<usize>, cols: Range<usize>) -> Self
 
pub fn submatrix(self, rows: Range<usize>, cols: Range<usize>) -> Self
Returns the submatrix that references only the entries whose row resp. column indices are within the given ranges.
Sourcepub fn restrict_rows(self, rows: Range<usize>) -> Self
 
pub fn restrict_rows(self, rows: Range<usize>) -> Self
Returns the submatrix that references only the entries whose row indices are within the given range.
Sourcepub fn into_at(self, i: usize, j: usize) -> &'a T
 
pub fn into_at(self, i: usize, j: usize) -> &'a T
Consumes the submatrix and produces a reference to its (i, j)-th entry.
In most cases, you will use Submatrix::at() instead, but in rare occasions,
into_at() might be necessary to provide a reference whose lifetime is not
coupled to the lifetime of the submatrix object.
Sourcepub fn at<'b>(&'b self, i: usize, j: usize) -> &'b T
 
pub fn at<'b>(&'b self, i: usize, j: usize) -> &'b T
Returns a reference to the (i, j)-th entry of this matrix.
Sourcepub fn restrict_cols(self, cols: Range<usize>) -> Self
 
pub fn restrict_cols(self, cols: Range<usize>) -> Self
Returns the submatrix that references only the entries whose column indices are within the given range.
Sourcepub fn row_iter(self) -> impl 'a + Clone + ExactSizeIterator<Item = &'a [T]>
 
pub fn row_iter(self) -> impl 'a + Clone + ExactSizeIterator<Item = &'a [T]>
Returns an iterator over all rows of the matrix.
Sourcepub fn col_iter(
    self,
) -> impl 'a + Clone + ExactSizeIterator<Item = Column<'a, V, T>>
 
pub fn col_iter( self, ) -> impl 'a + Clone + ExactSizeIterator<Item = Column<'a, V, T>>
Returns an iterator over all columns of the matrix.
Sourcepub fn into_row_at(self, i: usize) -> &'a [T]
 
pub fn into_row_at(self, i: usize) -> &'a [T]
Consumes the submatrix and produces a reference to its i-th row.
In most cases, you will use Submatrix::row_at() instead, but in rare occasions,
into_row_at() might be necessary to provide a reference whose lifetime is not
coupled to the lifetime of the submatrix object.
Sourcepub fn row_at<'b>(&'b self, i: usize) -> &'b [T]
 
pub fn row_at<'b>(&'b self, i: usize) -> &'b [T]
Returns a view on the i-th row of this matrix.
Sourcepub fn into_col_at(self, j: usize) -> Column<'a, V, T>
 
pub fn into_col_at(self, j: usize) -> Column<'a, V, T>
Consumes the submatrix and produces a reference to its j-th column.
In most cases, you will use Submatrix::col_at() instead, but in rare occasions,
into_col_at() might be necessary to provide a reference whose lifetime is not
coupled to the lifetime of the submatrix object.
Source§impl<'a, T> Submatrix<'a, AsFirstElement<T>, T>
 
impl<'a, T> Submatrix<'a, AsFirstElement<T>, T>
Sourcepub fn from_1d(data: &'a [T], row_count: usize, col_count: usize) -> Self
 
pub fn from_1d(data: &'a [T], row_count: usize, col_count: usize) -> Self
Creates a view on the given data slice, interpreting it as a matrix of given shape.
Assumes row-major order, i.e. contigous subslices of data will be the rows of the
resulting matrix.
pub fn from_ndarray<S>(data: &'a ArrayBase<S, Ix2>) -> Selfwhere
    S: DataMut<Elem = T>,
ndarray only.Trait Implementations§
Source§impl<'a, V, T> Clone for Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,
 
impl<'a, V, T> Clone for Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,
Source§impl<'a, V: AsPointerToSlice<T>, T> From<Submatrix<'a, V, T>> for TransposableSubmatrix<'a, V, T, false>
 
impl<'a, V: AsPointerToSlice<T>, T> From<Submatrix<'a, V, T>> for TransposableSubmatrix<'a, V, T, false>
Source§impl<'a, V: AsPointerToSlice<T>, T> MatrixCompare<T> for Submatrix<'a, V, T>
 
impl<'a, V: AsPointerToSlice<T>, T> MatrixCompare<T> for Submatrix<'a, V, T>
impl<'a, V, T> Copy for Submatrix<'a, V, T>where
    V: 'a + AsPointerToSlice<T>,
Auto Trait Implementations§
impl<'a, V, T> Freeze for Submatrix<'a, V, T>
impl<'a, V, T> RefUnwindSafe for Submatrix<'a, V, T>where
    T: RefUnwindSafe,
    V: RefUnwindSafe,
impl<'a, V, T> Send for Submatrix<'a, V, T>
impl<'a, V, T> Sync for Submatrix<'a, V, T>
impl<'a, V, T> Unpin for Submatrix<'a, V, T>
impl<'a, V, T> UnwindSafe for Submatrix<'a, V, T>where
    T: RefUnwindSafe,
    V: 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
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>
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>
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