pub type SymbolicSparseRowMatRef<'a, I, Rows = usize, Cols = usize> = SymbolicSparseRowMat<Ref<'a, I, Rows, Cols>>;Expand description
symbolic view structure of sparse matrix in row format, either compressed or uncompressed
§invariants
-
nrows <= I::Signed::MAX(always checked) -
ncols <= I::Signed::MAX(always checked) -
row_ptrshas lengthnrows + 1(always checked) -
row_ptrsis increasing -
row_ptrs[0]..row_ptrs[nrows]is a valid range in row_indices (always checked, assuming increasing) -
if
nnz_per_rowisnone, 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_rowissome(_), elements ofcol_indices[row_ptrs[i]..][..nnz_per_row[i]]are less thanncols
§soft invariants
- within each row, column indices are sorted in increasing 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
Aliased Type§
#[repr(transparent)]pub struct SymbolicSparseRowMatRef<'a, I, Rows = usize, Cols = usize>(pub Ref<'a, I, Rows, Cols>);Tuple Fields§
§0: Ref<'a, I, Rows, Cols>Implementations§
Source§impl<'a, Rows: Shape, Cols: Shape, I: Index> SymbolicSparseRowMatRef<'a, I, Rows, Cols>
impl<'a, Rows: Shape, Cols: Shape, I: Index> SymbolicSparseRowMatRef<'a, I, Rows, Cols>
Sourcepub unsafe fn new_unchecked(
nrows: Rows,
ncols: Cols,
row_ptr: &'a [I],
row_nnz: Option<&'a [I]>,
col_idx: &'a [I],
) -> Self
pub unsafe fn new_unchecked( nrows: Rows, ncols: Cols, row_ptr: &'a [I], row_nnz: Option<&'a [I]>, col_idx: &'a [I], ) -> Self
creates a new symbolic matrix view without checking its invariants
§safety
see type level documentation.
Sourcepub fn new_checked(
nrows: Rows,
ncols: Cols,
row_ptr: &'a [I],
row_nnz: Option<&'a [I]>,
col_idx: &'a [I],
) -> Self
pub fn new_checked( nrows: Rows, ncols: Cols, row_ptr: &'a [I], row_nnz: Option<&'a [I]>, col_idx: &'a [I], ) -> Self
creates a new symbolic matrix view after checking its invariants
§safety
see type level documentation.
Sourcepub fn new_unsorted_checked(
nrows: Rows,
ncols: Cols,
row_ptr: &'a [I],
row_nnz: Option<&'a [I]>,
col_idx: &'a [I],
) -> Self
pub fn new_unsorted_checked( nrows: Rows, ncols: Cols, row_ptr: &'a [I], row_nnz: Option<&'a [I]>, col_idx: &'a [I], ) -> Self
creates a new symbolic matrix view after checking its invariants (excluding soft invariants)
§safety
see type level documentation.
Sourcepub fn parts(self) -> (Rows, Cols, &'a [I], Option<&'a [I]>, &'a [I])
pub fn parts(self) -> (Rows, Cols, &'a [I], Option<&'a [I]>, &'a [I])
returns the components of the sparse matrix
- number of rows
- number of columns
- row pointers
- row non-zero counts
- column indices
Sourcepub fn shape(&self) -> (Rows, Cols)
pub fn shape(&self) -> (Rows, Cols)
returns the number of rows and columns of the matrix
Sourcepub fn transpose(self) -> SymbolicSparseColMatRef<'a, I, Cols, Rows>
pub fn transpose(self) -> SymbolicSparseColMatRef<'a, I, Cols, Rows>
returns a view over the transpose of self
Sourcepub fn to_owned(&self) -> Result<SymbolicSparseRowMat<I, Rows, Cols>, FaerError>
pub fn to_owned(&self) -> Result<SymbolicSparseRowMat<I, Rows, Cols>, FaerError>
returns a newly allocated matrix holding the values of self
Sourcepub fn to_col_major(
&self,
) -> Result<SymbolicSparseColMat<I, Rows, Cols>, FaerError>
pub fn to_col_major( &self, ) -> Result<SymbolicSparseColMat<I, Rows, Cols>, FaerError>
returns a newly allocated matrix holding the values of self in column major format
Sourcepub fn compute_nnz(&self) -> usize
pub fn compute_nnz(&self) -> usize
returns the number of non-zero elements in the matrix
Sourcepub fn row_range(&self, i: Idx<Rows>) -> Range<usize>
pub fn row_range(&self, i: Idx<Rows>) -> Range<usize>
returns the range specifying the indices of row i
Sourcepub unsafe fn row_range_unchecked(&self, i: Idx<Rows>) -> Range<usize>
pub unsafe fn row_range_unchecked(&self, i: Idx<Rows>) -> Range<usize>
returns the range specifying the indices of row i, without bound checks
Sourcepub fn col_idx_of_row_raw(&self, i: Idx<Rows>) -> &'a [Idx<Cols, I>] ⓘ
pub fn col_idx_of_row_raw(&self, i: Idx<Rows>) -> &'a [Idx<Cols, I>] ⓘ
returns the column indices of row i
Sourcepub fn col_idx_of_row(
&self,
i: Idx<Rows>,
) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Cols>>where
Rows: 'a,
Cols: 'a,
pub fn col_idx_of_row(
&self,
i: Idx<Rows>,
) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Cols>>where
Rows: 'a,
Cols: 'a,
returns the column indices of row i
Sourcepub fn as_shape<V: Shape, H: Shape>(
self,
nrows: V,
ncols: H,
) -> SymbolicSparseRowMatRef<'a, I, V, H>
pub fn as_shape<V: Shape, H: Shape>( self, nrows: V, ncols: H, ) -> SymbolicSparseRowMatRef<'a, I, V, H>
returns the input matrix with the given shape after checking that it matches the current shape
Sourcepub fn as_dyn(self) -> SymbolicSparseRowMatRef<'a, I>
pub fn as_dyn(self) -> SymbolicSparseRowMatRef<'a, I>
returns the input matrix with dynamic shape
Sourcepub fn as_ref(self) -> SymbolicSparseRowMatRef<'a, I, Rows, Cols>
pub fn as_ref(self) -> SymbolicSparseRowMatRef<'a, I, Rows, Cols>
Returns a view over the symbolic structure of self.