LinAlg
Class ExtendedColtVector

java.lang.Object
  extended bycern.colt.PersistentObject
      extended bycern.colt.matrix.impl.AbstractMatrix
          extended bycern.colt.matrix.impl.AbstractMatrix1D
              extended bycern.colt.matrix.DoubleMatrix1D
                  extended bycern.colt.matrix.impl.DenseDoubleMatrix1D
                      extended byLinAlg.ExtendedColtVector
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ExtendedColtVector
extends cern.colt.matrix.impl.DenseDoubleMatrix1D

A column vector. Wrapper for cern.colt.matrix.impl.DenseDoubleMatrix1D and cern.colt.matrix.linalg.(Blas,Algebra). Rewrites the Blas operations in programming notation plusEquals (+=) and timesEquals (*=) (from left) to maintain familiar coding syntax.

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

Works only with ExtendedColtMatrices. Of course this is inelegant and we should work through Interfaces. Presently the hope is that the classes ExtendedColtMatrix and ExtendedColtVector with their proliferation of methods won't be needed and the more atomic methods in ColtMatrix and ColtVector will suffice.

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.DenseDoubleMatrix1D
elements
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix1D
size, stride, zero
 
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix
isNoView
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
ExtendedColtVector(double[] coords)
          Coordinates derived from given double[].
ExtendedColtVector(int dim)
          all coordinates zero.
 
Method Summary
 ColtVector deepClone()
          Returns a deep copy of this.
 int dim()
          ACCESSOR
 double dot(ExtendedColtVector y)
          Dot product this.y.
 double L1Norm()
          Sum of coordinate absolute values.
 double L2Norm()
          Squareroot of sum of squares of coordiantes.
static void main(java.lang.String[] args)
          Output is selfexplanatory.
 void plusEquals(ColtVector z)
          Implements the operation this+=z.
 void plusEquals(double beta, double alpha, ExtendedColtMatrix A, boolean transposeA, ExtendedColtVector z)
          Implements the operation this=beta*this+alpha*A*z.
 void plusEquals(double beta, double alpha, ExtendedColtMatrix A, ExtendedColtVector z)
          Implements the operation this=beta*this+alpha*A*z.
 void plusEquals(double alpha, ExtendedColtMatrix A, boolean transposeA, ExtendedColtVector z)
          Implements the operation this+=alpha*A*z.
 void plusEquals(double alpha, ExtendedColtMatrix A, ExtendedColtVector z)
          Implements the operation this+=alpha*A*z.
 void plusEquals(double alpha, ExtendedColtVector z)
          Implements the operation this+=alpha*z.
 void scale(double alpha)
          Implements the operation this=alpha*this.
 void scale(double[] alpha)
          Implements the operation this[i]=alpha[i]*this[i].
 void symmetricPlusEquals(double beta, double alpha, ExtendedColtMatrix A, boolean useUpperHalf, ExtendedColtVector z)
          Implements the operation this=beta*this+alpha*A*z.
 void symmetricPlusEquals(double alpha, ExtendedColtMatrix A, boolean useUpperHalf, ExtendedColtVector z)
          Implements the operation this+=alpha*A*z.
 void symmetricTimesEquals(ExtendedColtMatrix A, boolean useUpperHalf, ColtVector z)
          Implements the operation this=A*this.
 void timesEquals(ExtendedColtMatrix A)
          Implements the operation this=A*this.
 
Methods inherited from class cern.colt.matrix.impl.DenseDoubleMatrix1D
assign, assign, assign, assign, assign, cardinality, getQuick, haveSharedCellsRaw, index, like, like2D, setQuick, swap, toArray, viewSelectionLike, zDotProduct, zSum
 
Methods inherited from class cern.colt.matrix.DoubleMatrix1D
aggregate, aggregate, assign, cardinality, copy, equals, equals, get, getContent, getNonZeros, getNonZeros, haveSharedCells, like, set, toArray, toString, view, viewFlip, viewPart, viewSelection, viewSelection, viewSorted, viewStrides, zDotProduct, zDotProduct, zDotProduct
 
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix1D
_offset, _rank, checkIndex, checkIndexes, checkRange, checkSize, checkSize, setUp, setUp, size, stride, toStringShort, vFlip, vPart, 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

ExtendedColtVector

public ExtendedColtVector(double[] coords)

Coordinates derived from given double[].

Parameters:
coords - array of coordinates.

ExtendedColtVector

public ExtendedColtVector(int dim)
all coordinates zero.

Method Detail

dim

public int dim()
ACCESSOR


deepClone

public ColtVector deepClone()

Returns a deep copy of this.


scale

public void scale(double alpha)

Implements the operation this=alpha*this.

Parameters:
alpha - multiplies this.

scale

public void scale(double[] alpha)

Implements the operation this[i]=alpha[i]*this[i].

Parameters:
alpha - multiplies this component by component.

dot

public double dot(ExtendedColtVector y)

Dot product this.y.

Parameters:
y - second vector in dot product.

plusEquals

public void plusEquals(ColtVector z)

Implements the operation this+=z.

Parameters:
z - vector added to this.

symmetricTimesEquals

public void symmetricTimesEquals(ExtendedColtMatrix A,
                                 boolean useUpperHalf,
                                 ColtVector z)

Implements the operation this=A*this. where the matrix A is assumed to be symmetric and so only the upper or lower half of A is used. A warning message is sent if the A is not flagged as symmetric but the computation continues.

Parameters:
A - multiplies this on left.
useUpperHalf - which half of A is to be used.

timesEquals

public void timesEquals(ExtendedColtMatrix A)

Implements the operation this=A*this. Takes into account if the matrix A is triangular or diagonal.

Parameters:
A - triangular matrix multiplying this.

plusEquals

public void plusEquals(double beta,
                       double alpha,
                       ExtendedColtMatrix A,
                       boolean transposeA,
                       ExtendedColtVector z)

Implements the operation this=beta*this+alpha*A*z. Here A is transposed if the transpose flags are set to true.

Parameters:
beta - multiplies this.
alpha - multiplies A.
A - multiplies z.
transposeA - is A to be transposed?
z - vector, cannot be this, clone if necessary.

plusEquals

public void plusEquals(double beta,
                       double alpha,
                       ExtendedColtMatrix A,
                       ExtendedColtVector z)

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

Parameters:
beta - multiplies this.
alpha - multiplies A.
A - multiplies z.
z - vector, cannot be this, clone if necessary.

plusEquals

public void plusEquals(double alpha,
                       ExtendedColtMatrix A,
                       boolean transposeA,
                       ExtendedColtVector z)

Implements the operation this+=alpha*A*z. Here A is transposed if the transpose flags are set to true.

Parameters:
alpha - multiplies A.
A - multiplies z.
transposeA - is A to be transposed?
z - vector , cannot be this, clone if necessary.

plusEquals

public void plusEquals(double alpha,
                       ExtendedColtMatrix A,
                       ExtendedColtVector z)

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

Parameters:
alpha - multiplies A.
A - multiplies z.
z - vector.

plusEquals

public void plusEquals(double alpha,
                       ExtendedColtVector z)

Implements the operation this+=alpha*z.

Parameters:
alpha - multiplies z.
z - vector, cannot be this, clone if necessary.

symmetricPlusEquals

public void symmetricPlusEquals(double beta,
                                double alpha,
                                ExtendedColtMatrix A,
                                boolean useUpperHalf,
                                ExtendedColtVector z)

Implements the operation this=beta*this+alpha*A*z. where the matrix A is assumed to be symmetric and so only the upper or lower half of A is used.

A warning message is sent if the A is not flagged as diagonal but the computation continues.

Parameters:
beta - multiplies this.
alpha - multiplies A.
A - multiplies z.
useUpperHalf - which half of A is to be used.
z - vector, cannot be this, clone if necessary.

symmetricPlusEquals

public void symmetricPlusEquals(double alpha,
                                ExtendedColtMatrix A,
                                boolean useUpperHalf,
                                ExtendedColtVector z)

Implements the operation this+=alpha*A*z. where the matrix A is assumed to be symmetric and so only the upper or lower half of A is used.

A warning message is sent if the A is not flagged as diagonal but the computation continues.

Parameters:
alpha - multiplies A.
A - multiplies z.
useUpperHalf - which half of A is to be used.
z - vector, cannot be this, clone if necessary.

L2Norm

public double L2Norm()
Squareroot of sum of squares of coordiantes.


L1Norm

public double L1Norm()
Sum of coordinate absolute values.


main

public static void main(java.lang.String[] args)
Output is selfexplanatory.