Interface SparseStructure2D

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 Structure2D and provides additional sparse-specific functionality. The main matrix functionality is defined in other interfaces that implement this one.

  • Method Details

    • 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()