LinAlg
Class ExtendedColtMatrix

java.lang.Object
  extended bycern.colt.PersistentObject
      extended bycern.colt.matrix.impl.AbstractMatrix
          extended bycern.colt.matrix.impl.AbstractMatrix2D
              extended bycern.colt.matrix.DoubleMatrix2D
                  extended bycern.colt.matrix.impl.DenseDoubleMatrix2D
                      extended byLinAlg.ExtendedColtMatrix
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ExtendedColtMatrix
extends cern.colt.matrix.impl.DenseDoubleMatrix2D

Wrapper for cern.colt.matrix.impl.DenseDoubleMatrix2D and cern.colt.matrix.linalg.(Blas,Algebra,CholeskyDecomposition).

Rewrites the Blas operations in programming notation plusEquals (+=) and timesEquals (*=) (from left and right) to maintain familiar coding syntax.

Has the whole bewildering array of Blas operations. Disregard this for now and try to work with the more atomic oprations in ColtMatrix

Warning: class is completely untested. It needs to be checked if the Blas operations were wrapped correctly (transposition of parameters etc. with disastrous results...).

See Also:
Serialized Form

Field Summary
static cern.colt.matrix.linalg.Blas blas
          cern.colt.matrix.linalg.SeqBlas (non mulTithreaded) Blas object.
static cern.colt.matrix.linalg.Algebra linAlg
          cern.colt.matrix.linalg.Algebra object with default tolerances.
 
Fields inherited from class cern.colt.matrix.impl.DenseDoubleMatrix2D
elements
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix2D
columns, columnStride, columnZero, rows, rowStride, rowZero
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix
isNoView
 
Constructor Summary
ExtendedColtMatrix(double[][] entries)
          Entries derived from given double[][].
ExtendedColtMatrix(int rows, int columns)
          all entries zero.
 
Method Summary
 cern.colt.matrix.linalg.CholeskyDecomposition choleskyDecomposition()
          Cholesky decomposition object arising from an attempted Cholesky decompostion of this.
 ExtendedColtMatrix choleskyRoot()
          Returns the lower triangular matrix L with A=LL' in case A is symmetric and positive definite.
 ExtendedColtVector column(int j)
          Returns the columns of this.
 ExtendedColtMatrix deepClone()
          Returns a deep copy of this.
 ExtendedColtMatrix inverse()
          Inverse of A=this if A is square, pseudoinverse otherwise.
 boolean isDiagonal()
           
 boolean isLowerTriangular()
           
 boolean isSymmetric()
           
 boolean isTriangular()
           
 boolean isUpperTriangular()
           
 void leftTimesEquals(ExtendedColtMatrix A)
          Implements the operation this=A*this.
 void leftTimesEquals(ExtendedColtMatrix A, boolean transposeA)
          Implements the operation this=A*this.
 ExtendedColtMatrix linearSystemSolution(ExtendedColtMatrix B)
          Returns the solution matrix X of the linear equation this*X=B.
 ExtendedColtVector linearSystemSolution(ExtendedColtVector y)
          Returns the solution vector x of the linear equation this*x=y.
static void main(java.lang.String[] args)
          TEST PROGRAM
 void plusEquals(double beta, double alpha, ExtendedColtMatrix A, boolean transposeA, ExtendedColtMatrix B, boolean transposeB)
          Implements the operation this=beta*this+alpha*A*B.
 void plusEquals(double beta, double alpha, ExtendedColtMatrix A, ExtendedColtMatrix B)
          Implements the operation this=beta*this+alpha*A*B.
 void plusEquals(double alpha, ExtendedColtMatrix A)
          Implements the operation this+=alpha*A.
 void plusEquals(double alpha, ExtendedColtMatrix A, boolean transposeA, ExtendedColtMatrix B, boolean transposeB)
          Implements the operation this+=alpha*A*B.
 void plusEquals(double alpha, ExtendedColtMatrix A, ExtendedColtMatrix B)
          Implements the operation this+=alpha*A*B.
 void rightTimesEquals(ExtendedColtMatrix A)
          Implements the operation this=A*this.
 void rightTimesEquals(ExtendedColtMatrix A, boolean transposeA)
          Implements the operation this=this*A.
 ExtendedColtVector row(int i)
          Returns the rows of this.
 void scale(double alpha)
          Implements the operation this=alpha*this.
 ColtMatrix transpose()
          Returns the transpose of this.
 void transposeSelf()
          Transposes this.
 
Methods inherited from class cern.colt.matrix.impl.DenseDoubleMatrix2D
assign, assign, assign, assign, assign, getQuick, haveSharedCellsRaw, index, like, like1D, like1D, setQuick, viewSelectionLike, zAssign8Neighbors, zMult, zMult, zSum
 
Methods inherited from class cern.colt.matrix.DoubleMatrix2D
aggregate, aggregate, cardinality, copy, equals, equals, forEachNonZero, get, getContent, getNonZeros, haveSharedCells, like, set, toArray, toString, view, viewColumn, viewColumnFlip, viewDice, viewPart, viewRow, viewRowFlip, viewSelection, viewSelection, viewSorted, viewStrides, zMult, zMult
 
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix2D
_columnOffset, _columnRank, _rowOffset, _rowRank, checkBox, checkColumn, checkColumnIndexes, checkRow, checkRowIndexes, checkShape, checkShape, columns, rows, setUp, setUp, size, toStringShort, vColumnFlip, vDice, vPart, vRowFlip, vStrides
 
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix
ensureCapacity, isView, trimToSize
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

linAlg

public static final cern.colt.matrix.linalg.Algebra linAlg
cern.colt.matrix.linalg.Algebra object with default tolerances. Has some basic linear algreba routines.


blas

public static final cern.colt.matrix.linalg.Blas blas
cern.colt.matrix.linalg.SeqBlas (non mulTithreaded) Blas object. Has some basic linear algebra routines.

Constructor Detail

ExtendedColtMatrix

public ExtendedColtMatrix(double[][] entries)

Entries derived from given double[][].

Parameters:
entries - the matrix entries.

ExtendedColtMatrix

public ExtendedColtMatrix(int rows,
                          int columns)
all entries zero.

Method Detail

isUpperTriangular

public boolean isUpperTriangular()

isLowerTriangular

public boolean isLowerTriangular()

isTriangular

public boolean isTriangular()

isDiagonal

public boolean isDiagonal()

isSymmetric

public boolean isSymmetric()

deepClone

public ExtendedColtMatrix deepClone()

Returns a deep copy of this.


row

public ExtendedColtVector row(int i)

Returns the rows of this.

Parameters:
i - row index.

column

public ExtendedColtVector column(int j)

Returns the columns of this.

Parameters:
j - column index.

transpose

public ColtMatrix transpose()
Returns the transpose of this.


transposeSelf

public void transposeSelf()
Transposes this. The matrix must be square. No new memory allocated.


inverse

public ExtendedColtMatrix inverse()
Inverse of A=this if A is square, pseudoinverse otherwise.


scale

public void scale(double alpha)

Implements the operation this=alpha*this.

Parameters:
alpha - scaling factor.

plusEquals

public void plusEquals(double alpha,
                       ExtendedColtMatrix A)

Implements the operation this+=alpha*A.


plusEquals

public void plusEquals(double beta,
                       double alpha,
                       ExtendedColtMatrix A,
                       boolean transposeA,
                       ExtendedColtMatrix B,
                       boolean transposeB)

Implements the operation this=beta*this+alpha*A*B. Here A,B are replaced with their transposes if the transpose flags are set to true.

Parameters:
transposeA - is A to be transposed?
transposeB - is B to be transposed?

plusEquals

public void plusEquals(double beta,
                       double alpha,
                       ExtendedColtMatrix A,
                       ExtendedColtMatrix B)

Implements the operation this=beta*this+alpha*A*B.


plusEquals

public void plusEquals(double alpha,
                       ExtendedColtMatrix A,
                       boolean transposeA,
                       ExtendedColtMatrix B,
                       boolean transposeB)

Implements the operation this+=alpha*A*B. Here A,B are replaced with their transposes if the transpose flags are set to true.

Parameters:
transposeA - is A to be transposed?

plusEquals

public void plusEquals(double alpha,
                       ExtendedColtMatrix A,
                       ExtendedColtMatrix B)

Implements the operation this+=alpha*A*B.


leftTimesEquals

public void leftTimesEquals(ExtendedColtMatrix A,
                            boolean transposeA)

Implements the operation this=A*this. A is transposed if the parameter transposeA is set to true.

Parameters:
A - multiplies this on the left.

leftTimesEquals

public void leftTimesEquals(ExtendedColtMatrix A)

Implements the operation this=A*this.

Parameters:
A - multiplies this on the left.

rightTimesEquals

public void rightTimesEquals(ExtendedColtMatrix A,
                             boolean transposeA)

Implements the operation this=this*A. A is transposed if the parameter transposeA is set to true.

Parameters:
A - multiplies this on the right.

rightTimesEquals

public void rightTimesEquals(ExtendedColtMatrix A)

Implements the operation this=A*this.

Parameters:
A - multiplies this on the left.

linearSystemSolution

public ExtendedColtMatrix linearSystemSolution(ExtendedColtMatrix B)

Returns the solution matrix X of the linear equation this*X=B. Exact solution if this is square, least squares solution otherwise. Simultaneous solution of linear systems Ax=b, where b ranges over the columns of B. The columns of X are the solution vectors.

Parameters:
B - matrix of right hand sides (columns).

linearSystemSolution

public ExtendedColtVector linearSystemSolution(ExtendedColtVector y)
Returns the solution vector x of the linear equation this*x=y. Exact solution if this is square, least squares solution otherwise.

Parameters:
y - right hand side.

choleskyDecomposition

public cern.colt.matrix.linalg.CholeskyDecomposition choleskyDecomposition()
Cholesky decomposition object arising from an attempted Cholesky decompostion of this. Has some functionality in addition to producing the lower triangular matrix L with A=LL' in case A is symmetric and positive definite. See the cern.colt.matrix.linalg.CholeskyDecomposition documentation.


choleskyRoot

public ExtendedColtMatrix choleskyRoot()
Returns the lower triangular matrix L with A=LL' in case A is symmetric and positive definite. Exits and aborts if A is not symmetric and positive definite.


main

public static void main(java.lang.String[] args)
TEST PROGRAM