sugr.linalg
Class LinearAlgebraFactoryColt

java.lang.Object
  extended bysugr.linalg.LinearAlgebraFactoryColt

public class LinearAlgebraFactoryColt
extends java.lang.Object

Author:
beder

Constructor Summary
LinearAlgebraFactoryColt()
           
 
Method Summary
static Matrix getDiagMatrix(int size, double d)
          Create new diagonal matrix.
static Matrix getMatrix(double[][] values)
          create a new matrix by a given double precision floating point array.
static Matrix getMatrix(int no_rows, int no_cols)
          Return a Matrix no_rows x no_cols filled with zeros.
static Matrix getMatrix(Matrix A)
          create new Matrix given Matrix.
static Matrix getMatrix(Vector v)
          creates a Matrix from a given Vector.
static Matrix getMatrixId(int dim)
          creates an identity Matrix
static Vector getVector(double[] values)
          create a new Vector by a given double precision floating point array.
static Vector getVector(double a, double b)
          create a new Vector by 2 doubles
static Vector getVector(double a, double b, double c)
          create a new Vector by 3 doubles
static Vector getVector(double a, double b, double c, double d)
          create a new Vector by 4 doubles
static Vector getVector(int size)
          Return a Vector size x 1 filled with zeros.
static Vector getVector(Vector v)
          create new Vector by given Vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearAlgebraFactoryColt

public LinearAlgebraFactoryColt()
Method Detail

getMatrix

public static Matrix getMatrix(int no_rows,
                               int no_cols)
Return a Matrix no_rows x no_cols filled with zeros.

Parameters:
no_rows - Number of rows the matrix should have
no_cols - Number of columns the matrix should have
Returns:
a no_rows x no_cols - Matrix

getVector

public static Vector getVector(int size)
Return a Vector size x 1 filled with zeros.

Parameters:
size - Dimension the vector should have
Returns:
a Vector with dimension size

getMatrix

public static Matrix getMatrix(double[][] values)
create a new matrix by a given double precision floating point array. e.g.:
    double[][] array = {  {0,1,2,3}, 
                          {0,1,2,3}, 
                          {0,1,2,3}};
    Matrix A = LinearAlgebraFactory.getMatrix(array);
 
Matrix A has dimension 3x4.

Parameters:
values - given in double
Returns:
a Matrix

getMatrix

public static Matrix getMatrix(Matrix A)
create new Matrix given Matrix. Functionally it works like copy

Parameters:
A - Matrix to clone
Returns:
a new Matrix with same entries as given Matrix

getDiagMatrix

public static Matrix getDiagMatrix(int size,
                                   double d)
Create new diagonal matrix.

Parameters:
size - the number of rows and columns of the matrix
d - the value the diagonal elements should have
Returns:
a new Matrix

getVector

public static Vector getVector(double[] values)
create a new Vector by a given double precision floating point array.

Parameters:
values - given in double
Returns:
a Vector with dimension = #entries in array

getVector

public static Vector getVector(double a,
                               double b)
create a new Vector by 2 doubles

Parameters:
a - first double value
b - second double value
Returns:
a Vector with dimension 2

getVector

public static Vector getVector(double a,
                               double b,
                               double c)
create a new Vector by 3 doubles

Parameters:
a - first double value
b - second double value
c - third double value
Returns:
a Vector with dimension 3

getVector

public static Vector getVector(double a,
                               double b,
                               double c,
                               double d)
create a new Vector by 4 doubles

Parameters:
a - first double value
b - second double value
c - third double value
d - fourth double value
Returns:
a Vector with dimension 4

getVector

public static Vector getVector(Vector v)
create new Vector by given Vector. Functionally it works like copy

Parameters:
v - Vector to clone
Returns:
a Vector

getMatrixId

public static Matrix getMatrixId(int dim)
creates an identity Matrix

Parameters:
dim - dimension the Matrix should have
Returns:
a identity-Matrix with dimension dim

getMatrix

public static Matrix getMatrix(Vector v)
creates a Matrix from a given Vector. May be useful for some matrix-multiplication action

Parameters:
v - Vector to create Matrix from
Returns:
a Matrix with dimension (v.dim() x 1)