Class DenseDoubleMatrix2D

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

    public class DenseDoubleMatrix2D
    extends cern.colt.matrix.DoubleMatrix2D
    Class for dense 2-d matrices holding double elements in double elements in the dense format used by OpenCV. See the documentation for OpenCV for more details.
    Author:
    anders.gidenstam(at)hb.se
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class cern.colt.matrix.impl.AbstractMatrix2D

        columns, columnStride, columnZero, rows, rowStride, rowZero
      • Fields inherited from class cern.colt.matrix.impl.AbstractMatrix

        isNoView
      • Fields inherited from class cern.colt.PersistentObject

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      DenseDoubleMatrix2D​(int rows, int columns)
      Constructs a matrix with a given number of rows and columns.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getQuick​(int row, int column)
      Returns the matrix cell value at coordinate [row,column].
      cern.colt.matrix.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.
      cern.colt.matrix.DoubleMatrix1D like1D​(int size)
      Construct and returns a new 1-d matrix of the corresponding dynamic type, entirelly independent of the receiver.
      protected cern.colt.matrix.DoubleMatrix1D like1D​(int size, int zero, int stride)
      Construct and returns a new 1-d matrix of the corresponding dynamic type, sharing the same cells.
      void setQuick​(int row, int column, double value)
      Sets the matrix cell at coordinate [row,column] to the specified value.
      protected void setUp​(int rows, int columns)
      Sets up a matrix with a given number of rows and columns.
      cern.colt.matrix.DoubleMatrix1D viewRow​(int row)
      Constructs and returns a new slice view representing the columns of the given row.
      protected cern.colt.matrix.DoubleMatrix2D viewSelectionLike​(int[] rowOffsets, int[] columnOffsets)
      Construct and returns a new selection view.
      • Methods inherited from class cern.colt.matrix.DoubleMatrix2D

        aggregate, aggregate, assign, assign, assign, assign, assign, cardinality, copy, equals, equals, forEachNonZero, get, getContent, getNonZeros, haveSharedCells, haveSharedCellsRaw, like, set, toArray, toString, view, viewColumn, viewColumnFlip, viewDice, viewPart, viewRowFlip, viewSelection, viewSelection, viewSorted, viewStrides, zAssign8Neighbors, zMult, zMult, zMult, zMult, zSum
      • Methods inherited from class cern.colt.matrix.impl.AbstractMatrix2D

        _columnOffset, _columnRank, _rowOffset, _rowRank, checkBox, checkColumn, checkColumnIndexes, checkRow, checkRowIndexes, checkShape, checkShape, columns, index, rows, setUp, size, toStringShort, vColumnFlip, vDice, vPart, vRowFlip, vStrides
      • Methods inherited from class cern.colt.matrix.impl.AbstractMatrix

        ensureCapacity, isView, trimToSize
      • Methods inherited from class cern.colt.PersistentObject

        clone
      • Methods inherited from class java.lang.Object

        finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DenseDoubleMatrix2D

        public DenseDoubleMatrix2D​(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

      • like

        public cern.colt.matrix.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 SparseDoubleMatrix2D 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.
        Specified by:
        like in class cern.colt.matrix.DoubleMatrix2D
        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 cern.colt.matrix.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.
        Specified by:
        like1D in class cern.colt.matrix.DoubleMatrix2D
        Parameters:
        size - the number of cells the matrix shall have.
        Returns:
        a new matrix of the corresponding dynamic type.
      • like1D

        protected cern.colt.matrix.DoubleMatrix1D like1D​(int size,
                                                         int zero,
                                                         int stride)
        Construct and returns a new 1-d matrix of the corresponding dynamic type, sharing the same cells. 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.
        Specified by:
        like1D in class cern.colt.matrix.DoubleMatrix2D
        Parameters:
        size - the number of cells the matrix shall have.
        zero - the index of the first element.
        stride - the number of indexes between any two elements, i.e. index(i+1)-index(i).
        Returns:
        a new matrix of the corresponding dynamic type.
      • 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().

        Specified by:
        getQuick in class cern.colt.matrix.DoubleMatrix2D
        Parameters:
        row - the index of the row-coordinate.
        column - the index of the column-coordinate.
        Returns:
        the value at the specified coordinate.
      • 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().

        Specified by:
        setQuick in class cern.colt.matrix.DoubleMatrix2D
        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.
      • viewRow

        public cern.colt.matrix.DoubleMatrix1D viewRow​(int row)
        Constructs and returns a new slice view representing the columns of the given row. The returned view is backed by this matrix, so changes in the returned view are reflected in this matrix, and vice-versa. To obtain a slice view on subranges, construct a sub-ranging view (viewPart( ...)), then apply this method to the sub-range view.

        Example:

        2 x 3 matrix:
        1, 2, 3
        4, 5, 6
        viewRow(0) ==> Matrix1D of size 3:
        1, 2, 3
        Overrides:
        viewRow in class cern.colt.matrix.DoubleMatrix2D
        Parameters:
        row - the row to fix.
        Returns:
        a new slice view.
        Throws:
        java.lang.IndexOutOfBoundsException - if row < 0 || row ≥ rows().
        See Also:
        DoubleMatrix2D.viewColumn(int)
      • viewSelectionLike

        protected cern.colt.matrix.DoubleMatrix2D viewSelectionLike​(int[] rowOffsets,
                                                                    int[] columnOffsets)
        Construct and returns a new selection view.
        Specified by:
        viewSelectionLike in class cern.colt.matrix.DoubleMatrix2D
        Parameters:
        rowOffsets - the offsets of the visible elements.
        columnOffsets - the offsets of the visible elements.
        Returns:
        a new view.
      • setUp

        protected void setUp​(int rows,
                             int columns)
        Sets up a matrix with a given number of rows and columns.
        Overrides:
        setUp in class cern.colt.matrix.impl.AbstractMatrix2D
        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.