Class AbstractCsrRingMatrix<T extends AbstractCsrRingMatrix<T,U,V,W>,U extends AbstractDenseRingMatrix<U,?,W>,V extends AbstractCooRingVector<V,?,?,U,W>,W extends Ring<W>>

java.lang.Object
org.flag4j.arrays.backend.AbstractTensor<T,W[],W>
org.flag4j.arrays.backend.semiring_arrays.AbstractCsrSemiringMatrix<T,U,V,W>
org.flag4j.arrays.backend.ring_arrays.AbstractCsrRingMatrix<T,U,V,W>
Type Parameters:
T - Type of this CSR field matrix.
U - Type of dense field matrix equivalent to T.
V - Type of vector equivalent to V.
Y - Type of field element of this matrix.
All Implemented Interfaces:
Serializable, MatrixMixin<T,U,V,W>, RingTensorMixin<T,U,W>, TensorOverRing<T,U,W[],W>, SemiringTensorMixin<T,U,W>, TensorOverSemiring<T,U,W[],W>
Direct Known Subclasses:
AbstractCsrFieldMatrix, CsrRingMatrix

public abstract class AbstractCsrRingMatrix<T extends AbstractCsrRingMatrix<T,U,V,W>,U extends AbstractDenseRingMatrix<U,?,W>,V extends AbstractCooRingVector<V,?,?,U,W>,W extends Ring<W>> extends AbstractCsrSemiringMatrix<T,U,V,W> implements RingTensorMixin<T,U,W>, MatrixMixin<T,U,V,W>

A sparse matrix stored in compressed sparse row (CSR) format. The AbstractTensor.data of this CSR matrix are elements of a Ring.

The non-zero data and non-zero indices of a CSR matrix are mutable but the AbstractTensor.shape and total number of non-zero data is fixed.

Sparse matrices allow for the efficient storage of and ops on matrices that contain many zero values.

A sparse CSR matrix is stored as:

  • The full shape of the matrix.
  • The non-zero AbstractTensor.data of the matrix. All other data in the matrix are assumed to be zero. Zero values can also explicitly be stored in AbstractTensor.data.
  • The row pointers of the non-zero values in the CSR matrix. Has size numRows + 1
  • rowPointers[i] indicates the starting index within data and colData of all values in row i.

  • The column indices of the non-zero values in the sparse matrix.

Note: many ops assume that the data of the CSR matrix are sorted lexicographically by the row and column indices. (i.e.) by row indices first then column indices. However, this is not explicitly verified. Any ops implemented in this class will preserve the lexicographical sorting.

If indices need to be sorted, call AbstractCsrSemiringMatrix.sortIndices().

See Also: