java.lang.Object
dk.jonaslindstrom.ruffini.common.matrices.elements.BaseMatrix<E>
dk.jonaslindstrom.ruffini.common.matrices.elements.SparseMatrix<E>
All Implemented Interfaces:
Matrix<E>, java.util.function.BiFunction<Vector<E>,Ring<E>,Vector<E>>

public class SparseMatrix<E> extends BaseMatrix<E>
This class represents a sparse matrix by only storing the non-zero entries.
  • Method Details

    • get

      public E get(int i, int j)
    • getHeight

      public int getHeight()
    • getWidth

      public int getWidth()
    • minor

      public Matrix<E> minor(int i, int j)
    • transpose

      public Matrix<E> transpose()
    • extendTo

      public Matrix<E> extendTo(int m, int n, E padding)
      Description copied from interface: Matrix
      Returns a new larger matrix of size m x n which has this matrix in the top left corner and pads the rest using the given padding value.
    • submatrix

      public Matrix<E> submatrix(int[] rows, int[] columns)
      Description copied from interface: Matrix
      Returns a new matrix with the given rows and columns from this matrix. The given arrays are assumed to be sorted.
    • submatrix

      public Matrix<E> submatrix(int r0, int r1, int c0, int c1)
      Description copied from interface: Matrix
      Returns a new matrix of size (r1-r0) x (c1-c0) with rows r0, ..., r1-1 and columns c0, ..., c1-1 from this matrix.
    • map

      public <F> Matrix<F> map(java.util.function.Function<E,F> f)
    • view

      public Matrix<E> view()
      Description copied from interface: Matrix
      Returns a view of the given matrix. This does not store any values but instead maps operations to this matrix.