Parallel Colt 0.7.2

cern.colt.matrix.tdcomplex
Class DComplexFactory1D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.tdcomplex.DComplexFactory1D
All Implemented Interfaces:
Serializable, Cloneable

public class DComplexFactory1D
extends PersistentObject

Factory for convenient construction of 1-d matrices holding complex cells. Use idioms like ComplexFactory1D.dense.make(1000) to construct dense matrices, ComplexFactory1D.sparse.make(1000) to construct sparse matrices. If the factory is used frequently it might be useful to streamline the notation. For example by aliasing:

  ComplexFactory1D F = ComplexFactory1D.dense;
  F.make(1000);
  F.random(3);
  ...
 

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

Field Summary
static DComplexFactory1D dense
          A factory producing dense matrices.
static DComplexFactory1D sparse
          A factory producing sparse matrices.
 
Method Summary
 DComplexMatrix1D append(DComplexMatrix1D A, DComplexMatrix1D B)
          C = A||B; Constructs a new matrix which is the concatenation of two other matrices.
 DComplexMatrix1D make(ArrayList<double[]> values)
          Constructs a matrix from the values of the given list.
 DComplexMatrix1D make(DComplexMatrix1D[] parts)
          Constructs a matrix which is the concatenation of all given parts.
 DComplexMatrix1D make(double[] values)
          Constructs a matrix with the given cell values.
 DComplexMatrix1D make(int size)
          Constructs a matrix with the given shape, each cell initialized with zero.
 DComplexMatrix1D make(int size, double[] initialValue)
          Constructs a matrix with the given shape, each cell initialized with the given value.
 DComplexMatrix1D random(int size)
          Constructs a matrix with uniformly distributed values in (0,1) (exclusive).
 DComplexMatrix1D repeat(DComplexMatrix1D A, int repeat)
          C = A||A||..||A; Constructs a new matrix which is concatenated repeat times.
 DComplexMatrix1D sample(int size, double[] value, double nonZeroFraction)
          Constructs a randomly sampled matrix with the given shape.
 ArrayList<double[]> toList(DComplexMatrix1D values)
          Constructs a list from the given matrix.
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dense

public static final DComplexFactory1D dense
A factory producing dense matrices.


sparse

public static final DComplexFactory1D sparse
A factory producing sparse matrices.

Method Detail

append

public DComplexMatrix1D append(DComplexMatrix1D A,
                               DComplexMatrix1D B)
C = A||B; Constructs a new matrix which is the concatenation of two other matrices. Example: 0 1 append 3 4 --> 0 1 3 4.


make

public DComplexMatrix1D make(double[] values)
Constructs a matrix with the given cell 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.

make

public DComplexMatrix1D make(DComplexMatrix1D[] parts)
Constructs a matrix which is the concatenation of all given parts. Cells are copied.


make

public DComplexMatrix1D make(int size)
Constructs a matrix with the given shape, each cell initialized with zero.


make

public DComplexMatrix1D make(int size,
                             double[] initialValue)
Constructs a matrix with the given shape, each cell initialized with the given value.


make

public DComplexMatrix1D make(ArrayList<double[]> values)
Constructs a matrix from the values of the given list. 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.
Returns:
a new matrix.

random

public DComplexMatrix1D random(int size)
Constructs a matrix with uniformly distributed values in (0,1) (exclusive).


repeat

public DComplexMatrix1D repeat(DComplexMatrix1D A,
                               int repeat)
C = A||A||..||A; Constructs a new matrix which is concatenated repeat times.


sample

public DComplexMatrix1D sample(int size,
                               double[] value,
                               double nonZeroFraction)
Constructs a randomly sampled matrix with the given shape. Randomly picks exactly Math.round(size*nonZeroFraction) cells and initializes them to value, all the rest will be initialized to zero. Note that this is not the same as setting each cell with probability nonZeroFraction to value.

Throws:
IllegalArgumentException - if nonZeroFraction < 0 || nonZeroFraction > 1.
See Also:
DoubleRandomSampler

toList

public ArrayList<double[]> toList(DComplexMatrix1D values)
Constructs a list from the given matrix. The values are copied. So subsequent changes in values are not reflected in the list, and vice-versa.

Parameters:
values - The values to be filled into the new list.
Returns:
a new list.

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage