pub struct SymbolicSparseRowMatRef<'a, I> { /* private fields */ }
Expand description
Symbolic view structure of sparse matrix in row format, either compressed or uncompressed.
Requires:
-
nrows <= I::Signed::MAX
(always checked) -
ncols <= I::Signed::MAX
(always checked) -
row_ptrs
has lengthnrows + 1
(always checked) -
row_ptrs
is non-decreasing -
row_ptrs[0]..row_ptrs[nrows]
is a valid range in row_indices (always checked, assuming non-decreasing) -
if
nnz_per_row
isNone
, elements ofcol_indices[row_ptrs[i]..row_ptrs[i + 1]]
are less thanncols
-
nnz_per_row[i] <= row_ptrs[i+1] - row_ptrs[i]
-
if
nnz_per_row
isSome(_)
, elements ofcol_indices[row_ptrs[i]..][..nnz_per_row[i]]
are less thanncols
-
Within each row, column indices are unique and sorted in increasing order.
§Note
Some algorithms allow working with matrices containing duplicate and/or unsorted column indicers per row.
Passing such a matrix to an algorithm that does not explicitly permit this is unspecified (though not undefined) behavior.
Implementations§
Source§impl<'a, I: Index> SymbolicSparseRowMatRef<'a, I>
impl<'a, I: Index> SymbolicSparseRowMatRef<'a, I>
Sourcepub fn new_checked(
nrows: usize,
ncols: usize,
row_ptrs: &'a [I],
nnz_per_row: Option<&'a [I]>,
col_indices: &'a [I],
) -> Self
pub fn new_checked( nrows: usize, ncols: usize, row_ptrs: &'a [I], nnz_per_row: Option<&'a [I]>, col_indices: &'a [I], ) -> Self
Creates a new symbolic matrix view after asserting its invariants.
§Panics
See type level documentation.
Sourcepub fn new_unsorted_checked(
nrows: usize,
ncols: usize,
row_ptrs: &'a [I],
nnz_per_row: Option<&'a [I]>,
col_indices: &'a [I],
) -> Self
pub fn new_unsorted_checked( nrows: usize, ncols: usize, row_ptrs: &'a [I], nnz_per_row: Option<&'a [I]>, col_indices: &'a [I], ) -> Self
Creates a new symbolic matrix view from data containing duplicate and/or unsorted column indices per row, after asserting its other invariants.
§Panics
See type level documentation.
Sourcepub unsafe fn new_unchecked(
nrows: usize,
ncols: usize,
row_ptrs: &'a [I],
nnz_per_row: Option<&'a [I]>,
col_indices: &'a [I],
) -> Self
pub unsafe fn new_unchecked( nrows: usize, ncols: usize, row_ptrs: &'a [I], nnz_per_row: Option<&'a [I]>, col_indices: &'a [I], ) -> Self
Creates a new symbolic matrix view without asserting its invariants.
§Safety
See type level documentation.
Sourcepub fn transpose(self) -> SymbolicSparseColMatRef<'a, I>
pub fn transpose(self) -> SymbolicSparseColMatRef<'a, I>
Returns a view over the transpose of self
in column-major format.
Sourcepub fn to_owned(&self) -> Result<SymbolicSparseRowMat<I>, FaerError>
pub fn to_owned(&self) -> Result<SymbolicSparseRowMat<I>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_col_major(&self) -> Result<SymbolicSparseColMat<I>, FaerError>
pub fn to_col_major(&self) -> Result<SymbolicSparseColMat<I>, FaerError>
Copies the current matrix into a newly allocated matrix, with column-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_row(&self) -> Option<&'a [I]>
pub fn nnz_per_row(&self) -> Option<&'a [I]>
Returns the count of non-zeros per column of the matrix.
Sourcepub fn col_indices(&self) -> &'a [I]
pub fn col_indices(&self) -> &'a [I]
Returns the column indices.
Sourcepub fn col_indices_of_row_raw(&self, i: usize) -> &'a [I]
pub fn col_indices_of_row_raw(&self, i: usize) -> &'a [I]
Sourcepub fn col_indices_of_row(
&self,
i: usize,
) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = usize>
pub fn col_indices_of_row( &self, i: usize, ) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = usize>
Trait Implementations§
Source§impl<I> Clone for SymbolicSparseRowMatRef<'_, I>
impl<I> Clone for SymbolicSparseRowMatRef<'_, I>
Source§impl<I: Index> Debug for SymbolicSparseRowMatRef<'_, I>
impl<I: Index> Debug for SymbolicSparseRowMatRef<'_, I>
impl<I> Copy for SymbolicSparseRowMatRef<'_, I>
Auto Trait Implementations§
impl<'a, I> Freeze for SymbolicSparseRowMatRef<'a, I>
impl<'a, I> RefUnwindSafe for SymbolicSparseRowMatRef<'a, I>where
I: RefUnwindSafe,
impl<'a, I> Send for SymbolicSparseRowMatRef<'a, I>where
I: Sync,
impl<'a, I> Sync for SymbolicSparseRowMatRef<'a, I>where
I: Sync,
impl<'a, I> Unpin for SymbolicSparseRowMatRef<'a, I>
impl<'a, I> UnwindSafe for SymbolicSparseRowMatRef<'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§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