-
- All Superinterfaces:
Structure1D,Structure2D
- All Known Implementing Classes:
ColumnsSupplier,CompressedSparseR064,R064CSC,R064CSR,RowsSupplier,SparseStore
public interface SparseStructure2D extends Structure2D
Additional methods for sparse matrix implementations that store only non-zero elements.This interface defines common functionality for sparse matrix structures, which are optimized for storing matrices where most elements are zero. Implementations typically use specialized data structures like Compressed Sparse Row (CSR), Compressed Sparse Column (CSC), or Coordinate Format (COO) to efficiently store and access non-zero elements.
The interface provides methods to:
- Count the number of non-zero elements in the matrix
- Calculate the density of the matrix (ratio of non-zero elements to total elements)
- Convert the sparse matrix to specific sparse formats (CSR, CSC)
Note: This interface extends
Structure2Dand provides additional sparse-specific functionality. The main matrix functionality is defined in other interfaces that implement this one.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallback
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intcountNonzeros()default doubledensity()Returns the density of the matrix, defined as the ratio of non-zero elements to the total number of elements in the matrix.R064CSCtoCSC()R064CSRtoCSR()-
Methods inherited from interface org.ojalgo.structure.Structure2D
count, countColumns, countRows, firstInColumn, firstInRow, getColDim, getMaxDim, getMinDim, getRowDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Method Detail
-
countNonzeros
int countNonzeros()
-
density
default double density()
Returns the density of the matrix, defined as the ratio of non-zero elements to the total number of elements in the matrix.- Returns:
- The density of the matrix, between 0.0 and 1.0
-
toCSC
R064CSC toCSC()
-
toCSR
R064CSR toCSR()
-
-