Package org.ejml.data

Interface MatrixSparse

All Superinterfaces:
Matrix, ReshapeMatrix, Serializable
All Known Subinterfaces:
DMatrixSparse, FMatrixSparse
All Known Implementing Classes:
DMatrixSparseCSC, DMatrixSparseTriplet, FMatrixSparseCSC, FMatrixSparseTriplet

public interface MatrixSparse extends ReshapeMatrix
High level interface for all sparse matrices
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of non-zero elements.
    boolean
    isAssigned(int row, int col)
    Is the specified element explicitly assigned a value
    void
    Prints to standard out the non-zero elements only.
    void
    remove(int row, int col)
    If the specified element is non-zero it is removed from the structure
    void
    reshape(int numRows, int numCols)
    Changes the number of rows and columns in the matrix.
    void
    reshape(int numRows, int numCols, int arrayLength)
    Reshapes the matrix so that it can store a matrix with the specified dimensions and the number of non-zero elements.
    void
    Reduces the size of internal data structures to their minimal size.
    void
    Sets all elements to zero by removing the sparse graph

    Methods inherited from interface org.ejml.data.Matrix

    copy, create, createLike, getNumCols, getNumRows, getType, print, print, setTo
  • Method Details

    • printNonZero

      void printNonZero()
      Prints to standard out the non-zero elements only.
    • reshape

      void reshape(int numRows, int numCols, int arrayLength)
      Reshapes the matrix so that it can store a matrix with the specified dimensions and the number of non-zero elements. The reshaped matrix will be empty.
      Parameters:
      numRows - number of rows
      numCols - number of columns
      arrayLength - Array length for storing non-zero elements.
    • reshape

      void reshape(int numRows, int numCols)
      Changes the number of rows and columns in the matrix. The graph structure is flushed and the matrix will be empty/all zeros. Similar to reshape(int, int, int), but the storage for non-zero elements is not changed
      Specified by:
      reshape in interface ReshapeMatrix
      Parameters:
      numRows - number of rows
      numCols - number of columns
    • shrinkArrays

      void shrinkArrays()
      Reduces the size of internal data structures to their minimal size. No information is lost but the arrays will change
    • remove

      void remove(int row, int col)
      If the specified element is non-zero it is removed from the structure
      Parameters:
      row - the row
      col - the column
    • isAssigned

      boolean isAssigned(int row, int col)
      Is the specified element explicitly assigned a value
      Parameters:
      row - the row
      col - the column
      Returns:
      true if it has been assigned a value or false if not
    • zero

      void zero()
      Sets all elements to zero by removing the sparse graph
      Specified by:
      zero in interface Matrix
    • getNonZeroLength

      int getNonZeroLength()
      Returns the number of non-zero elements.