public class DenseDComplexMatrix1D extends DComplexMatrix1D
Internally holds one single contiguous one-dimensional array. Complex data is represented by 2 double 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 |
---|
DenseDComplexMatrix1D(double[] values)
Constructs a matrix with a copy of the given values.
|
DenseDComplexMatrix1D(DoubleMatrix1D realPart)
Constructs a complex matrix with the same size as realPart
matrix and fills the real part of this matrix with elements of
realPart.
|
DenseDComplexMatrix1D(int size)
Constructs a matrix with a given number of cells.
|
DenseDComplexMatrix1D(int size,
double[] elements,
int zero,
int stride,
boolean isNoView)
Constructs a matrix with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
double[] |
aggregate(DComplexDComplexDComplexFunction aggr,
DComplexDComplexFunction f)
Applies a function to each cell and aggregates the results.
|
double[] |
aggregate(DComplexMatrix1D other,
DComplexDComplexDComplexFunction aggr,
DComplexDComplexDComplexFunction f)
Applies a function to each corresponding cell of two matrices and
aggregates the results.
|
DComplexMatrix1D |
assign(DComplexDComplexFunction function)
Assigns the result of a function to each cell;
|
DComplexMatrix1D |
assign(DComplexMatrix1D source)
Replaces all cell values of the receiver with the values of another
matrix.
|
DComplexMatrix1D |
assign(DComplexMatrix1D y,
DComplexDComplexDComplexFunction function)
Assigns the result of a function to each cell;
|
DComplexMatrix1D |
assign(DComplexProcedure cond,
DComplexDComplexFunction function)
Assigns the result of a function to all cells that satisfy a condition.
|
DComplexMatrix1D |
assign(DComplexProcedure cond,
double[] value)
Assigns a value to all cells that satisfy a condition.
|
DComplexMatrix1D |
assign(DComplexRealFunction function)
Assigns the result of a function to the real part of the receiver.
|
DComplexMatrix1D |
assign(double[] values)
Sets all cells to the state specified by values.
|
DComplexMatrix1D |
assign(double re,
double im)
Sets all cells to the state specified by re and im.
|
DComplexMatrix1D |
assignImaginary(DoubleMatrix1D other)
Replaces imaginary part of the receiver with the values of another real
matrix.
|
DComplexMatrix1D |
assignReal(DoubleMatrix1D other)
Replaces real part of the receiver with the values of another real
matrix.
|
double[] |
elements()
Returns the elements of this matrix.
|
void |
fft()
Computes the discrete Fourier transform (DFT) of this matrix.
|
DoubleMatrix1D |
getImaginaryPart()
Returns the imaginary part of this matrix
|
void |
getNonZeros(IntArrayList indexList,
ArrayList<double[]> valueList)
Fills the coordinates and values of cells having non-zero values into the
specified lists.
|
double[] |
getQuick(int index)
Returns the matrix cell value at coordinate index.
|
DoubleMatrix1D |
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.
|
DComplexMatrix1D |
like(int size)
Construct and returns a new empty matrix of the same dynamic type
as the receiver, having the specified size.
|
DComplexMatrix2D |
like2D(int rows,
int columns)
Construct and returns a new 2-d matrix of the corresponding dynamic
type, entirely independent of the receiver.
|
DComplexMatrix2D |
reshape(int rows,
int columns)
Returns new DoubleMatrix2D of size rows x columns whose elements are
taken column-wise from this matrix.
|
DComplexMatrix3D |
reshape(int slices,
int rows,
int columns)
Returns new DoubleMatrix3D of size slices x rows x columns, whose
elements are taken column-wise from this matrix.
|
void |
setQuick(int index,
double[] value)
Sets the matrix cell at coordinate index to the specified value.
|
void |
setQuick(int index,
double re,
double im)
Sets the matrix cell at coordinate index to the specified value.
|
void |
swap(DComplexMatrix1D other)
Swaps each element this[i] with other[i].
|
void |
toArray(double[] values)
Fills the cell values into the specified 1-dimensional array.
|
double[] |
zDotProduct(DComplexMatrix1D y,
int from,
int length)
Returns the dot product of two vectors x and y.
|
double[] |
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 DenseDComplexMatrix1D(double[] values)
values
- The values to be filled into the new matrix.public DenseDComplexMatrix1D(DoubleMatrix1D realPart)
realPart
- a real matrix whose elements become a real part of this matrixIllegalArgumentException
- if size<0.public DenseDComplexMatrix1D(int size)
size
- the number of cells the matrix shall have.IllegalArgumentException
- if size<0.public DenseDComplexMatrix1D(int size, double[] 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 double[] aggregate(DComplexDComplexDComplexFunction aggr, DComplexDComplexFunction f)
DComplexMatrix1D
aggregate
in class DComplexMatrix1D
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.DComplexFunctions
public double[] aggregate(DComplexMatrix1D other, DComplexDComplexDComplexFunction aggr, DComplexDComplexDComplexFunction f)
DComplexMatrix1D
aggregate
in class DComplexMatrix1D
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.DComplexFunctions
public DComplexMatrix1D assign(DComplexDComplexFunction function)
DComplexMatrix1D
assign
in class DComplexMatrix1D
function
- a function object taking as argument the current cell's value.DComplexFunctions
public DComplexMatrix1D assign(DComplexProcedure cond, DComplexDComplexFunction function)
DComplexMatrix1D
assign
in class DComplexMatrix1D
cond
- a condition.function
- a function object.DComplexFunctions
public DComplexMatrix1D assign(DComplexProcedure cond, double[] value)
DComplexMatrix1D
assign
in class DComplexMatrix1D
cond
- a condition.value
- a value (re=value[0], im=value[1]).public DComplexMatrix1D assign(DComplexRealFunction function)
DComplexMatrix1D
assign
in class DComplexMatrix1D
function
- a function object taking as argument the current cell's value.DComplexFunctions
public DComplexMatrix1D assign(DComplexMatrix1D source)
DComplexMatrix1D
assign
in class DComplexMatrix1D
source
- the source matrix to copy from (may be identical to the
receiver).public DComplexMatrix1D assign(DComplexMatrix1D y, DComplexDComplexDComplexFunction function)
DComplexMatrix1D
assign
in class DComplexMatrix1D
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,DComplexFunctions
public DComplexMatrix1D assign(double re, double im)
DComplexMatrix1D
assign
in class DComplexMatrix1D
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 DComplexMatrix1D assign(double[] values)
DComplexMatrix1D
The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
assign
in class DComplexMatrix1D
values
- the values to be filled into the cells.public DComplexMatrix1D assignImaginary(DoubleMatrix1D other)
DComplexMatrix1D
assignImaginary
in class DComplexMatrix1D
other
- the source matrix to copy frompublic DComplexMatrix1D assignReal(DoubleMatrix1D other)
DComplexMatrix1D
assignReal
in class DComplexMatrix1D
other
- the source matrix to copy frompublic void fft()
public double[] elements()
DComplexMatrix1D
elements
in class DComplexMatrix1D
public DoubleMatrix1D getImaginaryPart()
DComplexMatrix1D
getImaginaryPart
in class DComplexMatrix1D
public void getNonZeros(IntArrayList indexList, ArrayList<double[]> valueList)
DComplexMatrix1D
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 DComplexMatrix1D
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 double[] getQuick(int index)
DComplexMatrix1D
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 DComplexMatrix1D
index
- the index of the cell.public DoubleMatrix1D getRealPart()
DComplexMatrix1D
getRealPart
in class DComplexMatrix1D
public void ifft(boolean scale)
scale
- if true, then scaling is performed.public DComplexMatrix1D like(int size)
DComplexMatrix1D
like
in class DComplexMatrix1D
size
- the number of cell the matrix shall have.public DComplexMatrix2D like2D(int rows, int columns)
DComplexMatrix1D
like2D
in class DComplexMatrix1D
rows
- the number of rows the matrix shall have.columns
- the number of columns the matrix shall have.public DComplexMatrix2D reshape(int rows, int columns)
DComplexMatrix1D
reshape
in class DComplexMatrix1D
rows
- number of rowscolumns
- number of columnspublic DComplexMatrix3D reshape(int slices, int rows, int columns)
DComplexMatrix1D
reshape
in class DComplexMatrix1D
rows
- number of rowscolumns
- number of columnspublic void setQuick(int index, double re, double im)
DComplexMatrix1D
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 DComplexMatrix1D
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, double[] value)
DComplexMatrix1D
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 DComplexMatrix1D
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(DComplexMatrix1D other)
DComplexMatrix1D
swap
in class DComplexMatrix1D
public void toArray(double[] values)
DComplexMatrix1D
toArray
in class DComplexMatrix1D
public double[] zDotProduct(DComplexMatrix1D y, int from, int length)
DComplexMatrix1D
zDotProduct
in class DComplexMatrix1D
y
- the second vector.from
- the first index to be considered.length
- the number of cells to be considered.public double[] zSum()
DComplexMatrix1D
zSum
in class DComplexMatrix1D
public long index(int rank)
AbstractMatrix1D
index
in class AbstractMatrix1D
rank
- the rank of the element.Jump to the Parallel Colt Homepage