Class ObjectMatrixFactory
- java.lang.Object
-
- com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory<java.lang.Object>
-
- com.singularsys.extensions.matrix.objectmat.ObjectMatrixFactory
-
- All Implemented Interfaces:
MatrixFactoryI
,JepComponent
,java.io.Serializable
public class ObjectMatrixFactory extends GenericMatrixFactory<java.lang.Object>
An implementation of vectors and matrices where elements are Objects. To set up useMatrixFactoryI mfac = new ObjectMatrixFactory(); MatrixFieldI mf = new SimpleMatrixField(mfac); MatrixOperatorTable opTab = new MatrixOperatorTable(mfac, mf); MatrixFunctionTable mftab = new MatrixFunctionTable(mfac, mf); jep = new Jep(opTab,mftab);
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory
ONE, ZERO
-
-
Constructor Summary
Constructors Constructor Description ObjectMatrixFactory()
ObjectMatrixFactory(FieldI f)
ObjectMatrixFactory(java.lang.Object zero, java.lang.Object one)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]
buildDataArray(int len)
Build a data array.java.lang.Object[][]
buildDataArray(int rows, int cols)
Build a data array.ObjectMatrix
cast(MatrixI m)
A typical implementation will just usereturn (GenericMatrix<E>) m;
ObjectVector
cast(VectorI v)
A typical implementation will just usereturn (V) v;
java.lang.Object
elementValue(java.lang.Object o)
Convert the element o to type E.JepComponent
getLightWeightInstance()
Returns thisObjectMatrix
newMatrixUnchecked(java.lang.Object[][] data)
ObjectVector
newVectorUnchecked(java.lang.Object[] data)
-
Methods inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixFactory
getONE, identity, identity, init, newMatrix, newVector, zeroEement, zeroMat, zeroMat, zeroMat, zeroVec
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.singularsys.extensions.matrix.MatrixFactoryI
zeroVec
-
-
-
-
Constructor Detail
-
ObjectMatrixFactory
public ObjectMatrixFactory()
-
ObjectMatrixFactory
public ObjectMatrixFactory(java.lang.Object zero, java.lang.Object one)
-
ObjectMatrixFactory
public ObjectMatrixFactory(FieldI f)
-
-
Method Detail
-
buildDataArray
public java.lang.Object[][] buildDataArray(int rows, int cols)
Description copied from class:GenericMatrixFactory
Build a data array. A typical concrete implementation will just usereturn new E[rows][cols]
.- Overrides:
buildDataArray
in classGenericMatrixFactory<java.lang.Object>
- Parameters:
rows
- number of rowscols
- number of cols- Returns:
- the array.
-
buildDataArray
public java.lang.Object[] buildDataArray(int len)
Description copied from class:GenericMatrixFactory
Build a data array. A typical concrete implementation will just usereturn new E[rows][len]
.- Overrides:
buildDataArray
in classGenericMatrixFactory<java.lang.Object>
- Parameters:
len
- number of elements- Returns:
- the array.
-
elementValue
public java.lang.Object elementValue(java.lang.Object o)
Description copied from class:GenericMatrixFactory
Convert the element o to type E. A typical implementation will just usepublic abstract E elementValue(Object o) { if(o instance of E) return (E) o; return null; }
- Specified by:
elementValue
in interfaceMatrixFactoryI
- Overrides:
elementValue
in classGenericMatrixFactory<java.lang.Object>
- Parameters:
o
- value to convert- Returns:
- the value cast to type E or null if the type cannot be converted.
-
cast
public ObjectMatrix cast(MatrixI m)
Description copied from class:GenericMatrixFactory
A typical implementation will just usereturn (GenericMatrix<E>) m;
- Overrides:
cast
in classGenericMatrixFactory<java.lang.Object>
- Parameters:
m
- the matrix to cast- Returns:
- a matrix of type GenericMatrix<E> = GenericMatrix<E>
-
cast
public ObjectVector cast(VectorI v)
Description copied from class:GenericMatrixFactory
A typical implementation will just usereturn (V) v;
- Overrides:
cast
in classGenericMatrixFactory<java.lang.Object>
- Parameters:
v
- the vector to cast- Returns:
- a vector of type V = GenericVector<E>
-
newMatrixUnchecked
public ObjectMatrix newMatrixUnchecked(java.lang.Object[][] data)
- Overrides:
newMatrixUnchecked
in classGenericMatrixFactory<java.lang.Object>
-
newVectorUnchecked
public ObjectVector newVectorUnchecked(java.lang.Object[] data)
- Overrides:
newVectorUnchecked
in classGenericMatrixFactory<java.lang.Object>
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Returns this- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Overrides:
getLightWeightInstance
in classGenericMatrixFactory<java.lang.Object>
- Returns:
- either an new instance, null or 'this'.
-
-