pub struct SymbolicSparseColMatRef<'a, I: Index, R: Shape = usize, C: Shape = usize> { /* private fields */ }Expand description
Symbolic view structure of sparse matrix in column format, either compressed or uncompressed.
Requires:
-
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 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 -
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.
Implementations§
Source§impl<'a, I: Index, R: Shape, C: Shape> SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I: Index, R: Shape, C: Shape> SymbolicSparseColMatRef<'a, I, R, C>
Sourcepub fn new_checked(
nrows: R,
ncols: C,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> Self
pub fn new_checked( nrows: R, ncols: C, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_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: R,
ncols: C,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> Self
pub fn new_unsorted_checked( nrows: R, ncols: C, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_indices: &'a [I], ) -> Self
Creates a new symbolic matrix view from data containing duplicate and/or unsorted row indices per column, after asserting its other invariants.
§Panics
See type level documentation.
Sourcepub unsafe fn new_unchecked(
nrows: R,
ncols: C,
col_ptrs: &'a [I],
nnz_per_col: Option<&'a [I]>,
row_indices: &'a [I],
) -> Self
pub unsafe fn new_unchecked( nrows: R, ncols: C, col_ptrs: &'a [I], nnz_per_col: Option<&'a [I]>, row_indices: &'a [I], ) -> Self
Creates a new symbolic matrix view without asserting its invariants.
§Safety
See type level documentation.
Sourcepub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I, C, R>
pub fn transpose(self) -> SymbolicSparseRowMatRef<'a, I, C, R>
Returns a view over the transpose of self in row-major format.
Sourcepub fn to_owned(&self) -> Result<SymbolicSparseColMat<I, R, C>, FaerError>
pub fn to_owned(&self) -> Result<SymbolicSparseColMat<I, R, C>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_row_major(&self) -> Result<SymbolicSparseRowMat<I, R, C>, FaerError>
pub fn to_row_major(&self) -> Result<SymbolicSparseRowMat<I, R, C>, FaerError>
Copies the current matrix into a newly allocated matrix, with row-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_col(&self) -> Option<&'a [I]>
pub fn nnz_per_col(&self) -> Option<&'a [I]>
Returns the count of non-zeros per column of the matrix.
Sourcepub fn row_indices(&self) -> &'a [I]
pub fn row_indices(&self) -> &'a [I]
Returns the row indices.
Sourcepub fn row_indices_of_col_raw(self, j: Idx<C>) -> &'a [Idx<R, I>]
pub fn row_indices_of_col_raw(self, j: Idx<C>) -> &'a [Idx<R, I>]
Sourcepub fn row_indices_of_col_raw_unbound(self, j: Idx<C>) -> &'a [I]
pub fn row_indices_of_col_raw_unbound(self, j: Idx<C>) -> &'a [I]
Sourcepub fn row_indices_of_col(
self,
j: Idx<C>,
) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<R>>
pub fn row_indices_of_col( self, j: Idx<C>, ) -> impl 'a + Clone + ExactSizeIterator + DoubleEndedIterator<Item = Idx<R>>
Sourcepub fn col_range(&self, j: Idx<C>) -> Range<usize> ⓘ
pub fn col_range(&self, j: Idx<C>) -> Range<usize> ⓘ
Returns the range that the column j occupies in self.row_indices().
§Panics
Panics if j >= self.ncols().
Sourcepub unsafe fn col_range_unchecked(&self, j: Idx<C>) -> Range<usize> ⓘ
pub unsafe fn col_range_unchecked(&self, j: Idx<C>) -> Range<usize> ⓘ
Returns the range that the column j occupies in self.row_indices().
§Safety
The behavior is undefined if j >= self.ncols().
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.
Trait Implementations§
Source§impl<'a, I: Index, R: Shape, C: Shape> IntoConst for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I: Index, R: Shape, C: Shape> IntoConst for SymbolicSparseColMatRef<'a, I, R, C>
type Target = SymbolicSparseColMatRef<'a, I, R, C>
fn into_const(self) -> Self::Target
Source§impl<'short, I: Index, R: Shape, C: Shape> Reborrow<'short> for SymbolicSparseColMatRef<'_, I, R, C>
impl<'short, I: Index, R: Shape, C: Shape> Reborrow<'short> for SymbolicSparseColMatRef<'_, I, R, C>
Source§impl<'short, I: Index, R: Shape, C: Shape> ReborrowMut<'short> for SymbolicSparseColMatRef<'_, I, R, C>
impl<'short, I: Index, R: Shape, C: Shape> ReborrowMut<'short> for SymbolicSparseColMatRef<'_, I, R, C>
impl<I: Index, R: Shape, C: Shape> Copy for SymbolicSparseColMatRef<'_, I, R, C>
Auto Trait Implementations§
impl<'a, I, R, C> Freeze for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I, R, C> RefUnwindSafe for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I, R, C> Send for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I, R, C> Sync for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I, R, C> Unpin for SymbolicSparseColMatRef<'a, I, R, C>
impl<'a, I, R, C> UnwindSafe for SymbolicSparseColMatRef<'a, I, R, C>
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