SymbolicSparseColMatRef

Type Alias SymbolicSparseColMatRef 

Source
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_ptrs has length ncols + 1 (always checked)

  • col_ptrs is increasing

  • col_ptrs[0]..col_ptrs[ncols] is a valid range in row_indices (always checked, assuming it’s increasing)

  • if nnz_per_col is none, elements of row_indices[col_ptrs[j]..col_ptrs[j + 1]] are less than nrows

  • nnz_per_col[j] <= col_ptrs[j+1] - col_ptrs[j]

  • if nnz_per_col is some(_), elements of row_indices[col_ptrs[j]..][..nnz_per_col[j]] are less than nrows

§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>

Source

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.

Source

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.

Source

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.

Source

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
Source

pub fn nrows(&self) -> Rows

returns the number of rows of the matrix

Source

pub fn ncols(&self) -> Cols

returns the number of columns of the matrix

Source

pub fn shape(&self) -> (Rows, Cols)

returns the number of rows and columns of the matrix

Source

pub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I, Cols, Rows>

returns a view over the transpose of self

Source

pub fn to_owned(&self) -> Result<SymbolicSparseColMat<I, Rows, Cols>, FaerError>

returns a newly allocated matrix holding the values of self

Source

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

Source

pub fn compute_nnz(&self) -> usize

returns the number of non-zero elements in the matrix

Source

pub fn col_ptr(&self) -> &'a [I]

returns the column pointers

Source

pub fn col_nnz(&self) -> Option<&'a [I]>

returns the column non-zero counts

Source

pub fn row_idx(&self) -> &'a [I]

returns the row indices

Source

pub fn col_range(&self, j: Idx<Cols>) -> Range<usize>

returns the range specifying the indices of column j

Source

pub unsafe fn col_range_unchecked(&self, j: Idx<Cols>) -> Range<usize>

returns the range specifying the indices of column j, without bound checks

Source

pub fn row_idx_of_col_raw(&self, j: Idx<Cols>) -> &'a [Idx<Rows, I>]

returns the row indices of column j

Source

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

Source

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

Source

pub fn as_dyn(self) -> SymbolicSparseColMatRef<'a, I>

returns the input matrix with dynamic shape

Source

pub fn as_ref(self) -> SymbolicSparseColMatRef<'a, I, Rows, Cols>

Returns a view over the symbolic structure of self.