LinAlg
Class ColtVector

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.ColtVector
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ColtVector
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.

Only atomic operations fromm the Blas are wrapped. See ExtendedColtVector for the whole bewildering array.

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
ColtVector(double[] coords)
          Coordinates derived from given double[].
ColtVector(int dim)
          all coordinates zero.
 
Method Summary
 ColtVector deepClone()
          Returns a deep copy of this.
 int dim()
          Dimension of the vector (same as size())
 double dot(ColtVector y)
          Dot product this.y.
 boolean isEqual(ColtVector y)
          Test for equality of dimension and component by component equality.
 double L1Norm()
          Sum of coordinate absolute values.
 double L2Norm()
          Squareroot sum of coordinate squares.
static void main(java.lang.String[] args)
          Run, output is self explanatory.
 ColtVector plusEquals(ColtVector z)
          Implements the operation this+=z and returns the resulting vector code>this.
 ColtVector scale(double alpha)
          Implements the operation this=alpha*this and returns the resulting vector code>this.
 ColtVector setEqual(ColtVector z)
          The assignement this=z;.
 ColtVector setZero()
          Sets all coordinates to zero and returns the resulting vector this.
 ColtVector symmetricTimesEquals(ColtMatrix A, boolean useUpperHalf)
          Implements the operation this=A*this.
 ColtVector timesEquals(ColtMatrix A)
          Implements the operation this=A*this and returns the resulting vector code>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

ColtVector

public ColtVector(double[] coords)

Coordinates derived from given double[].

Parameters:
coords - array of coordinates.

ColtVector

public ColtVector(int dim)
all coordinates zero.

Method Detail

dim

public int dim()
Dimension of the vector (same as size())


isEqual

public boolean isEqual(ColtVector y)
Test for equality of dimension and component by component equality.


deepClone

public ColtVector deepClone()

Returns a deep copy of this.


setZero

public ColtVector setZero()

Sets all coordinates to zero and returns the resulting vector this.


setEqual

public ColtVector setEqual(ColtVector z)

The assignement this=z;. Vector z must be of equal dimension to this. Simply copies the coordinates of z into this and returns the resulting vector code>this.

Parameters:
z - vector assigned to this=z;.

dot

public double dot(ColtVector y)

Dot product this.y.

Parameters:
y - second vector in dot product.

scale

public ColtVector scale(double alpha)

Implements the operation this=alpha*this and returns the resulting vector code>this.

Parameters:
alpha - multiplies this.

plusEquals

public ColtVector plusEquals(ColtVector z)

Implements the operation this+=z and returns the resulting vector code>this.

Parameters:
z - vector added to this.

timesEquals

public ColtVector timesEquals(ColtMatrix A)

Implements the operation this=A*this and returns the resulting vector code>this. Takes into account if the matrix A is triangular or diagonal.

Parameters:
A - triangular matrix multiplying this.

symmetricTimesEquals

public ColtVector symmetricTimesEquals(ColtMatrix A,
                                       boolean useUpperHalf)

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.

Returns the resulting vector code>this.

Parameters:
useUpperHalf - which half of A is to be used.

L2Norm

public double L2Norm()
Squareroot sum of coordinate squares.


L1Norm

public double L1Norm()
Sum of coordinate absolute values.


main

public static void main(java.lang.String[] args)
Run, output is self explanatory.