pub type SymbolicSparseColMatRef<'a, I, Rows = usize, Cols = usize> = SymbolicSparseColMat<Ref<'a, I, Rows, Cols>>;Expand description
symbolic view structure of sparse matrix in column format, either compressed or uncompressed
§invariants
-
nrows <= I::Signed::MAX(always checked) -
ncols <= I::Signed::MAX(always checked) -
col_ptrshas lengthncols + 1(always checked) -
col_ptrsis increasing -
col_ptrs[0]..col_ptrs[ncols]is a valid range in row_indices (always checked, assuming it’s increasing) -
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
§soft invariants
- within each column, row 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 SymbolicSparseColMatRef<'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> SymbolicSparseColMatRef<'a, I, Rows, Cols>
impl<'a, Rows: Shape, Cols: Shape, I: Index> SymbolicSparseColMatRef<'a, I, Rows, Cols>
Sourcepub unsafe fn new_unchecked(
nrows: Rows,
ncols: Cols,
col_ptr: &'a [I],
col_nnz: Option<&'a [I]>,
row_idx: &'a [I],
) -> Self
pub unsafe fn new_unchecked( nrows: Rows, ncols: Cols, col_ptr: &'a [I], col_nnz: Option<&'a [I]>, row_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,
col_ptr: &'a [I],
col_nnz: Option<&'a [I]>,
row_idx: &'a [I],
) -> Self
pub fn new_checked( nrows: Rows, ncols: Cols, col_ptr: &'a [I], col_nnz: Option<&'a [I]>, row_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,
col_ptr: &'a [I],
col_nnz: Option<&'a [I]>,
row_idx: &'a [I],
) -> Self
pub fn new_unsorted_checked( nrows: Rows, ncols: Cols, col_ptr: &'a [I], col_nnz: Option<&'a [I]>, row_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
- column pointers
- column non-zero counts
- row 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) -> SymbolicSparseRowMatRef<'a, I, Cols, Rows>
pub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I, Cols, Rows>
returns a view over the transpose of self
Sourcepub fn to_owned(&self) -> Result<SymbolicSparseColMat<I, Rows, Cols>, FaerError>
pub fn to_owned(&self) -> Result<SymbolicSparseColMat<I, Rows, Cols>, FaerError>
returns a newly allocated matrix holding the values of self
Sourcepub fn to_row_major(
&self,
) -> Result<SymbolicSparseRowMat<I, Rows, Cols>, FaerError>
pub fn to_row_major( &self, ) -> Result<SymbolicSparseRowMat<I, Rows, Cols>, FaerError>
returns a newly allocated matrix holding the values of self in row 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 col_range(&self, j: Idx<Cols>) -> Range<usize>
pub fn col_range(&self, j: Idx<Cols>) -> Range<usize>
returns the range specifying the indices of column j
Sourcepub unsafe fn col_range_unchecked(&self, j: Idx<Cols>) -> Range<usize>
pub unsafe fn col_range_unchecked(&self, j: Idx<Cols>) -> Range<usize>
returns the range specifying the indices of column j, without bound checks
Sourcepub fn row_idx_of_col_raw(&self, j: Idx<Cols>) -> &'a [Idx<Rows, I>] ⓘ
pub fn row_idx_of_col_raw(&self, j: Idx<Cols>) -> &'a [Idx<Rows, I>] ⓘ
returns the row indices of column j
Sourcepub fn row_idx_of_col(
&self,
j: Idx<Cols>,
) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Rows>>where
Rows: 'a,
Cols: 'a,
pub fn row_idx_of_col(
&self,
j: Idx<Cols>,
) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<Rows>>where
Rows: 'a,
Cols: 'a,
returns the row indices of column j
Sourcepub fn as_shape<V: Shape, H: Shape>(
self,
nrows: V,
ncols: H,
) -> SymbolicSparseColMatRef<'a, I, V, H>
pub fn as_shape<V: Shape, H: Shape>( self, nrows: V, ncols: H, ) -> SymbolicSparseColMatRef<'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) -> SymbolicSparseColMatRef<'a, I>
pub fn as_dyn(self) -> SymbolicSparseColMatRef<'a, I>
returns the input matrix with dynamic shape
Sourcepub fn as_ref(self) -> SymbolicSparseColMatRef<'a, I, Rows, Cols>
pub fn as_ref(self) -> SymbolicSparseColMatRef<'a, I, Rows, Cols>
Returns a view over the symbolic structure of self.