pub type ColRef<'a, T, Rows = usize, RStride = isize> = Col<Ref<'a, T, Rows, RStride>>;Expand description
immutable view over a column vector, similar to an immutable reference to a strided slice
§note
unlike a slice, the data pointed to by ColRef<'_, 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 ColRef<'a, T, Rows = usize, RStride = isize>(pub Ref<'a, T, Rows, RStride>);Tuple Fields§
§0: Ref<'a, T, Rows, RStride>Implementations§
Source§impl<'a, T, Rows: Shape, RStride: Stride> ColRef<'a, T, Rows, RStride>
impl<'a, T, Rows: Shape, RStride: Stride> ColRef<'a, T, Rows, RStride>
Sourcepub const unsafe fn from_raw_parts(
ptr: *const T,
nrows: Rows,
row_stride: RStride,
) -> Self
pub const unsafe fn from_raw_parts( ptr: *const T, nrows: Rows, row_stride: RStride, ) -> Self
creates a ColRef 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, nrows, 1, row_stride, 0)]
Sourcepub fn row_stride(&self) -> RStride
pub fn row_stride(&self) -> RStride
returns the row stride of the column, specified in number of elements, not in bytes
Sourcepub fn ptr_at(&self, row: IdxInc<Rows>) -> *const T
pub fn ptr_at(&self, row: IdxInc<Rows>) -> *const T
returns a raw pointer to the element at the given index
Sourcepub unsafe fn ptr_inbounds_at(&self, row: Idx<Rows>) -> *const T
pub unsafe fn ptr_inbounds_at(&self, row: Idx<Rows>) -> *const T
returns a raw pointer to the element at the given index, assuming the provided index is within the column bounds
§safety
the behavior is undefined if any of the following conditions are violated:
row < self.nrows()
Sourcepub fn split_at_row(
self,
row: IdxInc<Rows>,
) -> (ColRef<'a, T, usize, RStride>, ColRef<'a, T, usize, RStride>)
pub fn split_at_row( self, row: IdxInc<Rows>, ) -> (ColRef<'a, T, usize, RStride>, ColRef<'a, T, usize, RStride>)
splits the column horizontally at the given row into two parts and returns an array of each submatrix, in the following order:
- top
- bottom
§panics
the function panics if the following condition is violated:
row <= self.nrows()
Sourcepub fn transpose(self) -> RowRef<'a, T, Rows, RStride>
pub fn transpose(self) -> RowRef<'a, T, Rows, RStride>
returns a view over the transpose of self
Sourcepub fn conjugate(self) -> ColRef<'a, T::Conj, Rows, RStride>where
T: Conjugate,
pub fn conjugate(self) -> ColRef<'a, T::Conj, Rows, RStride>where
T: Conjugate,
returns a view over the conjugate of self
Sourcepub fn canonical(self) -> ColRef<'a, T::Canonical, Rows, RStride>where
T: Conjugate,
pub fn canonical(self) -> ColRef<'a, T::Canonical, Rows, RStride>where
T: Conjugate,
returns an unconjugated view over self
Sourcepub fn adjoint(self) -> RowRef<'a, T::Conj, Rows, RStride>where
T: Conjugate,
pub fn adjoint(self) -> RowRef<'a, T::Conj, Rows, RStride>where
T: Conjugate,
returns a view over the conjugate transpose of self
Sourcepub fn get<RowRange>(
self,
row: RowRange,
) -> <ColRef<'a, T, Rows, RStride> as ColIndex<RowRange>>::Target
pub fn get<RowRange>( self, row: RowRange, ) -> <ColRef<'a, T, Rows, RStride> as ColIndex<RowRange>>::Target
returns a reference to the element at the given index, or a subcolumn if row is a range
§panics
the function panics if any of the following conditions are violated:
rowmust be contained in[0, self.nrows())
Sourcepub unsafe fn get_unchecked<RowRange>(
self,
row: RowRange,
) -> <ColRef<'a, T, Rows, RStride> as ColIndex<RowRange>>::Target
pub unsafe fn get_unchecked<RowRange>( self, row: RowRange, ) -> <ColRef<'a, T, Rows, RStride> as ColIndex<RowRange>>::Target
returns a reference to the element at the given index, or a subcolumn if row is a range,
without bound checks
§safety
the behavior is undefined if any of the following conditions are violated:
rowmust be contained in[0, self.nrows())
Sourcepub fn reverse_rows(self) -> ColRef<'a, T, Rows, RStride::Rev>
pub fn reverse_rows(self) -> ColRef<'a, T, Rows, RStride::Rev>
returns a view over the self, with the rows in reversed order
Sourcepub fn subrows<V: Shape>(
self,
row_start: IdxInc<Rows>,
nrows: V,
) -> ColRef<'a, T, V, RStride>
pub fn subrows<V: Shape>( self, row_start: IdxInc<Rows>, nrows: V, ) -> ColRef<'a, T, V, RStride>
returns a view over the column starting at row row_start, and with number of rows
nrows
§panics
the function panics if any of the following conditions are violated:
row_start <= self.nrows()nrows <= self.nrows() - row_start
Sourcepub fn as_row_shape<V: Shape>(self, nrows: V) -> ColRef<'a, T, V, RStride>
pub fn as_row_shape<V: Shape>(self, nrows: V) -> ColRef<'a, T, V, RStride>
returns the input column with the given row shape after checking that it matches the current row shape
Sourcepub fn as_dyn_rows(self) -> ColRef<'a, T, usize, RStride>
pub fn as_dyn_rows(self) -> ColRef<'a, T, usize, RStride>
returns the input column with dynamic row shape
Sourcepub fn as_dyn_stride(self) -> ColRef<'a, T, Rows, isize>
pub fn as_dyn_stride(self) -> ColRef<'a, T, Rows, isize>
returns the input column with dynamic stride
Sourcepub fn iter(
self,
) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = &'a T>where
Rows: 'a,
pub fn iter(
self,
) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = &'a T>where
Rows: 'a,
returns an iterator over the elements of the column
Sourcepub fn par_iter(self) -> impl 'a + IndexedParallelIterator<Item = &'a T>where
T: Sync,
Rows: 'a,
pub fn par_iter(self) -> impl 'a + IndexedParallelIterator<Item = &'a T>where
T: Sync,
Rows: 'a,
returns a parallel iterator over the elements of the column
Sourcepub fn par_partition(
self,
count: usize,
) -> impl 'a + IndexedParallelIterator<Item = ColRef<'a, T, usize, RStride>>where
T: Sync,
Rows: 'a,
pub fn par_partition(
self,
count: usize,
) -> impl 'a + IndexedParallelIterator<Item = ColRef<'a, T, usize, RStride>>where
T: Sync,
Rows: 'a,
returns a parallel iterator that provides exactly count successive chunks of the elements
of this column
only available with the rayon feature
Sourcepub fn try_as_col_major(self) -> Option<ColRef<'a, T, Rows, ContiguousFwd>>
pub fn try_as_col_major(self) -> Option<ColRef<'a, T, Rows, ContiguousFwd>>
returns a view over the column with a static row stride equal to +1, or None otherwise
Sourcepub fn as_mat(self) -> MatRef<'a, T, Rows, usize, RStride, isize>
pub fn as_mat(self) -> MatRef<'a, T, Rows, usize, RStride, isize>
returns a matrix view over self
Sourcepub fn as_diagonal(self) -> DiagRef<'a, T, Rows, RStride>
pub fn as_diagonal(self) -> DiagRef<'a, T, Rows, RStride>
interprets the column as a diagonal matrix
Source§impl<'a, T, Rows: Shape> ColRef<'a, T, Rows, ContiguousFwd>
impl<'a, T, Rows: Shape> ColRef<'a, T, Rows, ContiguousFwd>
Source§impl<'a, 'ROWS, T> ColRef<'a, T, Dim<'ROWS>, ContiguousFwd>
impl<'a, 'ROWS, T> ColRef<'a, T, Dim<'ROWS>, ContiguousFwd>
Trait Implementations§
Source§impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColRef<'a, T, Dim<'N>, Rs>
impl<'a, 'N, T, Rs: Stride> ColIndex<<Dim<'N> as ShapeIdx>::Idx<usize>> for ColRef<'a, T, Dim<'N>, Rs>
Source§impl<'a, T, Rs: Stride> ColIndex<<usize as ShapeIdx>::Idx<usize>> for ColRef<'a, T, usize, Rs>
impl<'a, T, Rs: Stride> ColIndex<<usize as ShapeIdx>::Idx<usize>> for ColRef<'a, T, usize, Rs>
Source§impl<'a, R: Shape, T, Rs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> ColIndex<RowRange> for ColRef<'a, T, R, Rs>
impl<'a, R: Shape, T, Rs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> ColIndex<RowRange> for ColRef<'a, T, R, Rs>
Source§impl<'b, T, Len: Shape, Strd: Stride> MatIndex for ColRef<'b, T, Len, Strd>
impl<'b, T, Len: Shape, Strd: Stride> MatIndex for ColRef<'b, T, Len, Strd>
type Kind = Col
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