Class RowMajorSparseMatrix

java.lang.Object
org.la4j.Matrix
org.la4j.matrix.SparseMatrix
org.la4j.matrix.RowMajorSparseMatrix
All Implemented Interfaces:
Iterable<Double>
Direct Known Subclasses:
CRSMatrix

public abstract class RowMajorSparseMatrix extends SparseMatrix
  • Constructor Details

    • RowMajorSparseMatrix

      public RowMajorSparseMatrix(int rows, int columns)
    • RowMajorSparseMatrix

      public RowMajorSparseMatrix(int rows, int columns, int cardinality)
  • Method Details

    • zero

      public static RowMajorSparseMatrix zero(int rows, int columns)
      Creates a zero RowMajorSparseMatrix of the given shape: rows x columns.
    • zero

      public static RowMajorSparseMatrix zero(int rows, int columns, int capacity)
      Creates a zero RowMajorSparseMatrix of the given shape: rows x columns with the given capacity.
    • diagonal

      public static RowMajorSparseMatrix diagonal(int size, double diagonal)
      Creates a diagonal RowMajorSparseMatrix of the given size whose diagonal elements are equal to diagonal.
    • identity

      public static RowMajorSparseMatrix identity(int size)
      Creates an identity RowMajorSparseMatrix of the given size.
    • random

      public static RowMajorSparseMatrix random(int rows, int columns, double density, Random random)
      Creates a random RowMajorSparseMatrix of the given shape: rows x columns.
    • randomSymmetric

      public static RowMajorSparseMatrix randomSymmetric(int size, double density, Random random)
      Creates a random symmetric RowMajorSparseMatrix of the given size.
    • from1DArray

      public static RowMajorSparseMatrix from1DArray(int rows, int columns, double[] array)
      Creates a new RowMajorSparseMatrix from the given 1D array with compressing (copying) the underlying array.
    • from2DArray

      public static RowMajorSparseMatrix from2DArray(double[][] array)
      Creates a new RowMajorSparseMatrix from the given 2D array with compressing (copying) the underlying array.
    • block

      public static RowMajorSparseMatrix block(Matrix a, Matrix b, Matrix c, Matrix d)
      Creates a block RowMajorSparseMatrix of the given blocks a, b, c and d.
    • fromCSV

      public static RowMajorSparseMatrix fromCSV(String csv)
      Parses RowMajorSparseMatrix from the given CSV string.
      Parameters:
      csv - the CSV string representing a matrix
      Returns:
      a parsed matrix
    • fromMatrixMarket

      public static RowMajorSparseMatrix fromMatrixMarket(String mm)
      Parses RowMajorSparseMatrix from the given Matrix Market string.
      Parameters:
      mm - the string in Matrix Market format
      Returns:
      a parsed matrix
    • isRowMajor

      public boolean isRowMajor()
      Description copied from class: SparseMatrix
      Checks whether or not this sparse matrix row-major.
      Specified by:
      isRowMajor in class SparseMatrix
    • transpose

      public Matrix transpose()
      Description copied from class: Matrix
      Transposes this matrix.
      Overrides:
      transpose in class Matrix
      Returns:
      the transposed matrix
    • rotate

      public Matrix rotate()
      Description copied from class: Matrix
      Rotates this matrix by 90 degrees to the right.
      Overrides:
      rotate in class Matrix
      Returns:
      the rotated matrix
    • iteratorOfNonZeroRows

      public abstract Iterator<Integer> iteratorOfNonZeroRows()
    • apply

      public <T> T apply(MatrixOperation<T> operation)
      Description copied from class: Matrix
      Pipes this matrix to a given operation.
      Specified by:
      apply in class Matrix
      Type Parameters:
      T - the result type
      Parameters:
      operation - the matrix operation (an operation that takes a matrix and returns T)
      Returns:
      the result of an operation applied to this matrix
    • apply

      public <T> T apply(MatrixMatrixOperation<T> operation, Matrix that)
      Description copied from class: Matrix
      Pipes this matrix to a given operation.
      Specified by:
      apply in class Matrix
      Type Parameters:
      T - the result type
      Parameters:
      operation - the matrix-matrix operation (an operation that takes two matrices and returns T)
      that - the right hand matrix of the given operation
      Returns:
      the result of an operation applied to this matrix
    • apply

      public <T> T apply(MatrixVectorOperation<T> operation, Vector that)
      Description copied from class: Matrix
      Pipes this matrix to a given operation.
      Specified by:
      apply in class Matrix
      Type Parameters:
      T - the result type
      Parameters:
      operation - the matrix-vector operation (an operation that takes matrix and vector and returns T)
      that - the right hand vector of the given operation
      Returns:
      the result of an operation applied to this matrix