Class CsrMatrix

java.lang.Object
All Implemented Interfaces:
Serializable, MatrixComparisonsMixin<CsrMatrix>, MatrixManipulationsMixin<CsrMatrix,Double>, MatrixMixin<CsrMatrix,Matrix,CsrMatrix,CsrCMatrix,CsrCMatrix,Double,CooVector,Vector>, MatrixOperationsMixin<CsrMatrix,Matrix,CsrMatrix,CsrCMatrix,CsrCMatrix,Double,CooVector,Vector>, MatrixPropertiesMixin, RealMatrixMixin<CsrMatrix,CsrCMatrix>, RealTensorMixin<CsrMatrix,CsrCMatrix>, SparseTensorMixin, TensorComparisonsMixin, TensorManipulationsMixin<CsrMatrix>, TensorOperationsMixin<CsrMatrix,Matrix,CsrCMatrix,CMatrix,CsrMatrix,Double>, TensorPropertiesMixin

Real sparse matrix stored in compressed sparse row (CSR) format.

CSR matrices are best suited for efficient access and matrix operations. Specifically, matrix-matrix and matrix-vector multiplication. CSR matrices are not well suited for modification (see CooMatrix).

The CSR format stores a sparse m-by-n matrix as three one-dimensional arrays: TensorBase.entries, rowPointers, and colIndices.

  • entries: Stores the non-zero values of the sparse matrix. Note, zero values can be stored explicitly in this array. Hence, the term "non-zero values" is a misnomer.
  • rowPointers: Encodes the total number of non-zero values above each row. Has length m+1. For example, rowPointers[j] contains the total number of non-zero values above row j. The first entry is always 0 and the last element is always entries.length
  • colIndices: Contains the column indices for all non-zero entries. Has length entries.length
See Also: