Package org.ejml.data

Class CMatrixD1

  • All Implemented Interfaces:
    java.io.Serializable, CMatrix, Matrix, ReshapeMatrix
    Direct Known Subclasses:
    CMatrixRMaj

    public abstract class CMatrixD1
    extends java.lang.Object
    implements CMatrix, ReshapeMatrix
    A generic abstract class for matrices whose data is stored in a single 1D array of floats. The format of the elements in this array is not specified. For example row major, column major, and block row major are all common formats.
    See Also:
    Serialized Form
    • Field Detail

      • data

        public float[] data
        Where the raw data for the matrix is stored. The format is type dependent.
      • numRows

        public int numRows
        Number of rows in the matrix.
      • numCols

        public int numCols
        Number of columns in the matrix.
    • Constructor Detail

      • CMatrixD1

        public CMatrixD1()
    • Method Detail

      • getData

        public float[] getData()
        Used to get a reference to the internal data.
        Returns:
        Reference to the matrix's data.
      • setData

        public void setData​(float[] data)
        Changes the internal array reference.
      • getIndex

        public abstract int getIndex​(int row,
                                     int col)
        Returns the internal array index for the specified row and column.
        Parameters:
        row - Row index.
        col - Column index.
        Returns:
        Internal array index.
      • set

        public void set​(CMatrixD1 b)
        Sets the value of this matrix to be the same as the value of the provided matrix. Both matrices must have the same shape:

        aij = bij

        Parameters:
        b - The matrix that this matrix is to be set equal to.
      • getNumRows

        public int getNumRows()
        Returns the number of rows in this matrix.
        Specified by:
        getNumRows in interface Matrix
        Returns:
        Number of rows.
      • getNumCols

        public int getNumCols()
        Returns the number of columns in this matrix.
        Specified by:
        getNumCols in interface Matrix
        Returns:
        Number of columns.
      • setNumRows

        public void setNumRows​(int numRows)
        Sets the number of rows.
        Parameters:
        numRows - Number of rows
      • setNumCols

        public void setNumCols​(int numCols)
        Sets the number of columns.
        Parameters:
        numCols - Number of columns
      • getNumElements

        public int getNumElements()