User Documentation
Centre for Vision, Speech & Signal Processing
DEVELOP IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
WeightMatrixC::WeightMatrixC(void)
WeightMatrixC::WeightMatrixC(const SizeT,const SizeT)
WeightMatrixC::WeightMatrixC(const WeightMatrixC &)
WeightMatrixC::WeightMatrixC(const MatrixC &)
WeightMatrixC::WeightMatrixC(istream &)
WeightMatrixC::operator=(const WeightMatrixC &)
WeightMatrixC::Copy(void) const
WeightMatrixC::~WeightMatrixC(void)
WeightMatrixC::operator+(const WeightMatrixC &) const
WeightMatrixC::operator-(const WeightMatrixC &) const
WeightMatrixC::operator+=(const WeightMatrixC &)
WeightMatrixC::operator+=(const NetVectorC &)
WeightMatrixC::operator-=(const WeightMatrixC &)
WeightMatrixC::operator*=(const RealT)
WeightMatrixC::operator/=(const RealT)
WeightMatrixC::operator*(const RealT) const
WeightMatrixC::operator*(const NetVectorC &) const
WeightMatrixC::operator*(const VectorC &) const
WeightMatrixC::operator*(const WeightMatrixC &) const
WeightMatrixC::SetRandom(RealT,RealT)
WeightMatrixC::SumCol(void)
WeightMatrixC::SumRow(void)
WeightMatrixC::Sqr(void)
WeightMatrixC::RemRow(IntT)
WeightMatrixC::RemCol(IntT)
WeightMatrixC::SqrSumCol(void)
WeightMatrixC::AverageWeightMag(void)
WeightMatrixC::PenaliseWeights(void)
WeightMatrixC::LogSig(void)
WeightMatrixC::SubtractElem(RealT)
MatrixC::operator=(const MatrixC &)
MatrixC::Copy(void) const
MatrixC::IsValid(void) const
MatrixC::operator[](IndexT) const
MatrixC::operator[](IndexT)
MatrixC::Matrix(void) const
MatrixC::Matrix(void)
MatrixC::SubMatrix(const SizeT,const SizeT) const
MatrixC::GetDiag(void) const
MatrixC::GetRow(IndexT) const
MatrixC::GetColumn(IndexT) const
MatrixC::RDim(void) const
MatrixC::CDim(void) const
MatrixC::G(IndexT,IndexT) const
MatrixC::P(IndexT,IndexT)
MatrixC::ColumnModulus(IndexT) const
MatrixC::SubtractColumnFrom(IndexT,IndexT,RealT)
MatrixC::DivColumn(IndexT,RealT)
MatrixC::MakeUnitColumn(IndexT)
MatrixC::DotColumns(IndexT,IndexT) const
MatrixC::Fill(RealT)
MatrixC::SetZero(void)
MatrixC::SetRandom(RealT)
MatrixC::SetRandom(RealT,RealT)
MatrixC::SetDiag(const VectorC &)
MatrixC::SetRow(const IndexT,const VectorC &,const IndexT)
MatrixC::SetCol(const IndexT,const VectorC &,const IndexT)
MatrixC::SetRow(const IndexT,const IndexT,const VectorC &,const IndexT,const IndexT)
MatrixC::SetCol(const IndexT,const IndexT,const VectorC &,const IndexT,const IndexT)
MatrixC::SwapRows(const IndexT,const IndexT)
MatrixC::SwapCols(const IndexT,const IndexT)
MatrixC::SetSmallToBeZero(RealT)
MatrixC::EDiag(void)
MatrixC::operator+(const MatrixC &) const
MatrixC::operator-(const MatrixC &) const
MatrixC::operator+=(const MatrixC &)
MatrixC::operator+=(const RealT)
MatrixC::operator-=(const MatrixC &)
MatrixC::operator-=(const RealT)
MatrixC::operator*=(const RealT)
MatrixC::operator/=(const RealT)
MatrixC::operator*(const RealT) const
MatrixC::operator*(const VectorC &) const
MatrixC::operator*(const MatrixC &) const
MatrixC::AddDiag(const VectorC &)
MatrixC::MulDiag(const VectorC &)
MatrixC::DiagMul(const VectorC &)
MatrixC::MulT(const MatrixC &) const
MatrixC::TMul(const MatrixC &) const
MatrixC::T(void) const
MatrixC::Trace(void) const
MatrixC::I(void) const
MatrixC::NearSingularI(void)
MatrixC::InPlaceI(void)
MatrixC::OrgI(void) const
MatrixC::LUDecomposition(RealT &)
MatrixC::LUSolution(VectorC &)
MatrixC::SVD(VectorC &,MatrixC &,MatrixC &)
MatrixC::SVD(VectorC &,MatrixC &,const RealT)
MatrixC::OrgSVD(VectorC &,MatrixC &,const RealT)
MatrixC::SVD(const RealT)
MatrixC::Det(void)
MatrixC::IsSingular(void)
MatrixC::DiagonalProduct(void) const
MatrixC::WalshTransformation(const IntSArray1dC &,const IntSArray1dC &,IntT)
MatrixC::ColumnGramSchmidtOrthogonalization(void)
MatrixC::FixSmallToBeZero(RealT)
MatrixC::Identity(UIntT)
MatrixC::SumOfAbs(void) const
WeightMatrixC
 
Extension of MatrixC class for use with neural network
 
include "amma/Num/WeightMatrix.hh"
User Level:Default
Library:NumModelNeuralNet
Example:NetTest.cc
Section:default.Kieron Messer
In Scope:std

Parent Classes:

Methods:
WeightMatrixC()
empty matrix

WeightMatrixC(const SizeT r,const SizeT c)
matrix r x c

WeightMatrixC(const WeightMatrixC & m)
another access to the matrix m

WeightMatrixC(const MatrixC & m)
make matrix from matrix

WeightMatrixC(istream & s)
construct a matrix from a stream

const WeightMatrixC & operator=(const WeightMatrixC & mat)
assigment of a big object

WeightMatrixC Copy() const

~WeightMatrixC()

WeightMatrixC operator+(const WeightMatrixC & mat) const

WeightMatrixC operator-(const WeightMatrixC & mat) const

WeightMatrixC & operator+=(const WeightMatrixC & mat)

WeightMatrixC & operator+=(const NetVectorC & vec)

WeightMatrixC & operator-=(const WeightMatrixC & mat)

WeightMatrixC & operator*=(const RealT a)

WeightMatrixC & operator/=(const RealT a)

WeightMatrixC operator*(const RealT a) const

NetVectorC operator*(const NetVectorC & vector) const

VectorC operator*(const VectorC & vector) const

WeightMatrixC operator*(const WeightMatrixC & mat) const

Methods


void SetRandom(RealT low,RealT high)
Set all elements in matrix to random values between range

NetVectorC SumCol()
Sum all the columns in a matrix

NetVectorC SumRow()
Sum all the rows in a matrix

WeightMatrixC Sqr()
Square all the elements in a matrix

void RemRow(IntT ind)
Return matrix with specified row removed

void RemCol(IntT ind)
Return matrix with specified col removed

NetVectorC SqrSumCol()
Square all elements then sum columns

NetVectorC AverageWeightMag()
Square all elements then sum columns

WeightMatrixC PenaliseWeights()
Add penalty values to weights based on their magnitude

void LogSig()
Calculate the log sig of every element in matrix

void SubtractElem(RealT alfa)
Subtract alfa - elem[][]

#include "amma/Matrix.hh"
const MatrixC & operator=(const MatrixC & mat)
Assignment of a big object

MatrixC Copy() const

BooleanT IsValid() const
Returns TRUE if this matrix exists.

Access to the elements


const SizeBufferAccessC<RealT> operator[](IndexT r) const
Access to the row of the constant matrix

SizeBufferAccessC<RealT> operator[](IndexT r)
Access to the row of the matrix

const MatrixC & Matrix() const
Access to the constant matrix

MatrixC & Matrix()
Access to the matrix

MatrixC SubMatrix(const SizeT sr,const SizeT sc) const
Returns the submatrix created from the first 'sr' rows and 'sc' columns of this matrix.
This makes a copy of the matrix elements specified.

VectorC GetDiag() const
Creates the vector of the diagonal elements

VectorC GetRow(IndexT r) const
Creates the vector of elements of the row 'r'.

VectorC GetColumn(IndexT c) const
Creates the vector of elements of the column 'c'.

SizeT RDim() const
Return the number of rows

SizeT CDim() const
Return the number of columns

RealT G(IndexT r,IndexT c) const
Get the value

RealT & P(IndexT r,IndexT c)
Put the value

RealT ColumnModulus(IndexT c) const
Returns the modulus of the column 'c'.

void SubtractColumnFrom(IndexT c1,IndexT c2,RealT a)
Subtracts the column 'c2' multiplied by the parameter 'a' from the column 'c1'.

void DivColumn(IndexT c,RealT val)
Divides the column 'c' by the value val.

RealT MakeUnitColumn(IndexT c)
Divides the column 'c' by its modulus. Returns its original modulus.

RealT DotColumns(IndexT c1,IndexT c2) const
Returns the dot product of columns 'c1' and 'c2'.

Set element values


void Fill(RealT val)
Fill matrix with value 'val'

MatrixC & SetZero()
set all elements to be zero

MatrixC & SetRandom(RealT scale = 1)
set all elements to be random value, between 0 and 'scale'.

MatrixC & SetRandom(RealT lo,RealT hi)
set all elements to uniformly random between lo and hi

MatrixC & SetDiag(const VectorC & vec)
set the diagonal elements according to vec

MatrixC & SetRow(const IndexT r,const VectorC & vec,const IndexT n)
Sets the first 'n' elements of the row 'r' according to the first 'n' elements of the vector 'vec'.

MatrixC & SetCol(const IndexT c,const VectorC & vec,const IndexT n)
Sets the first 'n' elements of the column 'c' according to the first 'n' elements of the vector 'vec'.

MatrixC & SetRow(const IndexT r,const IndexT c,const VectorC & vec,const IndexT s1,const IndexT s2)
Sets the elements of the row 'r' starting at the column 'c' according to the elements of the vector 'vec' with the indexes in the range .

MatrixC & SetCol(const IndexT r,const IndexT c,const VectorC & vec,const IndexT s1,const IndexT s2)
Sets the elements of the column 'c' starting at the row 'r' according to the elements of the vector 'vec' with the indexes in the range .

MatrixC & SwapRows(const IndexT r1,const IndexT r2)
Swaps the row 'r1' and 'r2'.

MatrixC & SwapCols(const IndexT c1,const IndexT c2)
Swaps the columns 'c1' and 'c2'.

MatrixC & SetSmallToBeZero(RealT thr)
Set all elements smaller than 'thr' to be zero.

MatrixC & EDiag()
Set all diagonal elements to be 1.0

Arithmetic operators


MatrixC operator+(const MatrixC & mat) const
Sum 2 matrixes "MatrixC" = "This" + mat

MatrixC operator-(const MatrixC & mat) const
Subtract 2 matrixes "MatrixC" = "This" - mat

MatrixC & operator+=(const MatrixC & mat)
Add the matrix "mat": "This" = "This" + mat

MatrixC & operator+=(const RealT alpha)
Add scalar to each element of matrix i.e. "mat": "This" = "This" + alpha

MatrixC & operator-=(const MatrixC & mat)
Subtract the matrix "mat": "This" = "This" - mat

MatrixC & operator-=(const RealT alpha)
Subtract scalar from each element in the matrix "mat": "This" = "This" - alpha

MatrixC & operator*=(const RealT a)
Multiplication "Matrix" = "Matrix" * "Scalar"

MatrixC & operator/=(const RealT a)
Division "Matrix" = "Matrix" / "Scalar"

MatrixC operator*(const RealT a) const
Multiply this matrix by the scalar 'a'.

VectorC operator*(const VectorC & vector) const
Multiplication "VectorC" = "This" * vector

MatrixC operator*(const MatrixC & mat) const
Multiplication "result" = "this" * "mat"

MatrixC & AddDiag(const VectorC & v)
Adds the diagonal matrix represented by the vector 'v' (m = m + v).

MatrixC & MulDiag(const VectorC & v)
Multiplies the matrix from the right by the diagonal matrix represented by the vector 'v' (m = m * v).

MatrixC & DiagMul(const VectorC & v)
Multiplies the matrix from the left by the diagonal matrix represented by the vector 'v' (m = v * m).

MatrixC MulT(const MatrixC & mat) const
Multiplication A * B.T()

MatrixC TMul(const MatrixC & mat) const
Multiplication A.T() * B

MatrixC T() const
Returns the transposition of this matrix.

RealT Trace() const
Returns the trace of this matrix.

Matrix inversion and decomposition


MatrixC I() const
Returns the inversion of this matrix.
Uses the algorithm from InPlaceI(), unless matrix is non-square, in which case OrgI() is called. The original matrix is preserved, however.

RealT NearSingularI()
Inverts this matrix and returns determinant of original matrix.
This routine is particularly useful when you matrices are near singular as it uses PCA to first rotate co-ordinate axis, so no nasty divisions. See Fukunaga -Introduction to Statistical Pat Rec, page 40.

RealT InPlaceI()
Replaces the original matrix with its inverse, and returns its determinant.
Uses the in-place Gauss-Jordan elimination method.

MatrixC OrgI() const
Returns the inversion of this matrix.
Radek's original inversion routine. Does something even with non-square matrices.

IntSArray1dC LUDecomposition(RealT & d)
This function replaces this matrix by the LU decomposition of a row-wise permutation of itself.
The lower triangle submatrix has got the diagonal unity elements. The returned index array records the row permutation effected by the partial pivoting. 'd' is output as +-1 depending on whether the number of row interchanges was even or odd, respectively.

VectorC LUSolution(VectorC & rightSide)
Returns the vector X that is the solution of the linear system described by the matrix equation A*X=B, where A is this matrix, and the vector B is equal to the vector 'rightSide'.
The method used is the LU decomposition.
BUG: NOT IMPLEMENTED

void SVD(VectorC & d,MatrixC & u,MatrixC & v)
Singular value decomposition. DO NOT USE. It does not work.

void SVD(VectorC & d,MatrixC & v,const RealT isSmall = 1e-8)
Singular value decomposition, eg. M = U * D * V.T().
The function changes the input matrix M to U. The diagonal matrix D is returned as the vector 'd' and the matrix V is returned as the matrix 'v'. Both object 'd' and 'v' are supposed to have the proper size.

void OrgSVD(VectorC & d,MatrixC & v,const RealT isSmall = 1e-8)
The original NR SVD. (Default).

VecMatC SVD(const RealT isSmall = 1e-8)
Singular value decomposition, eg. M = U * D * V.T().
The function changes the input matrix M to U. The diagonal matrix D is returned as the vector in the result object and the matrix V is returned as the matrix in the result object. The singular values are not ordered. The effect of isSmall is not known in detail to CG or AJS It is provided as a feature for experimentation - if interested users should perhaps consult the Numerical Recipes Book At a rough guess decreasing this number will give a more accurate result, but it might not converge?

RealT Det()
Returns the determinant of this matrix. The matrix is changed.

BooleanT IsSingular()
Returns TRUE if the matrix is singular.
The SVD is used for computation of the determinant. The matrix is changed.
BUG: DO NOT TRUST

Miscellaneous


RealT DiagonalProduct() const
Returns the product of the diagonal elements.

MatrixC & WalshTransformation(const IntSArray1dC & lbr,const IntSArray1dC & lbc,IntT ifun)
2D Walsh-Hadamard transformation
lbr bit-reversal field of the size RDim()
lbc bit-reversal field of the size CDim()
ifunType of ordering (I),
IFUN=1
Hadamard ordering
IFUN=2 ... Walsh ordering

MatrixC & ColumnGramSchmidtOrthogonalization()
Performs Gram-Schmidt orthogonalisation of columns of this matrix.

MatrixC & FixSmallToBeZero(RealT thr = 1e-12)
All elements whose absolute values are smaller than 'thr' are changed to be zero.

MatrixC Identity(UIntT size)
Construct an identity matrix of size * size.

RealT SumOfAbs() const
Sum of the absolute value of all the elements of the matrix.


Programmer:Kieron Messer, Documentation by CxxDoc: Tue Mar 20 10:48:08 2001