Package org.ejml.data

Class ZMatrixRMaj

java.lang.Object
org.ejml.data.ZMatrixD1
org.ejml.data.ZMatrixRMaj
All Implemented Interfaces:
Serializable, Matrix, ReshapeMatrix, ZMatrix

public class ZMatrixRMaj
extends ZMatrixD1
Dense matrix for complex numbers. Internally it stores its data in a single row-major array with the real and imaginary components interlaces, in that order. The total number of elements in the array will be numRows*numColumns*2.
See Also:
Serialized Form
  • Field Summary

    Fields inherited from class org.ejml.data.ZMatrixD1

    data, numCols, numRows
  • Constructor Summary

    Constructors
    Constructor Description
    ZMatrixRMaj​(double[][] data)
    Creates a matrix with the values and shape defined by the 2D array 'data'.
    ZMatrixRMaj​(int numRows, int numCols)
    Creates a new matrix with the specified number of rows and columns
    ZMatrixRMaj​(int numRows, int numCols, boolean rowMajor, double... data)  
    ZMatrixRMaj​(ZMatrixRMaj original)
    Creates a new ZMatrixRMaj which is a copy of the passed in matrix.
  • Method Summary

    Modifier and Type Method Description
    ZMatrixRMaj copy()
    Creates an exact copy of the matrix
    ZMatrixRMaj create​(int numRows, int numCols)
    Creates a new matrix of the same type with the specified shape
    ZMatrixRMaj createLike()
    Creates a new matrix with the same shape as this matrix
    void get​(int row, int col, Complex_F64 output)
    Returns the complex value of the matrix's element
    int getDataLength()
    Returns the number of elements in the internal data array
    double getImag​(int element)  
    double getImag​(int row, int col)
    Returns the imaginary component of the matrix's element.
    int getIndex​(int row, int col)
    Returns the internal array index for the specified row and column.
    double getReal​(int element)  
    double getReal​(int row, int col)
    Returns the real component of the matrix's element.
    int getRowStride()
    Number of array elements in the matrix's row.
    MatrixType getType()
    Returns the type of matrix
    void print()
    Prints the matrix to standard out using standard formatting.
    void print​(String format)
    Prints the matrix to standard out with the specified formatting.
    void reshape​(int numRows, int numCols)
    Equivalent to invoking reshape(numRows,numCols,false);
    void set​(int row, int col, double real, double imaginary)
    Set's the complex value of the matrix's element
    void setImag​(int row, int col, double val)
    Sets the imaginary component of the matrix's element.
    void setReal​(int row, int col, double val)
    Sets the real component of the matrix's element.
    void setTo​(int numRows, int numCols, boolean rowMajor, double... data)
    Sets this matrix equal to the matrix encoded in the array.
    void setTo​(Matrix original)
    Sets this matrix to be identical to the 'original' matrix passed in.
    void setTo​(ZMatrixRMaj original)  
    void zero()
    Sets all the elements in the matrix to zero

    Methods inherited from class org.ejml.data.ZMatrixD1

    getData, getNumCols, getNumElements, getNumRows, setData, setNumCols, setNumRows, setTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ZMatrixRMaj

      public ZMatrixRMaj​(double[][] data)

      Creates a matrix with the values and shape defined by the 2D array 'data'. It is assumed that 'data' has a row-major formatting:

      data[ row ][ column ]

      Parameters:
      data - 2D array representation of the matrix. Not modified.
    • ZMatrixRMaj

      public ZMatrixRMaj​(int numRows, int numCols, boolean rowMajor, double... data)
    • ZMatrixRMaj

      public ZMatrixRMaj​(ZMatrixRMaj original)
      Creates a new ZMatrixRMaj which is a copy of the passed in matrix.
      Parameters:
      original - Matrix which is to be copied
    • ZMatrixRMaj

      public ZMatrixRMaj​(int numRows, int numCols)
      Creates a new matrix with the specified number of rows and columns
      Parameters:
      numRows - number of rows
      numCols - number of columns
  • Method Details

    • getIndex

      public int getIndex​(int row, int col)
      Description copied from class: ZMatrixD1
      Returns the internal array index for the specified row and column.
      Specified by:
      getIndex in class ZMatrixD1
      Parameters:
      row - Row index.
      col - Column index.
      Returns:
      Internal array index.
    • reshape

      public void reshape​(int numRows, int numCols)
      Description copied from interface: ReshapeMatrix
      Equivalent to invoking reshape(numRows,numCols,false);
      Parameters:
      numRows - The new number of rows in the matrix.
      numCols - The new number of columns in the matrix.
    • get

      public void get​(int row, int col, Complex_F64 output)
      Description copied from interface: ZMatrix
      Returns the complex value of the matrix's element
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      output - Storage for the complex number
    • set

      public void set​(int row, int col, double real, double imaginary)
      Description copied from interface: ZMatrix
      Set's the complex value of the matrix's element
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      real - The real component
      imaginary - The imaginary component
    • getReal

      public double getReal​(int element)
    • getImag

      public double getImag​(int element)
    • getReal

      public double getReal​(int row, int col)
      Description copied from interface: ZMatrix
      Returns the real component of the matrix's element.
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      Returns:
      The specified element's value.
    • setReal

      public void setReal​(int row, int col, double val)
      Description copied from interface: ZMatrix
      Sets the real component of the matrix's element.
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      val - The element's new value.
    • getImag

      public double getImag​(int row, int col)
      Description copied from interface: ZMatrix
      Returns the imaginary component of the matrix's element.
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      Returns:
      The specified element's value.
    • setImag

      public void setImag​(int row, int col, double val)
      Description copied from interface: ZMatrix
      Sets the imaginary component of the matrix's element.
      Parameters:
      row - Matrix element's row index..
      col - Matrix element's column index.
      val - The element's new value.
    • getDataLength

      public int getDataLength()
      Description copied from interface: ZMatrix
      Returns the number of elements in the internal data array
      Returns:
      Number of elements in the data array.
    • setTo

      public void setTo​(ZMatrixRMaj original)
    • copy

      public ZMatrixRMaj copy()
      Description copied from interface: Matrix
      Creates an exact copy of the matrix
    • setTo

      public void setTo​(Matrix original)
      Description copied from interface: Matrix
      Sets this matrix to be identical to the 'original' matrix passed in.
    • print

      public void print()
      Description copied from interface: Matrix
      Prints the matrix to standard out using standard formatting. This is the same as calling print("%e")
    • print

      public void print​(String format)
      Description copied from interface: Matrix
      Prints the matrix to standard out with the specified formatting.
      Parameters:
      format - printf style formatting for a float. E.g. "%f"
      See Also:
      Formatter
    • getRowStride

      public int getRowStride()
      Number of array elements in the matrix's row.
    • setTo

      public void setTo​(int numRows, int numCols, boolean rowMajor, double... data)
      Sets this matrix equal to the matrix encoded in the array.
      Parameters:
      numRows - The number of rows.
      numCols - The number of columns.
      rowMajor - If the array is encoded in a row-major or a column-major format.
      data - The formatted 1D array. Not modified.
    • zero

      public void zero()
      Sets all the elements in the matrix to zero
    • createLike

      public ZMatrixRMaj createLike()
      Description copied from interface: Matrix
      Creates a new matrix with the same shape as this matrix
    • create

      public ZMatrixRMaj create​(int numRows, int numCols)
      Description copied from interface: Matrix
      Creates a new matrix of the same type with the specified shape
    • getType

      public MatrixType getType()
      Description copied from interface: Matrix
      Returns the type of matrix