Class RCMDoubleMatrix2D

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    class RCMDoubleMatrix2D
    extends WrapperDoubleMatrix2D
    Sparse row-compressed-modified 2-d matrix holding double elements.
    Version:
    0.9, 04/14/2000
    • Constructor Detail

      • RCMDoubleMatrix2D

        public RCMDoubleMatrix2D​(double[][] values)
        Constructs a matrix with a copy of the given values. values is required to have the form values[row][column] and have exactly the same number of columns in every row.

        The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.

        Parameters:
        values - The values to be filled into the new matrix.
        Throws:
        java.lang.IllegalArgumentException - if for any 1 <= row < values.length: values[row].length != values[row-1].length.
      • RCMDoubleMatrix2D

        public RCMDoubleMatrix2D​(int rows,
                                 int columns)
        Constructs a matrix with a given number of rows and columns. All entries are initially 0.
        Parameters:
        rows - the number of rows the matrix shall have.
        columns - the number of columns the matrix shall have.
        Throws:
        java.lang.IllegalArgumentException - if rows<0 || columns<0 || (double)columns*rows > Integer.MAX_VALUE.
    • Method Detail

      • assign

        public DoubleMatrix2D assign​(double value)
        Sets all cells to the state specified by value.
        Overrides:
        assign in class DoubleMatrix2D
        Parameters:
        value - the value to be filled into the cells.
        Returns:
        this (for convenience only).
      • getQuick

        public double getQuick​(int row,
                               int column)
        Returns the matrix cell value at coordinate [row,column].

        Provided with invalid parameters this method may return invalid objects without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().

        Overrides:
        getQuick in class WrapperDoubleMatrix2D
        Parameters:
        row - the index of the row-coordinate.
        column - the index of the column-coordinate.
        Returns:
        the value at the specified coordinate.
      • like

        public DoubleMatrix2D like​(int rows,
                                   int columns)
        Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of rows and columns. For example, if the receiver is an instance of type DenseDoubleMatrix2D the new matrix must also be of type DenseDoubleMatrix2D, if the receiver is an instance of type SparseDoubleMatrix2D the new matrix must also be of type SparseDoubleMatrix2D, etc. In general, the new matrix should have internal parametrization as similar as possible.
        Overrides:
        like in class WrapperDoubleMatrix2D
        Parameters:
        rows - the number of rows the matrix shall have.
        columns - the number of columns the matrix shall have.
        Returns:
        a new empty matrix of the same dynamic type.
      • like1D

        public DoubleMatrix1D like1D​(int size)
        Construct and returns a new 1-d matrix of the corresponding dynamic type, entirelly independent of the receiver. For example, if the receiver is an instance of type DenseDoubleMatrix2D the new matrix must be of type DenseDoubleMatrix1D, if the receiver is an instance of type SparseDoubleMatrix2D the new matrix must be of type SparseDoubleMatrix1D, etc.
        Overrides:
        like1D in class WrapperDoubleMatrix2D
        Parameters:
        size - the number of cells the matrix shall have.
        Returns:
        a new matrix of the corresponding dynamic type.
      • setQuick

        public void setQuick​(int row,
                             int column,
                             double value)
        Sets the matrix cell at coordinate [row,column] to the specified value.

        Provided with invalid parameters this method may access illegal indexes without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().

        Overrides:
        setQuick in class WrapperDoubleMatrix2D
        Parameters:
        row - the index of the row-coordinate.
        column - the index of the column-coordinate.
        value - the value to be filled into the specified cell.
      • zMult

        protected void zMult​(DoubleMatrix1D y,
                             DoubleMatrix1D z,
                             IntArrayList nonZeroIndexes,
                             DoubleMatrix1D[] allRows,
                             double alpha,
                             double beta)
        Linear algebraic matrix-vector multiplication; z = A * y. z[i] = alpha*Sum(A[i,j] * y[j]) + beta*z[i], i=0..A.rows()-1, j=0..y.size()-1. Where A == this.
        Parameters:
        y - the source vector.
        z - the vector where results are to be stored.
        Throws:
        java.lang.IllegalArgumentException - if A.columns() != y.size() || A.rows() > z.size()).