public class DenseFComplexMatrix1D extends FComplexMatrix1D
Internally holds one single contiguous one-dimensional array. Complex data is represented by 2 float values in sequence, i.e. elements[zero + 2 * k * stride] constitute real part and elements[zero + 2 * k * stride + 1] constitute imaginary part (k=0,...,size()-1).
Constructor and Description |
---|
DenseFComplexMatrix1D(float[] values)
Constructs a matrix with a copy of the given values.
|
DenseFComplexMatrix1D(FloatMatrix1D realPart)
Constructs a complex matrix with the same size as realPart
matrix and fills the real part of this matrix with elements of
realPart.
|
DenseFComplexMatrix1D(int size)
Constructs a matrix with a given number of cells.
|
DenseFComplexMatrix1D(int size,
float[] elements,
int zero,
int stride,
boolean isNoView)
Constructs a matrix with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
float[] |
aggregate(FComplexFComplexFComplexFunction aggr,
FComplexFComplexFunction f)
Applies a function to each cell and aggregates the results.
|
float[] |
aggregate(FComplexMatrix1D other,
FComplexFComplexFComplexFunction aggr,
FComplexFComplexFComplexFunction f)
Applies a function to each corresponding cell of two matrices and
aggregates the results.
|
FComplexMatrix1D |
assign(FComplexFComplexFunction function)
Assigns the result of a function to each cell;
|
FComplexMatrix1D |
assign(FComplexMatrix1D source)
Replaces all cell values of the receiver with the values of another
matrix.
|
FComplexMatrix1D |
assign(FComplexMatrix1D y,
FComplexFComplexFComplexFunction function)
Assigns the result of a function to each cell;
|
FComplexMatrix1D |
assign(FComplexProcedure cond,
FComplexFComplexFunction function)
Assigns the result of a function to all cells that satisfy a condition.
|
FComplexMatrix1D |
assign(FComplexProcedure cond,
float[] value)
Assigns a value to all cells that satisfy a condition.
|
FComplexMatrix1D |
assign(FComplexRealFunction function)
Assigns the result of a function to the real part of the receiver.
|
FComplexMatrix1D |
assign(float[] values)
Sets all cells to the state specified by values.
|
FComplexMatrix1D |
assign(float re,
float im)
Sets all cells to the state specified by re and im.
|
FComplexMatrix1D |
assignImaginary(FloatMatrix1D other)
Replaces imaginary part of the receiver with the values of another real
matrix.
|
FComplexMatrix1D |
assignReal(FloatMatrix1D other)
Replaces real part of the receiver with the values of another real
matrix.
|
float[] |
elements()
Returns the elements of this matrix.
|
void |
fft()
Computes the discrete Fourier transform (DFT) of this matrix.
|
FloatMatrix1D |
getImaginaryPart()
Returns the imaginary part of this matrix
|
void |
getNonZeros(IntArrayList indexList,
ArrayList<float[]> valueList)
Fills the coordinates and values of cells having non-zero values into the
specified lists.
|
float[] |
getQuick(int index)
Returns the matrix cell value at coordinate index.
|
FloatMatrix1D |
getRealPart()
Returns the real part of this matrix
|
void |
ifft(boolean scale)
Computes the inverse of the discrete Fourier transform (IDFT) of this
matrix.
|
long |
index(int rank)
Returns the position of the element with the given relative rank within
the (virtual or non-virtual) internal 1-dimensional array.
|
FComplexMatrix1D |
like(int size)
Construct and returns a new empty matrix of the same dynamic type
as the receiver, having the specified size.
|
FComplexMatrix2D |
like2D(int rows,
int columns)
Construct and returns a new 2-d matrix of the corresponding dynamic
type, entirely independent of the receiver.
|
FComplexMatrix2D |
reshape(int rows,
int columns)
Returns new FloatMatrix2D of size rows x columns whose elements are taken
column-wise from this matrix.
|
FComplexMatrix3D |
reshape(int slices,
int rows,
int columns)
Returns new FloatMatrix3D of size slices x rows x columns, whose elements
are taken column-wise from this matrix.
|
void |
setQuick(int index,
float[] value)
Sets the matrix cell at coordinate index to the specified value.
|
void |
setQuick(int index,
float re,
float im)
Sets the matrix cell at coordinate index to the specified value.
|
void |
swap(FComplexMatrix1D other)
Swaps each element this[i] with other[i].
|
void |
toArray(float[] values)
Fills the cell values into the specified 1-dimensional array.
|
float[] |
zDotProduct(FComplexMatrix1D y,
int from,
int length)
Returns the dot product of two vectors x and y.
|
float[] |
zSum()
Returns the sum of all cells.
|
cardinality, copy, equals, equals, get, like, set, set, toArray, toString, toString, viewFlip, viewPart, viewSelection, viewSelection, viewStrides, zDotProduct, zDotProduct
checkSize, size, stride, toStringShort
ensureCapacity, isView, trimToSize
clone
public DenseFComplexMatrix1D(float[] values)
values
- The values to be filled into the new matrix.public DenseFComplexMatrix1D(FloatMatrix1D realPart)
realPart
- a real matrix whose elements become a real part of this matrixIllegalArgumentException
- if size<0.public DenseFComplexMatrix1D(int size)
size
- the number of cells the matrix shall have.IllegalArgumentException
- if size<0.public DenseFComplexMatrix1D(int size, float[] elements, int zero, int stride, boolean isNoView)
size
- the number of cells the matrix shall have.elements
- the cells.zero
- the index of the first element.stride
- the number of indexes between any two elements, i.e.
index(i+1)-index(i).isNoView
- if false then the view is constructedIllegalArgumentException
- if size<0.public float[] aggregate(FComplexFComplexFComplexFunction aggr, FComplexFComplexFunction f)
FComplexMatrix1D
aggregate
in class FComplexMatrix1D
aggr
- an aggregation function taking as first argument the current
aggregation and as second argument the transformed current
cell value.f
- a function transforming the current cell value.FComplexFunctions
public float[] aggregate(FComplexMatrix1D other, FComplexFComplexFComplexFunction aggr, FComplexFComplexFComplexFunction f)
FComplexMatrix1D
aggregate
in class FComplexMatrix1D
other
- the secondary matrix to operate on.aggr
- an aggregation function taking as first argument the current
aggregation and as second argument the transformed current
cell values.f
- a function transforming the current cell values.FComplexFunctions
public FComplexMatrix1D assign(FComplexFComplexFunction function)
FComplexMatrix1D
assign
in class FComplexMatrix1D
function
- a function object taking as argument the current cell's value.FComplexFunctions
public FComplexMatrix1D assign(FComplexProcedure cond, FComplexFComplexFunction function)
FComplexMatrix1D
assign
in class FComplexMatrix1D
cond
- a condition.function
- a function object.FComplexFunctions
public FComplexMatrix1D assign(FComplexProcedure cond, float[] value)
FComplexMatrix1D
assign
in class FComplexMatrix1D
cond
- a condition.value
- a value (re=value[0], im=value[1]).public FComplexMatrix1D assign(FComplexRealFunction function)
FComplexMatrix1D
assign
in class FComplexMatrix1D
function
- a function object taking as argument the current cell's value.FComplexFunctions
public FComplexMatrix1D assign(FComplexMatrix1D source)
FComplexMatrix1D
assign
in class FComplexMatrix1D
source
- the source matrix to copy from (may be identical to the
receiver).public FComplexMatrix1D assign(FComplexMatrix1D y, FComplexFComplexFComplexFunction function)
FComplexMatrix1D
assign
in class FComplexMatrix1D
y
- the secondary matrix to operate on.function
- a function object taking as first argument the current cell's
value of this, and as second argument the current
cell's value of y,FComplexFunctions
public FComplexMatrix1D assign(float re, float im)
FComplexMatrix1D
assign
in class FComplexMatrix1D
re
- the real part of the value to be filled into the cells.im
- the imaginary part of the value to be filled into the cells.public FComplexMatrix1D assign(float[] values)
FComplexMatrix1D
The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
assign
in class FComplexMatrix1D
values
- the values to be filled into the cells.public FComplexMatrix1D assignImaginary(FloatMatrix1D other)
FComplexMatrix1D
assignImaginary
in class FComplexMatrix1D
other
- the source matrix to copy frompublic FComplexMatrix1D assignReal(FloatMatrix1D other)
FComplexMatrix1D
assignReal
in class FComplexMatrix1D
other
- the source matrix to copy frompublic void fft()
public float[] elements()
FComplexMatrix1D
elements
in class FComplexMatrix1D
public FloatMatrix1D getImaginaryPart()
FComplexMatrix1D
getImaginaryPart
in class FComplexMatrix1D
public void getNonZeros(IntArrayList indexList, ArrayList<float[]> valueList)
FComplexMatrix1D
In general, fill order is unspecified. This implementation fills like: for (index = 0..size()-1) do ... . However, subclasses are free to us any other order, even an order that may change over time as cell values are changed. (Of course, result lists indexes are guaranteed to correspond to the same cell).
getNonZeros
in class FComplexMatrix1D
indexList
- the list to be filled with indexes, can have any size.valueList
- the list to be filled with values, can have any size.public float[] getQuick(int index)
FComplexMatrix1D
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): index<0 || index>=size().
getQuick
in class FComplexMatrix1D
index
- the index of the cell.public FloatMatrix1D getRealPart()
FComplexMatrix1D
getRealPart
in class FComplexMatrix1D
public void ifft(boolean scale)
scale
- if true, then scaling is performed.public FComplexMatrix1D like(int size)
FComplexMatrix1D
like
in class FComplexMatrix1D
size
- the number of cell the matrix shall have.public FComplexMatrix2D like2D(int rows, int columns)
FComplexMatrix1D
like2D
in class FComplexMatrix1D
rows
- the number of rows the matrix shall have.columns
- the number of columns the matrix shall have.public FComplexMatrix2D reshape(int rows, int columns)
FComplexMatrix1D
reshape
in class FComplexMatrix1D
rows
- number of rowscolumns
- number of columnspublic FComplexMatrix3D reshape(int slices, int rows, int columns)
FComplexMatrix1D
reshape
in class FComplexMatrix1D
rows
- number of rowscolumns
- number of columnspublic void setQuick(int index, float re, float im)
FComplexMatrix1D
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): index<0 || index>=size().
setQuick
in class FComplexMatrix1D
index
- the index of the cell.re
- the real part of the value to be filled into the specified
cell.im
- the imaginary part of the value to be filled into the
specified cell.public void setQuick(int index, float[] value)
FComplexMatrix1D
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): index<0 || index>=size().
setQuick
in class FComplexMatrix1D
index
- the index of the cell.value
- the value to be filled into the specified cell (re=value[0],
im=value[1]).public void swap(FComplexMatrix1D other)
FComplexMatrix1D
swap
in class FComplexMatrix1D
public void toArray(float[] values)
FComplexMatrix1D
toArray
in class FComplexMatrix1D
public float[] zDotProduct(FComplexMatrix1D y, int from, int length)
FComplexMatrix1D
zDotProduct
in class FComplexMatrix1D
y
- the second vector.from
- the first index to be considered.length
- the number of cells to be considered.public float[] zSum()
FComplexMatrix1D
zSum
in class FComplexMatrix1D
public long index(int rank)
AbstractMatrix1D
index
in class AbstractMatrix1D
rank
- the rank of the element.Jump to the Parallel Colt Homepage