pub struct CsrMatrix { /* private fields */ }Expand description
Data type for csr matrix.
Implementations§
Source§impl CsrMatrix
impl CsrMatrix
Sourcepub fn new(
rows: usize,
cols: usize,
row_offsets: Vec<usize>,
column_indices: Vec<usize>,
values: Vec<f32>,
) -> Result<Self>
pub fn new( rows: usize, cols: usize, row_offsets: Vec<usize>, column_indices: Vec<usize>, values: Vec<f32>, ) -> Result<Self>
Creates a new value.
Sourcepub fn column_nnz(&self) -> Vec<usize>
pub fn column_nnz(&self) -> Vec<usize>
Returns the non-zero count for each column.
Sourcepub fn column_sums(&self) -> Result<Vec<f32>>
pub fn column_sums(&self) -> Result<Vec<f32>>
Returns sums of stored values by column.
Sourcepub fn summary(&self) -> Result<SparseMatrixSummary>
pub fn summary(&self) -> Result<SparseMatrixSummary>
Returns compact shape, density, row nnz, and column nnz statistics.
Sourcepub fn l2_normalize_rows(&self) -> Result<Self>
pub fn l2_normalize_rows(&self) -> Result<Self>
Returns a CSR matrix whose non-zero rows have unit L2 norm.
Sourcepub fn mul_dense_matrix(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn mul_dense_matrix(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Multiplies this CSR matrix by a dense finite matrix.
Sourcepub fn to_dense_matrix(&self) -> Result<F32Matrix>
pub fn to_dense_matrix(&self) -> Result<F32Matrix>
Converts this CSR matrix into a row-major dense matrix.
Trait Implementations§
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