Package org.ejml.data
Class CMatrixRMaj
- java.lang.Object
-
- org.ejml.data.CMatrixD1
-
- org.ejml.data.CMatrixRMaj
-
- All Implemented Interfaces:
java.io.Serializable,CMatrix,Matrix,ReshapeMatrix
public class CMatrixRMaj extends CMatrixD1
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
-
-
Constructor Summary
Constructors Constructor Description CMatrixRMaj(float[][] data)Creates a matrix with the values and shape defined by the 2D array 'data'.CMatrixRMaj(int numRows, int numCols)Creates a new matrix with the specified number of rows and columnsCMatrixRMaj(int numRows, int numCols, boolean rowMajor, float... data)CMatrixRMaj(CMatrixRMaj original)Creates a newCMatrixRMajwhich is a copy of the passed in matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMatrixRMajcopy()Creates an exact copy of the matrixCMatrixRMajcreate(int numRows, int numCols)Creates a new matrix of the same type with the specified shapeCMatrixRMajcreateLike()Creates a new matrix with the same shape as this matrixvoidget(int row, int col, Complex_F32 output)Returns the complex value of the matrix's elementintgetDataLength()Returns the number of elements in the internal data arrayfloatgetImag(int element)floatgetImag(int row, int col)Returns the imaginary component of the matrix's element.intgetIndex(int row, int col)Returns the internal array index for the specified row and column.floatgetReal(int element)floatgetReal(int row, int col)Returns the real component of the matrix's element.intgetRowStride()Number of array elements in the matrix's row.MatrixTypegetType()Returns the type of matrixvoidprint()Prints the matrix to standard out using standard formatting.voidprint(java.lang.String format)Prints the matrix to standard out with the specified formatting.voidreshape(int numRows, int numCols)Equivalent to invoking reshape(numRows,numCols,false);voidset(int numRows, int numCols, boolean rowMajor, float... data)Sets this matrix equal to the matrix encoded in the array.voidset(int row, int col, float real, float imaginary)Set's the complex value of the matrix's elementvoidset(CMatrixRMaj original)voidset(Matrix original)Sets this matrix to be identical to the 'original' matrix passed in.voidsetImag(int row, int col, float val)Sets the imaginary component of the matrix's element.voidsetReal(int row, int col, float val)Sets the real component of the matrix's element.voidzero()Sets all the elements in the matrix to zero-
Methods inherited from class org.ejml.data.CMatrixD1
getData, getNumCols, getNumElements, getNumRows, set, setData, setNumCols, setNumRows
-
-
-
-
Constructor Detail
-
CMatrixRMaj
public CMatrixRMaj(float[][] 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.
-
CMatrixRMaj
public CMatrixRMaj(int numRows, int numCols, boolean rowMajor, float... data)
-
CMatrixRMaj
public CMatrixRMaj(CMatrixRMaj original)
Creates a newCMatrixRMajwhich is a copy of the passed in matrix.- Parameters:
original- Matrix which is to be copied
-
CMatrixRMaj
public CMatrixRMaj(int numRows, int numCols)Creates a new matrix with the specified number of rows and columns- Parameters:
numRows- number of rowsnumCols- number of columns
-
-
Method Detail
-
getIndex
public int getIndex(int row, int col)Description copied from class:CMatrixD1Returns the internal array index for the specified row and column.
-
reshape
public void reshape(int numRows, int numCols)Description copied from interface:ReshapeMatrixEquivalent 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_F32 output)Description copied from interface:CMatrixReturns 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, float real, float imaginary)Description copied from interface:CMatrixSet'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 componentimaginary- The imaginary component
-
getReal
public float getReal(int element)
-
getImag
public float getImag(int element)
-
getReal
public float getReal(int row, int col)Description copied from interface:CMatrixReturns 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, float val)Description copied from interface:CMatrixSets 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 float getImag(int row, int col)Description copied from interface:CMatrixReturns 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, float val)Description copied from interface:CMatrixSets 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:CMatrixReturns the number of elements in the internal data array- Returns:
- Number of elements in the data array.
-
set
public void set(CMatrixRMaj original)
-
copy
public CMatrixRMaj copy()
Description copied from interface:MatrixCreates an exact copy of the matrix
-
set
public void set(Matrix original)
Description copied from interface:MatrixSets this matrix to be identical to the 'original' matrix passed in.
-
print
public void print()
Description copied from interface:MatrixPrints the matrix to standard out using standard formatting. This is the same as calling print("%e")
-
print
public void print(java.lang.String format)
Description copied from interface:MatrixPrints 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.
-
set
public void set(int numRows, int numCols, boolean rowMajor, float... 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 CMatrixRMaj createLike()
Description copied from interface:MatrixCreates a new matrix with the same shape as this matrix
-
create
public CMatrixRMaj create(int numRows, int numCols)
Description copied from interface:MatrixCreates a new matrix of the same type with the specified shape
-
getType
public MatrixType getType()
Description copied from interface:MatrixReturns the type of matrix
-
-