Class SparseMatrix<E>

java.lang.Object
org.episteme.core.mathematics.linearalgebra.matrices.GenericMatrix<E>
org.episteme.core.mathematics.linearalgebra.matrices.SparseMatrix<E>
All Implemented Interfaces:
Matrix<E>, AbelianGroup<Matrix<E>>, AbelianMonoid<Matrix<E>>, Group<Matrix<E>>, Magma<Matrix<E>>, Monoid<Matrix<E>>, Ring<Matrix<E>>, Semiring<Matrix<E>>, Set<Matrix<E>>, Module<Matrix<E>, E>

public class SparseMatrix<E> extends GenericMatrix<E>
A sparse matrix implementation. Wrapper around GenericMatrix that enforces SparseMatrixStorage.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • SparseMatrix

      public SparseMatrix(E[][] data, Ring<E> ring)
      Creates a SparseMatrix with automatic storage optimization.
    • SparseMatrix

      public SparseMatrix(List<List<E>> rows, Ring<E> ring)
    • SparseMatrix

      public SparseMatrix(int rows, int cols, Ring<E> ring)
    • SparseMatrix

      public SparseMatrix(MatrixStorage<E> storage, LinearAlgebraProvider<E> provider, Ring<E> ring)
    • SparseMatrix

      public SparseMatrix(MatrixStorage<E> storage, Ring<E> ring)
  • Method Details

    • fromDense

      public static <E> SparseMatrix<E> fromDense(List<List<E>> rows, Ring<E> ring)
    • of

      public static <E> SparseMatrix<E> of(int rows, int cols, Ring<E> ring)
    • of

      public static <E> SparseMatrix<E> of(int rows, int cols, E zero, Ring<E> ring)
    • zeros

      public static <E> SparseMatrix<E> zeros(int rows, int cols, Ring<E> ring)
    • identity

      public static <E> SparseMatrix<E> identity(int size, Ring<E> ring)
    • getNnz

      public int getNnz()
    • getSparseStorage

      public SparseMatrixStorage<E> getSparseStorage()
    • set

      public void set(int row, int col, E value)
      Overrides:
      set in class GenericMatrix<E>
    • getValues

      public Object[] getValues()
    • getColIndices

      public int[] getColIndices()
    • getRowPointers

      public int[] getRowPointers()
    • toString

      public String toString()
      Overrides:
      toString in class Object