Class RowMajorSparseMatrix

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.Double>
    Direct Known Subclasses:
    CRSMatrix

    public abstract class RowMajorSparseMatrix
    extends SparseMatrix
    • Constructor Detail

      • RowMajorSparseMatrix

        public RowMajorSparseMatrix​(int rows,
                                    int columns)
      • RowMajorSparseMatrix

        public RowMajorSparseMatrix​(int rows,
                                    int columns,
                                    int cardinality)
    • Method Detail

      • 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.
      • fromCSV

        public static RowMajorSparseMatrix fromCSV​(java.lang.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​(java.lang.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 java.util.Iterator<java.lang.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