Class RCMDoubleMatrix2D

All Implemented Interfaces:
Serializable, Cloneable

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

  • Constructor Details

    • 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:
      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:
      IllegalArgumentException - if rowsinvalid input: '<'0 || columnsinvalid input: '<'0 || (double)columns*rows > Integer.MAX_VALUE.
  • Method Details

    • 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).
    • getContent

      protected DoubleMatrix2D getContent()
      Returns the content of this matrix if it is a wrapper; or this otherwise. Override this method in wrappers.
      Overrides:
      getContent in class WrapperDoubleMatrix2D
    • 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() invalid input: '&'invalid input: '&' 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() invalid input: '&'invalid input: '&' 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:
      IllegalArgumentException - if A.columns() != y.size() || A.rows() > z.size()).