pub struct CsrMatrix {
pub nrows: usize,
pub ncols: usize,
pub indptr: Vec<usize>,
pub indices: Vec<usize>,
pub data: Vec<f64>,
}Expand description
Compressed sparse rows: the entries of row i are indices[indptr[i]..indptr[i+1]] (columns,
increasing) and the matching data (SciPy’s csr_array).
Fields§
§nrows: usize§ncols: usize§indptr: Vec<usize>§indices: Vec<usize>§data: Vec<f64>Implementations§
Source§impl CsrMatrix
impl CsrMatrix
Sourcepub fn from_triplets(
nrows: usize,
ncols: usize,
rows: &[usize],
cols: &[usize],
values: &[f64],
) -> Result<Self>
pub fn from_triplets( nrows: usize, ncols: usize, rows: &[usize], cols: &[usize], values: &[f64], ) -> Result<Self>
Builds a CSR matrix from triplets, summing duplicates and sorting the column indices of each row: a counting sort by row, then by column within each row.
Sourcepub fn from_dense(a: &Array2<f64>, tol: f64) -> Self
pub fn from_dense(a: &Array2<f64>, tol: f64) -> Self
The entries of a larger than tol in magnitude.
Sourcepub fn diags(
diagonals: &[Vec<f64>],
offsets: &[isize],
nrows: usize,
ncols: usize,
) -> Result<Self>
pub fn diags( diagonals: &[Vec<f64>], offsets: &[isize], nrows: usize, ncols: usize, ) -> Result<Self>
A matrix with the given diagonals (SciPy’s diags): diagonals[k] holds the values of the
diagonal at offsets[k] (0 main, positive above), starting from its first element.
pub fn nnz(&self) -> usize
pub fn to_dense(&self) -> Array2<f64>
Trait Implementations§
Source§impl LinearOperator for CsrMatrix
impl LinearOperator for CsrMatrix
impl StructuralPartialEq for CsrMatrix
Auto Trait Implementations§
impl Freeze for CsrMatrix
impl RefUnwindSafe for CsrMatrix
impl Send for CsrMatrix
impl Sync for CsrMatrix
impl Unpin for CsrMatrix
impl UnsafeUnpin for CsrMatrix
impl UnwindSafe for CsrMatrix
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