SymbolicSparseRowMatRef

Type Alias SymbolicSparseRowMatRef 

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

  • row_ptrs is increasing

  • row_ptrs[0]..row_ptrs[nrows] is a valid range in row_indices (always checked, assuming increasing)

  • if nnz_per_row is none, elements of col_indices[row_ptrs[i]..row_ptrs[i + 1]] are less than ncols

  • nnz_per_row[i] <= row_ptrs[i+1] - row_ptrs[i]

  • if nnz_per_row is some(_), elements of col_indices[row_ptrs[i]..][..nnz_per_row[i]] are less than ncols

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

Source

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.

Source

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.

Source

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.

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
  • row pointers
  • row non-zero counts
  • column 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) -> SymbolicSparseColMatRef<'a, I, Cols, Rows>

returns a view over the transpose of self

Source

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

returns a newly allocated matrix holding the values of self

Source

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

Source

pub fn compute_nnz(&self) -> usize

returns the number of non-zero elements in the matrix

Source

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

returns the row pointers

Source

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

returns the row non-zero counts

Source

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

returns the column indices

Source

pub fn row_range(&self, i: Idx<Rows>) -> Range<usize>

returns the range specifying the indices of row i

Source

pub unsafe fn row_range_unchecked(&self, i: Idx<Rows>) -> Range<usize>

returns the range specifying the indices of row i, without bound checks

Source

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

returns the column indices of row i

Source

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

Source

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

Source

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

returns the input matrix with dynamic shape

Source

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

Returns a view over the symbolic structure of self.