pub struct CsrBase<T, Data, Indices, Indptr>{
pub shape: [u64; 2],
pub data: Data,
pub indices: Indices,
pub indptr: Indptr,
}Expand description
Raw representation of a scipy.sparse.csr_matrix.
In spirit, each field is simply a Vec. (see the type alias Csr).
This generic base class exists in order to allow you to use slices when writing.
Fields§
§shape: [u64; 2]Dimensions of the matrix [nrow, ncol].
data: DataA vector of length nnz containing all of the nonzero elements, sorted by row.
indices: IndicesA vector of length nnz indicating the column of each element.
Beware: scipy does not require or guarantee that the column indices within each row are sorted.
indptr: IndptrA vector of length nrow + 1 indicating the indices that partition Self::data
and Self::indices into data for each row.
Typically, the elements are nondecreasing, with the first equal to 0 and the final equal
to nnz (though the set of requirements that are actually validated by scipy are
weaker and somewhat arbitrary).
Implementations§
Source§impl<T, Data, Indices, Indptr> CsrBase<T, Data, Indices, Indptr>
impl<T, Data, Indices, Indptr> CsrBase<T, Data, Indices, Indptr>
Sourcepub fn write_npz<W: Write + Seek>(&self, npz: &mut NpzWriter<W>) -> Result<()>
pub fn write_npz<W: Write + Seek>(&self, npz: &mut NpzWriter<W>) -> Result<()>
Write a sparse csr_matrix matrix, like scipy.sparse.save_npz.
§Panics
This method does not currently perform any significant validation of input, but validation (with panics) may be added later in a future semver major bump.