Class DenseFComplexMatrix1D
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.colt.matrix.AbstractMatrix
-
- cern.colt.matrix.AbstractMatrix1D
-
- cern.colt.matrix.tfcomplex.FComplexMatrix1D
-
- cern.colt.matrix.tfcomplex.impl.DenseFComplexMatrix1D
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class DenseFComplexMatrix1D extends FComplexMatrix1D
Dense 1-d matrix (aka vector) holding complex elements.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).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods 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.FComplexMatrix1Dassign(FComplexFComplexFunction function)Assigns the result of a function to each cell;FComplexMatrix1Dassign(FComplexMatrix1D source)Replaces all cell values of the receiver with the values of another matrix.FComplexMatrix1Dassign(FComplexMatrix1D y, FComplexFComplexFComplexFunction function)Assigns the result of a function to each cell;FComplexMatrix1Dassign(FComplexProcedure cond, FComplexFComplexFunction function)Assigns the result of a function to all cells that satisfy a condition.FComplexMatrix1Dassign(FComplexProcedure cond, float[] value)Assigns a value to all cells that satisfy a condition.FComplexMatrix1Dassign(FComplexRealFunction function)Assigns the result of a function to the real part of the receiver.FComplexMatrix1Dassign(float[] values)Sets all cells to the state specified by values.FComplexMatrix1Dassign(float re, float im)Sets all cells to the state specified by re and im.FComplexMatrix1DassignImaginary(FloatMatrix1D other)Replaces imaginary part of the receiver with the values of another real matrix.FComplexMatrix1DassignReal(FloatMatrix1D other)Replaces real part of the receiver with the values of another real matrix.float[]elements()Returns the elements of this matrix.voidfft()Computes the discrete Fourier transform (DFT) of this matrix.FloatMatrix1DgetImaginaryPart()Returns the imaginary part of this matrixvoidgetNonZeros(IntArrayList indexList, java.util.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.FloatMatrix1DgetRealPart()Returns the real part of this matrixvoidifft(boolean scale)Computes the inverse of the discrete Fourier transform (IDFT) of this matrix.longindex(int rank)Returns the position of the element with the given relative rank within the (virtual or non-virtual) internal 1-dimensional array.FComplexMatrix1Dlike(int size)Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size.FComplexMatrix2Dlike2D(int rows, int columns)Construct and returns a new 2-d matrix of the corresponding dynamic type, entirely independent of the receiver.FComplexMatrix2Dreshape(int rows, int columns)Returns new FloatMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.FComplexMatrix3Dreshape(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.voidsetQuick(int index, float[] value)Sets the matrix cell at coordinate index to the specified value.voidsetQuick(int index, float re, float im)Sets the matrix cell at coordinate index to the specified value.voidswap(FComplexMatrix1D other)Swaps each element this[i] with other[i].voidtoArray(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.-
Methods inherited from class cern.colt.matrix.tfcomplex.FComplexMatrix1D
cardinality, copy, equals, equals, get, like, set, set, toArray, toString, toString, viewFlip, viewPart, viewSelection, viewSelection, viewStrides, zDotProduct, zDotProduct
-
Methods inherited from class cern.colt.matrix.AbstractMatrix1D
checkSize, size, stride, toStringShort
-
Methods inherited from class cern.colt.matrix.AbstractMatrix
ensureCapacity, isView, trimToSize
-
Methods inherited from class cern.colt.PersistentObject
clone
-
-
-
-
Constructor Detail
-
DenseFComplexMatrix1D
public DenseFComplexMatrix1D(float[] values)
Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa. Due to the fact that complex data is represented by 2 float values in sequence: the real and imaginary parts, the size of new matrix will be equal to values.length / 2.- Parameters:
values- The values to be filled into the new matrix.
-
DenseFComplexMatrix1D
public 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.- Parameters:
realPart- a real matrix whose elements become a real part of this matrix- Throws:
java.lang.IllegalArgumentException- if size<0.
-
DenseFComplexMatrix1D
public DenseFComplexMatrix1D(int size)
Constructs a matrix with a given number of cells. All entries are initially 0.- Parameters:
size- the number of cells the matrix shall have.- Throws:
java.lang.IllegalArgumentException- if size<0.
-
DenseFComplexMatrix1D
public DenseFComplexMatrix1D(int size, float[] elements, int zero, int stride, boolean isNoView)Constructs a matrix with the given parameters.- Parameters:
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 constructed- Throws:
java.lang.IllegalArgumentException- if size<0.
-
-
Method Detail
-
aggregate
public float[] aggregate(FComplexFComplexFComplexFunction aggr, FComplexFComplexFunction f)
Description copied from class:FComplexMatrix1DApplies a function to each cell and aggregates the results.- Overrides:
aggregatein classFComplexMatrix1D- Parameters:
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.- Returns:
- the aggregated measure.
- See Also:
FComplexFunctions
-
aggregate
public float[] aggregate(FComplexMatrix1D other, FComplexFComplexFComplexFunction aggr, FComplexFComplexFComplexFunction f)
Description copied from class:FComplexMatrix1DApplies a function to each corresponding cell of two matrices and aggregates the results.- Overrides:
aggregatein classFComplexMatrix1D- Parameters:
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.- Returns:
- the aggregated measure.
- See Also:
FComplexFunctions
-
assign
public FComplexMatrix1D assign(FComplexFComplexFunction function)
Description copied from class:FComplexMatrix1DAssigns the result of a function to each cell;- Overrides:
assignin classFComplexMatrix1D- Parameters:
function- a function object taking as argument the current cell's value.- Returns:
- this (for convenience only).
- See Also:
FComplexFunctions
-
assign
public FComplexMatrix1D assign(FComplexProcedure cond, FComplexFComplexFunction function)
Description copied from class:FComplexMatrix1DAssigns the result of a function to all cells that satisfy a condition.- Overrides:
assignin classFComplexMatrix1D- Parameters:
cond- a condition.function- a function object.- Returns:
- this (for convenience only).
- See Also:
FComplexFunctions
-
assign
public FComplexMatrix1D assign(FComplexProcedure cond, float[] value)
Description copied from class:FComplexMatrix1DAssigns a value to all cells that satisfy a condition.- Overrides:
assignin classFComplexMatrix1D- Parameters:
cond- a condition.value- a value (re=value[0], im=value[1]).- Returns:
- this (for convenience only).
-
assign
public FComplexMatrix1D assign(FComplexRealFunction function)
Description copied from class:FComplexMatrix1DAssigns the result of a function to the real part of the receiver. The imaginary part of the receiver is reset to zero.- Overrides:
assignin classFComplexMatrix1D- Parameters:
function- a function object taking as argument the current cell's value.- Returns:
- this (for convenience only).
- See Also:
FComplexFunctions
-
assign
public FComplexMatrix1D assign(FComplexMatrix1D source)
Description copied from class:FComplexMatrix1DReplaces all cell values of the receiver with the values of another matrix. Both matrices must have the same size. If both matrices share the same cells (as is the case if they are views derived from the same matrix) and intersect in an ambiguous way, then replaces as if using an intermediate auxiliary deep copy of other.- Overrides:
assignin classFComplexMatrix1D- Parameters:
source- the source matrix to copy from (may be identical to the receiver).- Returns:
- this (for convenience only).
-
assign
public FComplexMatrix1D assign(FComplexMatrix1D y, FComplexFComplexFComplexFunction function)
Description copied from class:FComplexMatrix1DAssigns the result of a function to each cell;- Overrides:
assignin classFComplexMatrix1D- Parameters:
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,- Returns:
- this (for convenience only).
- See Also:
FComplexFunctions
-
assign
public FComplexMatrix1D assign(float re, float im)
Description copied from class:FComplexMatrix1DSets all cells to the state specified by re and im.- Overrides:
assignin classFComplexMatrix1D- Parameters:
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.- Returns:
- this (for convenience only).
-
assign
public FComplexMatrix1D assign(float[] values)
Description copied from class:FComplexMatrix1DSets all cells to the state specified by values. values is required to have the same number of cells as the receiver. Complex data is represented by 2 float values in sequence: the real and imaginary parts, i.e. input array must be of size 2*size().The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
- Overrides:
assignin classFComplexMatrix1D- Parameters:
values- the values to be filled into the cells.- Returns:
- this (for convenience only).
-
assignImaginary
public FComplexMatrix1D assignImaginary(FloatMatrix1D other)
Description copied from class:FComplexMatrix1DReplaces imaginary part of the receiver with the values of another real matrix. The real part remains unchanged. Both matrices must have the same size.- Overrides:
assignImaginaryin classFComplexMatrix1D- Parameters:
other- the source matrix to copy from- Returns:
- this (for convenience only).
-
assignReal
public FComplexMatrix1D assignReal(FloatMatrix1D other)
Description copied from class:FComplexMatrix1DReplaces real part of the receiver with the values of another real matrix. The imaginary part remains unchanged. Both matrices must have the same size.- Overrides:
assignRealin classFComplexMatrix1D- Parameters:
other- the source matrix to copy from- Returns:
- this (for convenience only).
-
fft
public void fft()
Computes the discrete Fourier transform (DFT) of this matrix. Throws IllegalArgumentException if the size of this matrix is not a power of 2 number.
-
elements
public float[] elements()
Description copied from class:FComplexMatrix1DReturns the elements of this matrix.- Specified by:
elementsin classFComplexMatrix1D- Returns:
- the elements
-
getImaginaryPart
public FloatMatrix1D getImaginaryPart()
Description copied from class:FComplexMatrix1DReturns the imaginary part of this matrix- Specified by:
getImaginaryPartin classFComplexMatrix1D- Returns:
- the imaginary part
-
getNonZeros
public void getNonZeros(IntArrayList indexList, java.util.ArrayList<float[]> valueList)
Description copied from class:FComplexMatrix1DFills the coordinates and values of cells having non-zero values into the specified lists. Fills into the lists, starting at index 0. After this call returns the specified lists all have a new size, the number of non-zero values.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).
- Overrides:
getNonZerosin classFComplexMatrix1D- Parameters:
indexList- the list to be filled with indexes, can have any size.valueList- the list to be filled with values, can have any size.
-
getQuick
public float[] getQuick(int index)
Description copied from class:FComplexMatrix1DReturns the matrix cell value at coordinate index.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().
- Specified by:
getQuickin classFComplexMatrix1D- Parameters:
index- the index of the cell.- Returns:
- the value of the specified cell.
-
getRealPart
public FloatMatrix1D getRealPart()
Description copied from class:FComplexMatrix1DReturns the real part of this matrix- Specified by:
getRealPartin classFComplexMatrix1D- Returns:
- the real part
-
ifft
public void ifft(boolean scale)
Computes the inverse of the discrete Fourier transform (IDFT) of this matrix. Throws IllegalArgumentException if the size of this matrix is not a power of 2 number.- Parameters:
scale- if true, then scaling is performed.
-
like
public FComplexMatrix1D like(int size)
Description copied from class:FComplexMatrix1DConstruct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size. For example, if the receiver is an instance of type DenseFComplexMatrix1D the new matrix must also be of type DenseFComplexMatrix1D. In general, the new matrix should have internal parametrization as similar as possible.- Specified by:
likein classFComplexMatrix1D- Parameters:
size- the number of cell the matrix shall have.- Returns:
- a new empty matrix of the same dynamic type.
-
like2D
public FComplexMatrix2D like2D(int rows, int columns)
Description copied from class:FComplexMatrix1DConstruct and returns a new 2-d matrix of the corresponding dynamic type, entirely independent of the receiver. For example, if the receiver is an instance of type DenseFComplexMatrix1D the new matrix must be of type DenseFComplexMatrix2D.- Specified by:
like2Din classFComplexMatrix1D- Parameters:
rows- the number of rows the matrix shall have.columns- the number of columns the matrix shall have.- Returns:
- a new matrix of the corresponding dynamic type.
-
reshape
public FComplexMatrix2D reshape(int rows, int columns)
Description copied from class:FComplexMatrix1DReturns new FloatMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.- Specified by:
reshapein classFComplexMatrix1D- Parameters:
rows- number of rowscolumns- number of columns- Returns:
- new 2D matrix with columns being the elements of this matrix.
-
reshape
public FComplexMatrix3D reshape(int slices, int rows, int columns)
Description copied from class:FComplexMatrix1DReturns new FloatMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.- Specified by:
reshapein classFComplexMatrix1Drows- number of rowscolumns- number of columns- Returns:
- new 2D matrix with columns being the elements of this matrix.
-
setQuick
public void setQuick(int index, float re, float im)Description copied from class:FComplexMatrix1DSets the matrix cell at coordinate index to the specified value.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().
- Specified by:
setQuickin classFComplexMatrix1D- Parameters:
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.
-
setQuick
public void setQuick(int index, float[] value)Description copied from class:FComplexMatrix1DSets the matrix cell at coordinate index to the specified value.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().
- Specified by:
setQuickin classFComplexMatrix1D- Parameters:
index- the index of the cell.value- the value to be filled into the specified cell (re=value[0], im=value[1]).
-
swap
public void swap(FComplexMatrix1D other)
Description copied from class:FComplexMatrix1DSwaps each element this[i] with other[i].- Overrides:
swapin classFComplexMatrix1D
-
toArray
public void toArray(float[] values)
Description copied from class:FComplexMatrix1DFills the cell values into the specified 1-dimensional array. The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa. After this call returns the array values has the form
for (int i = 0; i < size; i++) { tmp = getQuick(i); values[2 * i] = tmp[0]; //real part values[2 * i + 1] = tmp[1]; //imaginary part }- Overrides:
toArrayin classFComplexMatrix1D
-
zDotProduct
public float[] zDotProduct(FComplexMatrix1D y, int from, int length)
Description copied from class:FComplexMatrix1DReturns the dot product of two vectors x and y. Operates on cells at indexes from .. Min(size(),y.size(),from+length)-1.- Overrides:
zDotProductin classFComplexMatrix1D- Parameters:
y- the second vector.from- the first index to be considered.length- the number of cells to be considered.- Returns:
- the sum of products; zero if from<0 || length<0.
-
zSum
public float[] zSum()
Description copied from class:FComplexMatrix1DReturns the sum of all cells.- Overrides:
zSumin classFComplexMatrix1D- Returns:
- the sum.
-
index
public long index(int rank)
Description copied from class:AbstractMatrix1DReturns the position of the element with the given relative rank within the (virtual or non-virtual) internal 1-dimensional array. You may want to override this method for performance.- Overrides:
indexin classAbstractMatrix1D- Parameters:
rank- the rank of the element.
-
-
DMelt 3.0 © DataMelt by jWork.ORG