org.ujmp.core
Class MatrixFactory

java.lang.Object
  extended by org.ujmp.core.MatrixFactory

public abstract class MatrixFactory
extends Object

This class provides a factory for matrix generation. Use Matrix.factory.dense(rows, columns) or Matrix.factory.sparse(rows, columns) to create empty matrices.

Author:
Holger Arndt

Field Summary
static int ALL
           
static int COLUMN
           
static EmptyMatrix EMPTYMATRIX
           
static int NONE
           
static int ROW
           
static int X
           
static int Y
           
static int Z
           
 
Constructor Summary
MatrixFactory()
           
 
Method Summary
static Matrix availableProcessors()
           
static Matrix concat(int dimension, Collection<Matrix> matrices)
           
static Matrix concat(int dimension, Matrix... matrices)
           
static Matrix copyFromMatrix(Matrix matrix)
          Deprecated. Please do not use this method anymore, it will be removed. use matrix.clone() instead
static Matrix correlatedColumns(int rows, int columns, double correlationFactor)
           
static Matrix createVectorForClass(int classID, int classCount)
           
static Matrix dense(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.zeros
static Matrix dense(ValueType valueType, long... size)
           
static Matrix emptyMatrix()
           
static Matrix eye(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.eye
static Matrix eye(ValueType valueType, long... size)
           
static Matrix fibonacci(int count)
           
static Matrix fill(Object value, long... size)
           
static MatrixMapper getMatrixMapper()
           
static Matrix horCat(Collection<Matrix> matrices)
           
static Matrix horCat(Matrix... matrices)
           
static Matrix horCat(Matrix column, long columnCount)
           
static Matrix importFromArray(boolean[]... values)
           
static Matrix importFromArray(byte[]... values)
           
static Matrix importFromArray(char[]... values)
           
static Matrix importFromArray(Date[]... values)
           
static Matrix importFromArray(double[]... values)
           
static Matrix importFromArray(float[]... values)
           
static Matrix importFromArray(int[]... values)
           
static Matrix importFromArray(long[]... values)
           
static Matrix importFromArray(Object[]... values)
           
static Matrix importFromArray(short[]... values)
           
static Matrix importFromArray(String[]... values)
           
static Matrix importFromClipboard(FileFormat format, Object... parameters)
           
static Matrix importFromFile(FileFormat format, File file, Object... parameters)
           
static Matrix importFromFile(FileFormat format, String file, Object... parameters)
           
static Matrix importFromFile(File file, Object... parameters)
           
static Matrix importFromFile(String filename, Object... parameters)
           
static ObjectMatrix2D importFromJDBC(DB type, String host, int port, String database, String sqlStatement, String username, String password)
           
static ObjectMatrix2D importFromJDBC(String url, String sqlStatement, String username, String password)
           
static Matrix importFromStream(FileFormat format, InputStream stream, Object... parameters)
           
static Matrix importFromString(FileFormat format, String string, Object... parameters)
           
static Matrix importFromURL(FileFormat format, String url, Object... parameters)
           
static Matrix importFromURL(FileFormat format, URL url, Object... parameters)
           
static Matrix like(Matrix matrix)
           
static Matrix like(Matrix matrix, long... size)
           
static DenseBooleanMatrix2D linkToArray(boolean... values)
           
static DenseBooleanMatrix2D linkToArray(boolean[]... values)
           
static DenseByteMatrix2D linkToArray(byte... values)
           
static DenseByteMatrix2D linkToArray(byte[]... values)
           
static DenseCharMatrix2D linkToArray(char... values)
           
static DenseCharMatrix2D linkToArray(char[]... values)
           
static DenseDateMatrix2D linkToArray(Date... values)
           
static DenseDateMatrix2D linkToArray(Date[]... values)
           
static DenseDoubleMatrix2D linkToArray(double... values)
           
static DenseDoubleMatrix2D linkToArray(double[]... values)
           
static DenseFloatMatrix2D linkToArray(float... values)
           
static DenseFloatMatrix2D linkToArray(float[]... values)
           
static DenseIntMatrix2D linkToArray(int... values)
           
static DenseIntMatrix2D linkToArray(int[]... values)
           
static DenseLongMatrix2D linkToArray(long... values)
           
static DenseLongMatrix2D linkToArray(long[]... values)
           
static DenseObjectMatrix2D linkToArray(Object... values)
           
static DenseObjectMatrix2D linkToArray(Object[]... values)
           
static DenseShortMatrix2D linkToArray(short... values)
           
static DenseShortMatrix2D linkToArray(short[]... values)
           
static DenseStringMatrix2D linkToArray(String... values)
           
static DenseStringMatrix2D linkToArray(String[]... values)
           
static DenseDoubleMatrix linkToBinaryFile(String filename, long... size)
           
static Matrix linkToCollection(Collection<?> list)
           
static FileListMatrix linkToDir(String dir)
           
static Matrix linkToFile(FileFormat format, File file, Object... parameters)
           
static ObjectMatrix2D linkToJDBC(DB type, String host, int port, String database, String sqlStatement, String username, String password)
           
static ObjectMatrix2D linkToJDBC(String url, String sqlStatement, String username, String password)
           
static Matrix linkToMap(Map<?,?> map)
           
static DenseBooleanMatrix2D linkToValue(boolean value)
           
static DenseByteMatrix2D linkToValue(byte value)
           
static DenseCharMatrix2D linkToValue(char value)
           
static DenseDateMatrix2D linkToValue(Date value)
           
static DenseDoubleMatrix2D linkToValue(double value)
           
static DenseIntMatrix2D linkToValue(int value)
           
static DenseLongMatrix2D linkToValue(long value)
           
static Matrix linkToValue(Object value)
           
static DenseShortMatrix2D linkToValue(short value)
           
static DenseStringMatrix2D linkToValue(String value)
           
static Matrix magic(int size)
           
static Matrix memoryUsage()
           
static Matrix ones(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.ones
static Matrix ones(ValueType valueType, long... size)
           
static Matrix pascal(long... size)
           
static Matrix rand(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.rand
static Matrix rand(ValueType valueType, long... size)
           
static Matrix randn(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.rand
static Matrix randn(ValueType valueType, long... size)
           
static Matrix randomSeed()
           
static Matrix range(double start, double end)
           
static Matrix range(double start, double end, double stepSize)
           
static Matrix repmat(Matrix matrix, long... count)
           
static Matrix runningThreads()
           
static Matrix sequence(double start, double end)
           
static Matrix sequence(double start, double end, double stepsize)
           
static void setMatrixMapper(MatrixMapper matrixMapper)
           
static Matrix sparse(long... size)
          Deprecated. Please do not use this method anymore, it will be moved to SparseMatrix.factory
static Matrix sparse(Matrix indices)
           
static Matrix sparse(ValueType valueType, long... size)
           
static Matrix SUNSPOTDATASET()
           
static
<T> SynchronizedGenericMatrix<T>
synchronizedMatrix(GenericMatrix<T> matrix)
          Wraps another Matrix so that all methods are executed synchronized.
static Matrix systemEnvironment()
           
static Matrix systemProperties()
           
static Matrix systemTime()
           
static
<A> Matrix
vertCat(Collection<Matrix> matrices)
           
static
<A> Matrix
vertCat(Matrix... matrices)
           
static Matrix vertCat(Matrix row, long rowCount)
           
static Matrix welcomeMatrix()
           
static Matrix zeros(long... size)
          Deprecated. Please do not use this method anymore, it will be replaced by DenseMatrix.factory.zeros(long... size)
static Matrix zeros(ValueType valueType, long... size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROW

public static final int ROW
See Also:
Constant Field Values

COLUMN

public static final int COLUMN
See Also:
Constant Field Values

Y

public static final int Y
See Also:
Constant Field Values

X

public static final int X
See Also:
Constant Field Values

Z

public static final int Z
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

EMPTYMATRIX

public static final EmptyMatrix EMPTYMATRIX
Constructor Detail

MatrixFactory

public MatrixFactory()
Method Detail

systemTime

public static final Matrix systemTime()

availableProcessors

public static final Matrix availableProcessors()

memoryUsage

public static final Matrix memoryUsage()

range

public static final Matrix range(double start,
                                 double end,
                                 double stepSize)

range

public static final Matrix range(double start,
                                 double end)

randomSeed

public static final Matrix randomSeed()

runningThreads

public static final Matrix runningThreads()

systemEnvironment

public static final Matrix systemEnvironment()

systemProperties

public static final Matrix systemProperties()

horCat

public static final Matrix horCat(Matrix... matrices)
                           throws MatrixException
Throws:
MatrixException

vertCat

public static final <A> Matrix vertCat(Matrix... matrices)
                            throws MatrixException
Throws:
MatrixException

vertCat

public static final <A> Matrix vertCat(Collection<Matrix> matrices)
                            throws MatrixException
Throws:
MatrixException

horCat

public static final Matrix horCat(Collection<Matrix> matrices)
                           throws MatrixException
Throws:
MatrixException

concat

public static final Matrix concat(int dimension,
                                  Matrix... matrices)
                           throws MatrixException
Throws:
MatrixException

concat

public static final Matrix concat(int dimension,
                                  Collection<Matrix> matrices)
                           throws MatrixException
Throws:
MatrixException

importFromArray

public static final Matrix importFromArray(boolean[]... values)

importFromArray

public static final Matrix importFromArray(byte[]... values)

importFromArray

public static final Matrix importFromArray(char[]... values)

importFromArray

public static final Matrix importFromArray(Date[]... values)

importFromArray

public static final Matrix importFromArray(double[]... values)

importFromArray

public static final Matrix importFromArray(float[]... values)

importFromArray

public static final Matrix importFromArray(int[]... values)

importFromArray

public static final Matrix importFromArray(long[]... values)

importFromArray

public static final Matrix importFromArray(Object[]... values)

importFromArray

public static final Matrix importFromArray(short[]... values)

importFromArray

public static final Matrix importFromArray(String[]... values)

linkToArray

public static final DenseBooleanMatrix2D linkToArray(boolean[]... values)

linkToArray

public static final DenseBooleanMatrix2D linkToArray(boolean... values)

linkToArray

public static final DenseByteMatrix2D linkToArray(byte[]... values)

linkToArray

public static final DenseByteMatrix2D linkToArray(byte... values)

linkToArray

public static final DenseCharMatrix2D linkToArray(char[]... values)

linkToArray

public static final DenseCharMatrix2D linkToArray(char... values)

linkToArray

public static final DenseDateMatrix2D linkToArray(Date[]... values)

linkToArray

public static final DenseDateMatrix2D linkToArray(Date... values)

linkToArray

public static final DenseDoubleMatrix2D linkToArray(double[]... values)

linkToArray

public static final DenseDoubleMatrix2D linkToArray(double... values)

linkToArray

public static final DenseFloatMatrix2D linkToArray(float[]... values)

linkToArray

public static final DenseFloatMatrix2D linkToArray(float... values)

linkToArray

public static final DenseIntMatrix2D linkToArray(int[]... values)

linkToArray

public static final DenseIntMatrix2D linkToArray(int... values)

linkToArray

public static final DenseLongMatrix2D linkToArray(long[]... values)

linkToArray

public static final DenseLongMatrix2D linkToArray(long... values)

linkToArray

public static final DenseObjectMatrix2D linkToArray(Object[]... values)

linkToArray

public static final DenseObjectMatrix2D linkToArray(Object... values)

linkToArray

public static final DenseShortMatrix2D linkToArray(short[]... values)

linkToArray

public static final DenseShortMatrix2D linkToArray(short... values)

linkToArray

public static final DenseStringMatrix2D linkToArray(String[]... values)

linkToArray

public static final DenseStringMatrix2D linkToArray(String... values)

copyFromMatrix

public static final Matrix copyFromMatrix(Matrix matrix)
                                   throws MatrixException
Deprecated. Please do not use this method anymore, it will be removed. use matrix.clone() instead

Throws:
MatrixException

randn

public static final Matrix randn(long... size)
                          throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.rand

Throws:
MatrixException

randn

public static final Matrix randn(ValueType valueType,
                                 long... size)
                          throws MatrixException
Throws:
MatrixException

rand

public static final Matrix rand(long... size)
                         throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.rand

Throws:
MatrixException

rand

public static final Matrix rand(ValueType valueType,
                                long... size)
                         throws MatrixException
Throws:
MatrixException

correlatedColumns

public static final Matrix correlatedColumns(int rows,
                                             int columns,
                                             double correlationFactor)
                                      throws MatrixException
Throws:
MatrixException

linkToValue

public static final DenseDoubleMatrix2D linkToValue(double value)

linkToValue

public static final DenseIntMatrix2D linkToValue(int value)

linkToValue

public static final DenseCharMatrix2D linkToValue(char value)

linkToValue

public static final DenseDateMatrix2D linkToValue(Date value)

linkToValue

public static final DenseBooleanMatrix2D linkToValue(boolean value)

linkToValue

public static final DenseByteMatrix2D linkToValue(byte value)

linkToValue

public static final DenseShortMatrix2D linkToValue(short value)

linkToValue

public static final DenseStringMatrix2D linkToValue(String value)

linkToValue

public static final DenseLongMatrix2D linkToValue(long value)

linkToValue

public static final Matrix linkToValue(Object value)

zeros

public static Matrix zeros(ValueType valueType,
                           long... size)
                    throws MatrixException
Throws:
MatrixException

dense

public static Matrix dense(ValueType valueType,
                           long... size)
                    throws MatrixException
Throws:
MatrixException

ones

public static Matrix ones(long... size)
                   throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.ones

Throws:
MatrixException

fill

public static Matrix fill(Object value,
                          long... size)
                   throws MatrixException
Throws:
MatrixException

ones

public static Matrix ones(ValueType valueType,
                          long... size)
                   throws MatrixException
Throws:
MatrixException

eye

public static Matrix eye(long... size)
                  throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.eye

Throws:
MatrixException

magic

public static Matrix magic(int size)
                    throws MatrixException
Throws:
MatrixException

pascal

public static Matrix pascal(long... size)
                     throws MatrixException
Throws:
MatrixException

fibonacci

public static Matrix fibonacci(int count)
                        throws MatrixException
Throws:
MatrixException

eye

public static Matrix eye(ValueType valueType,
                         long... size)
                  throws MatrixException
Throws:
MatrixException

createVectorForClass

public static final Matrix createVectorForClass(int classID,
                                                int classCount)
                                         throws MatrixException
Throws:
MatrixException

linkToDir

public static final FileListMatrix linkToDir(String dir)

linkToMap

public static final Matrix linkToMap(Map<?,?> map)

linkToCollection

public static final Matrix linkToCollection(Collection<?> list)

importFromStream

public static Matrix importFromStream(FileFormat format,
                                      InputStream stream,
                                      Object... parameters)
                               throws MatrixException,
                                      IOException
Throws:
MatrixException
IOException

importFromURL

public static Matrix importFromURL(FileFormat format,
                                   URL url,
                                   Object... parameters)
                            throws MatrixException,
                                   IOException
Throws:
MatrixException
IOException

importFromURL

public static Matrix importFromURL(FileFormat format,
                                   String url,
                                   Object... parameters)
                            throws MatrixException,
                                   IOException
Throws:
MatrixException
IOException

importFromString

public static Matrix importFromString(FileFormat format,
                                      String string,
                                      Object... parameters)
                               throws MatrixException
Throws:
MatrixException

synchronizedMatrix

public static final <T> SynchronizedGenericMatrix<T> synchronizedMatrix(GenericMatrix<T> matrix)
Wraps another Matrix so that all methods are executed synchronized.

Parameters:
matrix - the source Matrix
Returns:
a synchronized Matrix

linkToBinaryFile

public static final DenseDoubleMatrix linkToBinaryFile(String filename,
                                                       long... size)
                                                throws IOException
Throws:
IOException

linkToJDBC

public static final ObjectMatrix2D linkToJDBC(String url,
                                              String sqlStatement,
                                              String username,
                                              String password)

linkToJDBC

public static final ObjectMatrix2D linkToJDBC(DB type,
                                              String host,
                                              int port,
                                              String database,
                                              String sqlStatement,
                                              String username,
                                              String password)

importFromJDBC

public static final ObjectMatrix2D importFromJDBC(String url,
                                                  String sqlStatement,
                                                  String username,
                                                  String password)

importFromJDBC

public static final ObjectMatrix2D importFromJDBC(DB type,
                                                  String host,
                                                  int port,
                                                  String database,
                                                  String sqlStatement,
                                                  String username,
                                                  String password)

sparse

public static final Matrix sparse(long... size)
                           throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to SparseMatrix.factory

Throws:
MatrixException

sparse

public static final Matrix sparse(Matrix indices)

sparse

public static final Matrix sparse(ValueType valueType,
                                  long... size)
                           throws MatrixException
Throws:
MatrixException

zeros

public static Matrix zeros(long... size)
                    throws MatrixException
Deprecated. Please do not use this method anymore, it will be replaced by DenseMatrix.factory.zeros(long... size)

Throws:
MatrixException

dense

public static Matrix dense(long... size)
                    throws MatrixException
Deprecated. Please do not use this method anymore, it will be moved to DenseMatrix.factory.zeros

Throws:
MatrixException

linkToFile

public static final Matrix linkToFile(FileFormat format,
                                      File file,
                                      Object... parameters)
                               throws MatrixException,
                                      IOException
Throws:
MatrixException
IOException

importFromFile

public static final Matrix importFromFile(String filename,
                                          Object... parameters)
                                   throws MatrixException,
                                          IOException
Throws:
MatrixException
IOException

importFromFile

public static final Matrix importFromFile(File file,
                                          Object... parameters)
                                   throws MatrixException,
                                          IOException
Throws:
MatrixException
IOException

importFromFile

public static final Matrix importFromFile(FileFormat format,
                                          String file,
                                          Object... parameters)
                                   throws MatrixException,
                                          IOException
Throws:
MatrixException
IOException

importFromFile

public static final Matrix importFromFile(FileFormat format,
                                          File file,
                                          Object... parameters)
                                   throws MatrixException,
                                          IOException
Throws:
MatrixException
IOException

importFromClipboard

public static final Matrix importFromClipboard(FileFormat format,
                                               Object... parameters)
                                        throws MatrixException
Throws:
MatrixException

SUNSPOTDATASET

public static final Matrix SUNSPOTDATASET()

emptyMatrix

public static final Matrix emptyMatrix()

getMatrixMapper

public static MatrixMapper getMatrixMapper()

setMatrixMapper

public static void setMatrixMapper(MatrixMapper matrixMapper)

repmat

public static Matrix repmat(Matrix matrix,
                            long... count)

welcomeMatrix

public static Matrix welcomeMatrix()

like

public static Matrix like(Matrix matrix)

like

public static Matrix like(Matrix matrix,
                          long... size)

vertCat

public static Matrix vertCat(Matrix row,
                             long rowCount)

horCat

public static Matrix horCat(Matrix column,
                            long columnCount)

sequence

public static Matrix sequence(double start,
                              double end)

sequence

public static Matrix sequence(double start,
                              double end,
                              double stepsize)


Copyright © 2010. All Rights Reserved.