SparseMatrix
Module: strata.core • Kind: trait
Source: strata/core/sparse.mojo
trait SparseMatrixfrom strata.core import SparseMatrixBase interface trait for 2D sparse matrix representations.
Provides common dimension queries (num_rows, num_cols) and structural
sparsity counts (nnz) for Compressed Sparse Row (CSR) and Compressed Sparse Column (CSC) formats.
Methods Overview
Section titled “Methods Overview”| Method | Description |
|---|---|
SparseMatrix.num_rows() |
Return the number of rows. |
SparseMatrix.num_cols() |
Return the number of columns. |
SparseMatrix.nnz() |
Return the number of stored non-zero entries. |
Method Details
Section titled “Method Details”SparseMatrix.num_rows()
Section titled “SparseMatrix.num_rows()”def num_rows(self) -> IntReturn the number of rows.
Returns: Int
SparseMatrix.num_cols()
Section titled “SparseMatrix.num_cols()”def num_cols(self) -> IntReturn the number of columns.
Returns: Int
SparseMatrix.nnz()
Section titled “SparseMatrix.nnz()”def nnz(self) -> IntReturn the number of stored non-zero entries.
Returns: Int