Class OpenMapRealMatrix

    • Constructor Detail

      • OpenMapRealMatrix

        public OpenMapRealMatrix​(int rowDimension,
                                 int columnDimension)
        Build a sparse matrix with the supplied row and column dimensions.
        Parameters:
        rowDimension - number of rows of the matrix
        columnDimension - number of columns of the matrix
      • OpenMapRealMatrix

        public OpenMapRealMatrix​(OpenMapRealMatrix matrix)
        Build a matrix by copying another one.
        Parameters:
        matrix - matrix to copy
    • Method Detail

      • createMatrix

        public OpenMapRealMatrix createMatrix​(int rowDimension,
                                              int columnDimension)
                                       throws java.lang.IllegalArgumentException
        Create a new RealMatrix of the same type as the instance with the supplied row and column dimensions.
        Specified by:
        createMatrix in interface RealMatrix
        Specified by:
        createMatrix in class AbstractRealMatrix
        Parameters:
        rowDimension - the number of rows in the new matrix
        columnDimension - the number of columns in the new matrix
        Returns:
        a new matrix of the same type as the instance
        Throws:
        java.lang.IllegalArgumentException - if row or column dimension is not positive
      • add

        public OpenMapRealMatrix add​(RealMatrix m)
                              throws java.lang.IllegalArgumentException
        Compute the sum of this and m.
        Specified by:
        add in interface RealMatrix
        Overrides:
        add in class AbstractRealMatrix
        Parameters:
        m - matrix to be added
        Returns:
        this + m
        Throws:
        java.lang.IllegalArgumentException - if m is not the same size as this
      • add

        public OpenMapRealMatrix add​(OpenMapRealMatrix m)
                              throws java.lang.IllegalArgumentException
        Compute the sum of this and m.
        Parameters:
        m - matrix to be added
        Returns:
        this + m
        Throws:
        java.lang.IllegalArgumentException - if m is not the same size as this
      • subtract

        public OpenMapRealMatrix subtract​(RealMatrix m)
                                   throws java.lang.IllegalArgumentException
        Compute this minus m.
        Specified by:
        subtract in interface RealMatrix
        Overrides:
        subtract in class AbstractRealMatrix
        Parameters:
        m - matrix to be subtracted
        Returns:
        this - m
        Throws:
        java.lang.IllegalArgumentException - if m is not the same size as this
      • subtract

        public OpenMapRealMatrix subtract​(OpenMapRealMatrix m)
                                   throws java.lang.IllegalArgumentException
        Compute this minus m.
        Parameters:
        m - matrix to be subtracted
        Returns:
        this - m
        Throws:
        java.lang.IllegalArgumentException - if m is not the same size as this
      • multiply

        public RealMatrix multiply​(RealMatrix m)
                            throws java.lang.IllegalArgumentException
        Returns the result of postmultiplying this by m.
        Specified by:
        multiply in interface RealMatrix
        Overrides:
        multiply in class AbstractRealMatrix
        Parameters:
        m - matrix to postmultiply by
        Returns:
        this * m
        Throws:
        java.lang.IllegalArgumentException - if columnDimension(this) != rowDimension(m)
      • multiply

        public OpenMapRealMatrix multiply​(OpenMapRealMatrix m)
                                   throws java.lang.IllegalArgumentException
        Returns the result of postmultiplying this by m.
        Parameters:
        m - matrix to postmultiply by
        Returns:
        this * m
        Throws:
        java.lang.IllegalArgumentException - if columnDimension(this) != rowDimension(m)
      • getEntry

        public double getEntry​(int row,
                               int column)
                        throws MatrixIndexException
        Returns the entry in the specified row and column.

        Row and column indices start at 0 and must satisfy

        • 0 <= row < rowDimension
        • 0 <= column < columnDimension
        otherwise a MatrixIndexException is thrown.

        Specified by:
        getEntry in interface RealMatrix
        Specified by:
        getEntry in class AbstractRealMatrix
        Parameters:
        row - row location of entry to be fetched
        column - column location of entry to be fetched
        Returns:
        matrix entry in row,column
        Throws:
        MatrixIndexException - if the row or column index is not valid
      • setEntry

        public void setEntry​(int row,
                             int column,
                             double value)
                      throws MatrixIndexException
        Set the entry in the specified row and column.

        Row and column indices start at 0 and must satisfy

        • 0 <= row < rowDimension
        • 0 <= column < columnDimension
        otherwise a MatrixIndexException is thrown.

        Specified by:
        setEntry in interface RealMatrix
        Specified by:
        setEntry in class AbstractRealMatrix
        Parameters:
        row - row location of entry to be set
        column - column location of entry to be set
        value - matrix entry to be set in row,column
        Throws:
        MatrixIndexException - if the row or column index is not valid
      • addToEntry

        public void addToEntry​(int row,
                               int column,
                               double increment)
                        throws MatrixIndexException
        Change an entry in the specified row and column.

        Row and column indices start at 0 and must satisfy

        • 0 <= row < rowDimension
        • 0 <= column < columnDimension
        otherwise a MatrixIndexException is thrown.

        Specified by:
        addToEntry in interface RealMatrix
        Specified by:
        addToEntry in class AbstractRealMatrix
        Parameters:
        row - row location of entry to be set
        column - column location of entry to be set
        increment - value to add to the current matrix entry in row,column
        Throws:
        MatrixIndexException - if the row or column index is not valid
      • multiplyEntry

        public void multiplyEntry​(int row,
                                  int column,
                                  double factor)
                           throws MatrixIndexException
        Change an entry in the specified row and column.

        Row and column indices start at 0 and must satisfy

        • 0 <= row < rowDimension
        • 0 <= column < columnDimension
        otherwise a MatrixIndexException is thrown.

        Specified by:
        multiplyEntry in interface RealMatrix
        Specified by:
        multiplyEntry in class AbstractRealMatrix
        Parameters:
        row - row location of entry to be set
        column - column location of entry to be set
        factor - multiplication factor for the current matrix entry in row,column
        Throws:
        MatrixIndexException - if the row or column index is not valid