cern.colt.matrix
Class ObjectFactory1D

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

public class ObjectFactory1D
extends PersistentObject

Factory for convenient construction of 1-d matrices holding Object cells. Use idioms like ObjectFactory1D.dense.make(1000) to construct dense matrices, ObjectFactory1D.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:

ObjectFactory1D F = ObjectFactory1D.dense;
F.make(1000);
...

Author:
wolfgang.hoschek@cern.ch
See Also:
Serialized Form

Field Summary
static ObjectFactory1D dense
          A factory producing dense matrices.
static ObjectFactory1D sparse
          A factory producing sparse matrices.
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
protected ObjectFactory1D()
          Makes this class non instantiable, but still let's others inherit from it.
 
Method Summary
 ObjectMatrix1D append(ObjectMatrix1D A, ObjectMatrix1D B)
          C = A||B; Constructs a new matrix which is the concatenation of two other matrices.
 ObjectMatrix1D make(int size)
          Constructs a matrix with the given shape, each cell initialized with zero.
 ObjectMatrix1D make(int size, java.lang.Object initialValue)
          Constructs a matrix with the given shape, each cell initialized with the given value.
 ObjectMatrix1D make(java.lang.Object[] values)
          Constructs a matrix with the given cell values.
 ObjectMatrix1D make(ObjectArrayList values)
          Constructs a matrix from the values of the given list.
 ObjectMatrix1D make(ObjectMatrix1D[] parts)
          Constructs a matrix which is the concatenation of all given parts.
 ObjectMatrix1D repeat(ObjectMatrix1D A, int repeat)
          C = A||A||..||A; Constructs a new matrix which is concatenated repeat times.
 ObjectArrayList toList(ObjectMatrix1D values)
          Constructs a list from the given matrix.
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dense

public static final ObjectFactory1D dense
A factory producing dense matrices.


sparse

public static final ObjectFactory1D sparse
A factory producing sparse matrices.

Constructor Detail

ObjectFactory1D

protected ObjectFactory1D()
Makes this class non instantiable, but still let's others inherit from it.

Method Detail

append

public ObjectMatrix1D append(ObjectMatrix1D A,
                             ObjectMatrix1D 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 ObjectMatrix1D make(ObjectMatrix1D[] parts)
Constructs a matrix which is the concatenation of all given parts. Cells are copied.


make

public ObjectMatrix1D make(java.lang.Object[] 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 ObjectMatrix1D make(int size)
Constructs a matrix with the given shape, each cell initialized with zero.


make

public ObjectMatrix1D make(int size,
                           java.lang.Object initialValue)
Constructs a matrix with the given shape, each cell initialized with the given value.


make

public ObjectMatrix1D make(ObjectArrayList 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.

repeat

public ObjectMatrix1D repeat(ObjectMatrix1D A,
                             int repeat)
C = A||A||..||A; Constructs a new matrix which is concatenated repeat times. Example:
0 1
repeat(3) -->
0 1 0 1 0 1


toList

public ObjectArrayList toList(ObjectMatrix1D 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.