Struct extendr_api::prelude::sparse::SymbolicSparseColMatRef
source · pub struct SymbolicSparseColMatRef<'a, I>where
I: Index,{ /* private fields */ }Expand description
Symbolic view structure of sparse matrix in column format, either compressed or uncompressed.
Requires:
-
nrows <= I::Signed::MAX(always checked) -
ncols <= I::Signed::MAX(always checked) -
col_ptrshas lengthncols + 1(always checked) -
col_ptrsis non-decreasing -
col_ptrs[0]..col_ptrs[ncols]is a valid range in row_indices (always checked, assuming non-decreasing) -
if
nnz_per_colisNone, elements ofrow_indices[col_ptrs[j]..col_ptrs[j + 1]]are less thannrows -
nnz_per_col[j] <= col_ptrs[j+1] - col_ptrs[j] -
if
nnz_per_colisSome(_), elements ofrow_indices[col_ptrs[j]..][..nnz_per_col[j]]are less thannrows -
Within each column, row indices are sorted in non-decreasing order.
§Note
Some algorithms allow working with matrices containing unsorted row indices per column.
Passing such a matrix to an algorithm that does not explicitly permit this is unspecified (though not undefined) behavior.
Implementations§
source§impl<'a, I> SymbolicSparseColMatRef<'a, I>where
I: Index,
impl<'a, I> SymbolicSparseColMatRef<'a, I>where
I: Index,
sourcepub fn new_checked(
nrows: usize,
ncols: usize,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> SymbolicSparseColMatRef<'a, I>
pub fn new_checked( nrows: usize, ncols: usize, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_indices: &'a [I], ) -> SymbolicSparseColMatRef<'a, I>
Creates a new symbolic matrix view after asserting its invariants.
§Panics
See type level documentation.
sourcepub fn new_unsorted_checked(
nrows: usize,
ncols: usize,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> SymbolicSparseColMatRef<'a, I>
pub fn new_unsorted_checked( nrows: usize, ncols: usize, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_indices: &'a [I], ) -> SymbolicSparseColMatRef<'a, I>
Creates a new symbolic matrix view from data containing duplicate and/or unsorted row indices per column, after asserting its other invariants.
§Panics
See type level documentation.
sourcepub unsafe fn new_unchecked(
nrows: usize,
ncols: usize,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> SymbolicSparseColMatRef<'a, I>
pub unsafe fn new_unchecked( nrows: usize, ncols: usize, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_indices: &'a [I], ) -> SymbolicSparseColMatRef<'a, I>
Creates a new symbolic matrix view without asserting its invariants.
§Safety
See type level documentation.
sourcepub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I>
pub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I>
Returns a view over the transpose of self in row-major format.
sourcepub fn to_owned(&self) -> Result<SymbolicSparseColMat<I>, FaerError>
pub fn to_owned(&self) -> Result<SymbolicSparseColMat<I>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
sourcepub fn to_row_major(&self) -> Result<SymbolicSparseRowMat<I>, FaerError>
pub fn to_row_major(&self) -> Result<SymbolicSparseRowMat<I>, FaerError>
Copies the current matrix into a newly allocated matrix, with row-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
sourcepub fn compute_nnz(&self) -> usize
pub fn compute_nnz(&self) -> usize
Returns the number of symbolic non-zeros in the matrix.
The value is guaranteed to be less than I::Signed::MAX.
§Note
Allows unsorted matrices, but the output is a count of all the entries, including the duplicate ones.
sourcepub fn nnz_per_col(&self) -> Option<&'a [I]>
pub fn nnz_per_col(&self) -> Option<&'a [I]>
Returns the count of non-zeros per column of the matrix.
sourcepub fn row_indices(&self) -> &'a [I]
pub fn row_indices(&self) -> &'a [I]
Returns the row indices.
sourcepub fn row_indices_of_col_raw(&self, j: usize) -> &'a [I]
pub fn row_indices_of_col_raw(&self, j: usize) -> &'a [I]
sourcepub fn row_indices_of_col(
&self,
j: usize,
) -> impl ExactSizeIterator + DoubleEndedIterator + 'a
pub fn row_indices_of_col( &self, j: usize, ) -> impl ExactSizeIterator + DoubleEndedIterator + 'a
Trait Implementations§
source§impl<I> Clone for SymbolicSparseColMatRef<'_, I>where
I: Index,
impl<I> Clone for SymbolicSparseColMatRef<'_, I>where
I: Index,
source§fn clone(&self) -> SymbolicSparseColMatRef<'_, I>
fn clone(&self) -> SymbolicSparseColMatRef<'_, I>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<I> Debug for SymbolicSparseColMatRef<'_, I>where
I: Index,
impl<I> Debug for SymbolicSparseColMatRef<'_, I>where
I: Index,
source§impl<'a, I> IntoConst for SymbolicSparseColMatRef<'a, I>where
I: Index,
impl<'a, I> IntoConst for SymbolicSparseColMatRef<'a, I>where
I: Index,
type Target = SymbolicSparseColMatRef<'a, I>
fn into_const(self) -> <SymbolicSparseColMatRef<'a, I> as IntoConst>::Target
source§impl<'short, I> Reborrow<'short> for SymbolicSparseColMatRef<'_, I>where
I: Index,
impl<'short, I> Reborrow<'short> for SymbolicSparseColMatRef<'_, I>where
I: Index,
type Target = SymbolicSparseColMatRef<'short, I>
fn rb(&self) -> <SymbolicSparseColMatRef<'_, I> as Reborrow<'short>>::Target
source§impl<'short, I> ReborrowMut<'short> for SymbolicSparseColMatRef<'_, I>where
I: Index,
impl<'short, I> ReborrowMut<'short> for SymbolicSparseColMatRef<'_, I>where
I: Index,
type Target = SymbolicSparseColMatRef<'short, I>
fn rb_mut( &mut self, ) -> <SymbolicSparseColMatRef<'_, I> as ReborrowMut<'short>>::Target
impl<I> Copy for SymbolicSparseColMatRef<'_, I>where
I: Index,
Auto Trait Implementations§
impl<'a, I> Freeze for SymbolicSparseColMatRef<'a, I>
impl<'a, I> RefUnwindSafe for SymbolicSparseColMatRef<'a, I>where
I: RefUnwindSafe,
impl<'a, I> Send for SymbolicSparseColMatRef<'a, I>
impl<'a, I> Sync for SymbolicSparseColMatRef<'a, I>
impl<'a, I> Unpin for SymbolicSparseColMatRef<'a, I>
impl<'a, I> UnwindSafe for SymbolicSparseColMatRef<'a, I>where
I: 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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