Parallel Colt 0.7.2

cern.colt.matrix.tdcomplex.impl
Class SparseDComplexMatrix3D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.AbstractMatrix
          extended by cern.colt.matrix.AbstractMatrix3D
              extended by cern.colt.matrix.tdcomplex.DComplexMatrix3D
                  extended by cern.colt.matrix.tdcomplex.impl.SparseDComplexMatrix3D
All Implemented Interfaces:
Serializable, Cloneable

public class SparseDComplexMatrix3D
extends DComplexMatrix3D

Sparse hashed 3-d matrix 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
SparseDComplexMatrix3D(double[][][] values)
          Constructs a matrix with a copy of the given values.
SparseDComplexMatrix3D(int slices, int rows, int columns)
          Constructs a matrix with a given number of slices, rows and columns and default memory usage.
 
Method Summary
 DComplexMatrix3D assign(double[] value)
          Sets all cells to the state specified by value.
 int cardinality()
          Returns the number of cells having non-zero values.
 ConcurrentHashMap<Integer,double[]> elements()
          Returns the elements of this matrix.
 DoubleMatrix3D getImaginaryPart()
          Returns the imaginary part of this matrix
 double[] getQuick(int slice, int row, int column)
          Returns the matrix cell value at coordinate [slice,row,column].
 DoubleMatrix3D getRealPart()
          Returns the real part of this matrix
 long index(int slice, int row, int column)
          Returns the position of the given coordinate within the (virtual or non-virtual) internal 1-dimensional array.
 DComplexMatrix3D like(int slices, int rows, int columns)
          Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of slices, rows and columns.
 void setQuick(int slice, int row, int column, double[] value)
          Sets the matrix cell at coordinate [slice,row,column] to the specified value.
 void setQuick(int slice, int row, int column, double re, double im)
          Sets the matrix cell at coordinate [slice,row,column] to the specified value.
 DComplexMatrix1D vectorize()
          Returns a vector obtained by stacking the columns of each slice of the matrix on top of one another.
 
Methods inherited from class cern.colt.matrix.tdcomplex.DComplexMatrix3D
aggregate, aggregate, assign, assign, assign, assign, assign, assign, assign, assign, assignImaginary, assignReal, copy, equals, equals, get, getNonZeros, like, set, toArray, toString, toString, viewColumn, viewColumnFlip, viewDice, viewPart, viewRow, viewRowFlip, viewSelection, viewSelection, viewSlice, viewSliceFlip, viewStrides, zSum
 
Methods inherited from class cern.colt.matrix.AbstractMatrix3D
checkShape, checkShape, columns, columnStride, rows, rowStride, size, slices, sliceStride, 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

SparseDComplexMatrix3D

public SparseDComplexMatrix3D(double[][][] values)
Constructs a matrix with a copy of the given values. values is required to have the form values[slice][row][column] and have exactly the same number of rows in in every slice and exactly the same number of columns in in every row.

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.
Throws:
IllegalArgumentException - if for any 1 <= slice < values.length: values[slice].length != values[slice-1].length .
IllegalArgumentException - if for any 1 <= row < values[0].length: values[slice][row].length != values[slice][row-1].length .

SparseDComplexMatrix3D

public SparseDComplexMatrix3D(int slices,
                              int rows,
                              int columns)
Constructs a matrix with a given number of slices, rows and columns and default memory usage.

Parameters:
slices - the number of slices the matrix shall have.
rows - the number of rows the matrix shall have.
columns - the number of columns the matrix shall have.
Throws:
IllegalArgumentException - if (double)slices*columns*rows > Integer.MAX_VALUE.
IllegalArgumentException - if slices<0 || rows<0 || columns<0.
Method Detail

assign

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

Overrides:
assign in class DComplexMatrix3D
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 DComplexMatrix3D
Returns:
the number of cells having non-zero values.

getQuick

public double[] getQuick(int slice,
                         int row,
                         int column)
Returns the matrix cell value at coordinate [slice,row,column].

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): slice<0 || slice>=slices() || row<0 || row>=rows() || column<0 || column>=column().

Specified by:
getQuick in class DComplexMatrix3D
Parameters:
slice - the index of the slice-coordinate.
row - the index of the row-coordinate.
column - the index of the column-coordinate.
Returns:
the value at the specified coordinate.

elements

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

Specified by:
elements in class DComplexMatrix3D
Returns:
the elements

index

public long index(int slice,
                  int row,
                  int column)
Returns the position of the given coordinate within the (virtual or non-virtual) internal 1-dimensional array.

Overrides:
index in class AbstractMatrix3D
Parameters:
slice - the index of the slice-coordinate.
row - the index of the row-coordinate.
column - the index of the third-coordinate.

like

public DComplexMatrix3D like(int slices,
                             int rows,
                             int columns)
Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of slices, rows and columns. For example, if the receiver is an instance of type DenseComplexMatrix3D the new matrix must also be of type DenseComplexMatrix3D, if the receiver is an instance of type SparseComplexMatrix3D the new matrix must also be of type SparseComplexMatrix3D, etc. In general, the new matrix should have internal parametrization as similar as possible.

Specified by:
like in class DComplexMatrix3D
Parameters:
slices - the number of slices the matrix shall have.
rows - the number of rows the matrix shall have.
columns - the number of columns the matrix shall have.
Returns:
a new empty matrix of the same dynamic type.

setQuick

public void setQuick(int slice,
                     int row,
                     int column,
                     double[] value)
Sets the matrix cell at coordinate [slice,row,column] 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): slice<0 || slice>=slices() || row<0 || row>=rows() || column<0 || column>=column().

Specified by:
setQuick in class DComplexMatrix3D
Parameters:
slice - the index of the slice-coordinate.
row - the index of the row-coordinate.
column - the index of the column-coordinate.
value - the value to be filled into the specified cell.

setQuick

public void setQuick(int slice,
                     int row,
                     int column,
                     double re,
                     double im)
Sets the matrix cell at coordinate [slice,row,column] 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): slice<0 || slice>=slices() || row<0 || row>=rows() || column<0 || column>=column().

Specified by:
setQuick in class DComplexMatrix3D
Parameters:
slice - the index of the slice-coordinate.
row - the index of the row-coordinate.
column - the index of the column-coordinate.
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.

vectorize

public DComplexMatrix1D vectorize()
Returns a vector obtained by stacking the columns of each slice of the matrix on top of one another.

Specified by:
vectorize in class DComplexMatrix3D
Returns:
a vector obtained by stacking the columns of each slice of the matrix on top of one another

getImaginaryPart

public DoubleMatrix3D getImaginaryPart()
Returns the imaginary part of this matrix

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

getRealPart

public DoubleMatrix3D getRealPart()
Returns the real part of this matrix

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

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage