Class SparseDComplexMatrix1D
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.colt.matrix.AbstractMatrix
-
- cern.colt.matrix.AbstractMatrix1D
-
- cern.colt.matrix.tdcomplex.DComplexMatrix1D
-
- cern.colt.matrix.tdcomplex.impl.SparseDComplexMatrix1D
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class SparseDComplexMatrix1D extends DComplexMatrix1D
Sparse hashed 1-d matrix (aka vector) holding complex elements. This implementation uses ConcurrentHashMap- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SparseDComplexMatrix1D(double[] values)Constructs a matrix with a copy of the given values.SparseDComplexMatrix1D(int size)Constructs a matrix with a given number of cells.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DComplexMatrix1Dassign(double[] value)Sets all cells to the state specified by values.intcardinality()Returns the number of cells having non-zero values; ignores tolerance.java.util.concurrent.ConcurrentHashMap<java.lang.Long,double[]>elements()Returns the elements of this matrix.DoubleMatrix1DgetImaginaryPart()Returns the imaginary part of this matrixdouble[]getQuick(int index)Returns the matrix cell value at coordinate index.DoubleMatrix1DgetRealPart()Returns the real part of this matrixlongindex(int rank)Returns the position of the element with the given relative rank within the (virtual or non-virtual) internal 1-dimensional array.DComplexMatrix1Dlike(int size)Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size.DComplexMatrix2Dlike2D(int rows, int columns)Construct and returns a new 2-d matrix of the corresponding dynamic type, entirely independent of the receiver.DComplexMatrix2Dreshape(int rows, int columns)Returns new DoubleMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.DComplexMatrix3Dreshape(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.voidsetQuick(int index, double[] value)Sets the matrix cell at coordinate index to the specified value.voidsetQuick(int index, double re, double im)Sets the matrix cell at coordinate index to the specified value.-
Methods inherited from class cern.colt.matrix.tdcomplex.DComplexMatrix1D
aggregate, aggregate, assign, assign, assign, assign, assign, assign, assign, assignImaginary, assignReal, copy, equals, equals, get, getNonZeros, like, set, set, swap, toArray, toArray, toString, toString, viewFlip, viewPart, viewSelection, viewSelection, viewStrides, zDotProduct, zDotProduct, zDotProduct, zSum
-
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
-
SparseDComplexMatrix1D
public SparseDComplexMatrix1D(double[] 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.- Parameters:
values- The values to be filled into the new matrix.
-
SparseDComplexMatrix1D
public SparseDComplexMatrix1D(int size)
Constructs a matrix with a given number of cells.- Parameters:
size- the number of cells the matrix shall have.- Throws:
java.lang.IllegalArgumentException- if size<0.
-
-
Method Detail
-
assign
public DComplexMatrix1D assign(double[] value)
Description copied from class:DComplexMatrix1DSets 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 double 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 classDComplexMatrix1D- Parameters:
value- the values to be filled into the cells.- Returns:
- this (for convenience only).
-
cardinality
public int cardinality()
Description copied from class:DComplexMatrix1DReturns the number of cells having non-zero values; ignores tolerance.- Overrides:
cardinalityin classDComplexMatrix1D- Returns:
- the number of cells having non-zero values.
-
getQuick
public double[] getQuick(int index)
Description copied from class:DComplexMatrix1DReturns 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 classDComplexMatrix1D- Parameters:
index- the index of the cell.- Returns:
- the value of the specified cell.
-
elements
public java.util.concurrent.ConcurrentHashMap<java.lang.Long,double[]> elements()
Description copied from class:DComplexMatrix1DReturns the elements of this matrix.- Specified by:
elementsin classDComplexMatrix1D- Returns:
- the elements
-
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.
-
like
public DComplexMatrix1D like(int size)
Description copied from class:DComplexMatrix1DConstruct 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 DenseDComplexMatrix1D the new matrix must also be of type DenseDComplexMatrix1D. In general, the new matrix should have internal parametrization as similar as possible.- Specified by:
likein classDComplexMatrix1D- Parameters:
size- the number of cell the matrix shall have.- Returns:
- a new empty matrix of the same dynamic type.
-
like2D
public DComplexMatrix2D like2D(int rows, int columns)
Description copied from class:DComplexMatrix1DConstruct 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 DenseDComplexMatrix1D the new matrix must be of type DenseDComplexMatrix2D.- Specified by:
like2Din classDComplexMatrix1D- 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 DComplexMatrix2D reshape(int rows, int columns)
Description copied from class:DComplexMatrix1DReturns new DoubleMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.- Specified by:
reshapein classDComplexMatrix1D- Parameters:
rows- number of rowscolumns- number of columns- Returns:
- new 2D matrix with columns being the elements of this matrix.
-
reshape
public DComplexMatrix3D reshape(int slices, int rows, int columns)
Description copied from class:DComplexMatrix1DReturns new DoubleMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.- Specified by:
reshapein classDComplexMatrix1Drows- number of rowscolumns- number of columns- Returns:
- new 2D matrix with columns being the elements of this matrix.
-
setQuick
public void setQuick(int index, double[] value)Description copied from class:DComplexMatrix1DSets 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 classDComplexMatrix1D- Parameters:
index- the index of the cell.value- the value to be filled into the specified cell (re=value[0], im=value[1]).
-
setQuick
public void setQuick(int index, double re, double im)Description copied from class:DComplexMatrix1DSets 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 classDComplexMatrix1D- 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.
-
getImaginaryPart
public DoubleMatrix1D getImaginaryPart()
Description copied from class:DComplexMatrix1DReturns the imaginary part of this matrix- Specified by:
getImaginaryPartin classDComplexMatrix1D- Returns:
- the imaginary part
-
getRealPart
public DoubleMatrix1D getRealPart()
Description copied from class:DComplexMatrix1DReturns the real part of this matrix- Specified by:
getRealPartin classDComplexMatrix1D- Returns:
- the real part
-
-
DMelt 3.0 © DataMelt by jWork.ORG