pub type RowRef<'a, T, Cols = usize, CStride = isize> = Row<Ref<'a, T, Cols, CStride>>;Expand description
immutable view over a row vector, similar to an immutable reference to a strided slice
§note
unlike a slice, the data pointed to by RowRef<'_, T> is allowed to be partially or fully
uninitialized under certain conditions. in this case, care must be taken to not perform any
operations that read the uninitialized values, or form references to them, either directly or
indirectly through any of the numerical library routines, unless it is explicitly permitted
Aliased Type§
#[repr(transparent)]pub struct RowRef<'a, T, Cols = usize, CStride = isize>(pub Ref<'a, T, Cols, CStride>);Tuple Fields§
§0: Ref<'a, T, Cols, CStride>Implementations§
Source§impl<'a, T, Cols: Shape, CStride: Stride> RowRef<'a, T, Cols, CStride>
impl<'a, T, Cols: Shape, CStride: Stride> RowRef<'a, T, Cols, CStride>
Sourcepub const unsafe fn from_raw_parts(
ptr: *const T,
ncols: Cols,
col_stride: CStride,
) -> Self
pub const unsafe fn from_raw_parts( ptr: *const T, ncols: Cols, col_stride: CStride, ) -> Self
creates a RowRef from pointers to the column vector data, number of rows, and row stride
§safety
this function has the same safety requirements as
[MatRef::from_raw_parts(ptr, 1, ncols, 0, col_stride)]
Sourcepub fn col_stride(&self) -> CStride
pub fn col_stride(&self) -> CStride
returns the column stride of the row
Sourcepub fn ptr_at(&self, col: IdxInc<Cols>) -> *const T
pub fn ptr_at(&self, col: IdxInc<Cols>) -> *const T
returns a raw pointer to the element at the given index
Sourcepub unsafe fn ptr_inbounds_at(&self, col: Idx<Cols>) -> *const T
pub unsafe fn ptr_inbounds_at(&self, col: Idx<Cols>) -> *const T
returns a raw pointer to the element at the given index, assuming the provided index is within the row bounds
§safety
the behavior is undefined if any of the following conditions are violated:
col < self.ncols()
Sourcepub fn split_at_col(
self,
col: IdxInc<Cols>,
) -> (RowRef<'a, T, usize, CStride>, RowRef<'a, T, usize, CStride>)
pub fn split_at_col( self, col: IdxInc<Cols>, ) -> (RowRef<'a, T, usize, CStride>, RowRef<'a, T, usize, CStride>)
splits the row vertically at the given column into two parts and returns an array of each subrow, in the following order:
- left
- right
§panics
the function panics if the following condition is violated:
col <= self.ncols()
Sourcepub fn transpose(self) -> ColRef<'a, T, Cols, CStride>
pub fn transpose(self) -> ColRef<'a, T, Cols, CStride>
returns a view over the transpose of self
Sourcepub fn conjugate(self) -> RowRef<'a, T::Conj, Cols, CStride>where
T: Conjugate,
pub fn conjugate(self) -> RowRef<'a, T::Conj, Cols, CStride>where
T: Conjugate,
returns a view over the conjugate of self
Sourcepub fn canonical(self) -> RowRef<'a, T::Canonical, Cols, CStride>where
T: Conjugate,
pub fn canonical(self) -> RowRef<'a, T::Canonical, Cols, CStride>where
T: Conjugate,
returns an unconjugated view over self
Sourcepub fn adjoint(self) -> ColRef<'a, T::Conj, Cols, CStride>where
T: Conjugate,
pub fn adjoint(self) -> ColRef<'a, T::Conj, Cols, CStride>where
T: Conjugate,
returns a view over the conjugate transpose of self
Sourcepub fn get<ColRange>(
self,
col: ColRange,
) -> <RowRef<'a, T, Cols, CStride> as RowIndex<ColRange>>::Target
pub fn get<ColRange>( self, col: ColRange, ) -> <RowRef<'a, T, Cols, CStride> as RowIndex<ColRange>>::Target
returns a reference to the element at the given index, or a subrow if
col is a range, with bound checks
§panics
the function panics if any of the following conditions are violated:
colmust be contained in[0, self.ncols())
Sourcepub unsafe fn get_unchecked<ColRange>(
self,
col: ColRange,
) -> <RowRef<'a, T, Cols, CStride> as RowIndex<ColRange>>::Target
pub unsafe fn get_unchecked<ColRange>( self, col: ColRange, ) -> <RowRef<'a, T, Cols, CStride> as RowIndex<ColRange>>::Target
returns a reference to the element at the given index, or a subrow if
col is a range, without bound checks
§panics
the behavior is undefined if any of the following conditions are violated:
colmust be contained in[0, self.ncols())
Sourcepub fn reverse_cols(self) -> RowRef<'a, T, Cols, CStride::Rev>
pub fn reverse_cols(self) -> RowRef<'a, T, Cols, CStride::Rev>
returns a view over the self, with the columns in reversed order
Sourcepub fn subcols<V: Shape>(
self,
col_start: IdxInc<Cols>,
ncols: V,
) -> RowRef<'a, T, V, CStride>
pub fn subcols<V: Shape>( self, col_start: IdxInc<Cols>, ncols: V, ) -> RowRef<'a, T, V, CStride>
returns a view over the subrow starting at column col_start, and with number of
columns ncols
§panics
the function panics if any of the following conditions are violated:
col_start <= self.ncols()ncols <= self.ncols() - col_start
Sourcepub fn as_col_shape<V: Shape>(self, ncols: V) -> RowRef<'a, T, V, CStride>
pub fn as_col_shape<V: Shape>(self, ncols: V) -> RowRef<'a, T, V, CStride>
returns the input row with the given column shape after checking that it matches the current column shape
Sourcepub fn as_dyn_cols(self) -> RowRef<'a, T, usize, CStride>
pub fn as_dyn_cols(self) -> RowRef<'a, T, usize, CStride>
returns the input row with dynamic column shape
Sourcepub fn as_dyn_stride(self) -> RowRef<'a, T, Cols, isize>
pub fn as_dyn_stride(self) -> RowRef<'a, T, Cols, isize>
returns the input row with dynamic stride
Sourcepub fn iter(
self,
) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = &'a T>where
Cols: 'a,
pub fn iter(
self,
) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = &'a T>where
Cols: 'a,
returns an iterator over the elements of the row
Sourcepub fn par_iter(self) -> impl 'a + IndexedParallelIterator<Item = &'a T>where
T: Sync,
Cols: 'a,
pub fn par_iter(self) -> impl 'a + IndexedParallelIterator<Item = &'a T>where
T: Sync,
Cols: 'a,
returns a parallel iterator over the elements of the row
Sourcepub fn par_partition(
self,
count: usize,
) -> impl 'a + IndexedParallelIterator<Item = RowRef<'a, T, usize, CStride>>where
T: Sync,
Cols: 'a,
pub fn par_partition(
self,
count: usize,
) -> impl 'a + IndexedParallelIterator<Item = RowRef<'a, T, usize, CStride>>where
T: Sync,
Cols: 'a,
returns a parallel iterator that provides exactly count successive chunks of the elements
of this row
only available with the rayon feature
Sourcepub fn try_as_row_major(self) -> Option<RowRef<'a, T, Cols, ContiguousFwd>>
pub fn try_as_row_major(self) -> Option<RowRef<'a, T, Cols, ContiguousFwd>>
returns a view over the row with a static column stride equal to +1, or None otherwise
Sourcepub fn as_mat(self) -> MatRef<'a, T, usize, Cols, isize, CStride>
pub fn as_mat(self) -> MatRef<'a, T, usize, Cols, isize, CStride>
returns a matrix view over self
Sourcepub fn as_diagonal(self) -> DiagRef<'a, T, Cols, CStride>
pub fn as_diagonal(self) -> DiagRef<'a, T, Cols, CStride>
interprets the row as a diagonal matrix
Source§impl<'a, T, Rows: Shape> RowRef<'a, T, Rows, ContiguousFwd>
impl<'a, T, Rows: Shape> RowRef<'a, T, Rows, ContiguousFwd>
Source§impl<'a, 'ROWS, T> RowRef<'a, T, Dim<'ROWS>, ContiguousFwd>
impl<'a, 'ROWS, T> RowRef<'a, T, Dim<'ROWS>, ContiguousFwd>
Trait Implementations§
Source§impl<'b, T, Len: Shape, Strd: Stride> MatIndex for RowRef<'b, T, Len, Strd>
impl<'b, T, Len: Shape, Strd: Stride> MatIndex for RowRef<'b, T, Len, Strd>
type Kind = Row
Source§type LayoutTransform = VecLayoutTransform
type LayoutTransform = VecLayoutTransform
type Slice = SliceRef<'b, T>
Source§unsafe fn get_slice_unchecked<'a>(
this: &'a mut Self,
idx: Self::Index,
n_elems: usize,
) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice
unsafe fn get_slice_unchecked<'a>( this: &'a mut Self, idx: Self::Index, n_elems: usize, ) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice
n_elems