pub struct CsrMatrix<T: Real = f64> {
pub n_cols: usize,
pub row_ptr: Vec<usize>,
pub col_idx: Vec<u32>,
pub val: Vec<T>,
}Expand description
Sparse matrix in compressed sparse row (CSR) format.
Fields§
§n_cols: usizeNumber of columns n.
row_ptr: Vec<usize>Row pointers, length m + 1; row i occupies
row_ptr[i]..row_ptr[i + 1].
col_idx: Vec<u32>Column index of each stored entry, strictly increasing within a row.
val: Vec<T>Value of each stored entry; finite and nonzero.
Implementations§
Source§impl<T: Real> CsrMatrix<T>
impl<T: Real> CsrMatrix<T>
Sourcepub fn from_raw_parts(
n_cols: usize,
row_ptr: Vec<usize>,
col_idx: Vec<u32>,
val: Vec<T>,
) -> Result<Self, SparseError>
pub fn from_raw_parts( n_cols: usize, row_ptr: Vec<usize>, col_idx: Vec<u32>, val: Vec<T>, ) -> Result<Self, SparseError>
Builds a matrix from raw compressed arrays, validating every invariant.
Sourcepub fn to_csc(&self) -> CscMatrix<T>
pub fn to_csc(&self) -> CscMatrix<T>
The same matrix in column-wise (CSC) storage, by Algorithm T.
Sourcepub fn check_invariants(&self) -> Result<(), SparseError>
pub fn check_invariants(&self) -> Result<(), SparseError>
Checks invariants (C1)–(C4).
Trait Implementations§
impl<T: PartialEq + Real> StructuralPartialEq for CsrMatrix<T>
Auto Trait Implementations§
impl<T> Forget for CsrMatrix<T>
impl<T> Freeze for CsrMatrix<T>
impl<T> RefUnwindSafe for CsrMatrix<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for CsrMatrix<T>
impl<T> Sync for CsrMatrix<T>
impl<T> Unpin for CsrMatrix<T>
impl<T> UnsafeUnpin for CsrMatrix<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for CsrMatrix<T>where
Vec<T>: UnwindSafe,
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
Mutably borrows from an owned value. Read more