Parallel Colt 0.7.2

cern.colt.matrix.tfcomplex.impl
Class SparseFComplexMatrix1D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.AbstractMatrix
          extended by cern.colt.matrix.AbstractMatrix1D
              extended by cern.colt.matrix.tfcomplex.FComplexMatrix1D
                  extended by cern.colt.matrix.tfcomplex.impl.SparseFComplexMatrix1D
All Implemented Interfaces:
Serializable, Cloneable

public class SparseFComplexMatrix1D
extends FComplexMatrix1D

Sparse hashed 1-d matrix (aka vector) holding complex elements. Note that this implementation uses ConcurrentHashMap

Version:
1.0, 12/10/2007
Author:
Piotr Wendykier (piotr.wendykier@gmail.com)
See Also:
Serialized Form

Constructor Summary
SparseFComplexMatrix1D(float[] values)
          Constructs a matrix with a copy of the given values.
SparseFComplexMatrix1D(int size)
          Constructs a matrix with a given number of cells.
 
Method Summary
 FComplexMatrix1D assign(float[] value)
          Sets all cells to the state specified by value.
 int cardinality()
          Returns the number of cells having non-zero values.
 ConcurrentHashMap<Integer,float[]> elements()
          Returns the elements of this matrix.
 FloatMatrix1D getImaginaryPart()
          Returns the imaginary part of this matrix
 float[] getQuick(int index)
          Returns the matrix cell value at coordinate index.
 FloatMatrix1D getRealPart()
          Returns the real part 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, entirelly independent of the receiver.
 FComplexMatrix2D reshape(int rows, int cols)
          Returns new FloatMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.
 FComplexMatrix3D reshape(int slices, int rows, int cols)
          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.
 
Methods inherited from class cern.colt.matrix.tfcomplex.FComplexMatrix1D
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
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SparseFComplexMatrix1D

public SparseFComplexMatrix1D(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.

Parameters:
values - The values to be filled into the new matrix.

SparseFComplexMatrix1D

public SparseFComplexMatrix1D(int size)
Constructs a matrix with a given number of cells.

Parameters:
size - the number of cells the matrix shall have.
Throws:
IllegalArgumentException - if size<0.
Method Detail

assign

public FComplexMatrix1D assign(float[] value)
Sets all cells to the state specified by value.

Overrides:
assign in class FComplexMatrix1D
Parameters:
value - the value to be filled into the cells.
Returns:
this (for convenience only).

cardinality

public int cardinality()
Returns the number of cells having non-zero values.

Overrides:
cardinality in class FComplexMatrix1D
Returns:
the number of cells having non-zero values.

getQuick

public float[] getQuick(int index)
Returns 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:
getQuick in class FComplexMatrix1D
Parameters:
index - the index of the cell.
Returns:
the value of the specified cell.

elements

public ConcurrentHashMap<Integer,float[]> elements()
Returns the elements of this matrix.

Specified by:
elements in class FComplexMatrix1D
Returns:
the elements

index

public 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. You may want to override this method for performance.

Overrides:
index in class AbstractMatrix1D
Parameters:
rank - the rank of the element.

like

public FComplexMatrix1D like(int size)
Construct 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 DenseComplexMatrix1D the new matrix must also be of type DenseComplexMatrix1D, if the receiver is an instance of type SparseComplexMatrix1D the new matrix must also be of type SparseComplexMatrix1D, etc. In general, the new matrix should have internal parametrization as similar as possible.

Specified by:
like in class FComplexMatrix1D
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)
Construct and returns a new 2-d matrix of the corresponding dynamic type, entirelly independent of the receiver. For example, if the receiver is an instance of type DenseComplexMatrix1D the new matrix must be of type DenseComplexMatrix2D, if the receiver is an instance of type SparseComplexMatrix1D the new matrix must be of type SparseComplexMatrix2D, etc.

Specified by:
like2D in class FComplexMatrix1D
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 cols)
Description copied from class: FComplexMatrix1D
Returns new FloatMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.

Specified by:
reshape in class FComplexMatrix1D
Parameters:
rows - number of rows
cols - number of columns
Returns:
new 2D matrix with columns being the elements of this matrix.

reshape

public FComplexMatrix3D reshape(int slices,
                                int rows,
                                int cols)
Description copied from class: FComplexMatrix1D
Returns new FloatMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.

Specified by:
reshape in class FComplexMatrix1D
rows - number of rows
cols - number of columns
Returns:
new 2D matrix with columns being the elements of this matrix.

setQuick

public void setQuick(int index,
                     float[] value)
Sets 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:
setQuick in class FComplexMatrix1D
Parameters:
index - the index of the cell.
value - the value to be filled into the specified cell.

setQuick

public void setQuick(int index,
                     float re,
                     float im)
Sets 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:
setQuick in class FComplexMatrix1D
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 FloatMatrix1D getImaginaryPart()
Description copied from class: FComplexMatrix1D
Returns the imaginary part of this matrix

Specified by:
getImaginaryPart in class FComplexMatrix1D
Returns:
the imaginary part

getRealPart

public FloatMatrix1D getRealPart()
Description copied from class: FComplexMatrix1D
Returns the real part of this matrix

Specified by:
getRealPart in class FComplexMatrix1D
Returns:
the real part

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage