Developer Documentation
RAVL, Recognition And Vision Library
USER HOME PAGE CLASS LIST CONTENTS
Ravl - Math - Linear Algebra - MatrixC
 

  PUBLIC
MatrixC::MatrixC(void)
MatrixC::IsReal(void) const
MatrixC::MatrixC(const VectorC &)
MatrixC::MatrixC(UIntT,UIntT)
MatrixC::MatrixC(UIntT,UIntT,const RealT *)
MatrixC::MatrixC(const TMatrixC &)
MatrixC::MatrixC(const SArray2dC &)
MatrixC::MatrixC(RealT,RealT,RealT,RealT)
MatrixC::MatrixC(RealT,RealT,RealT,RealT,RealT,RealT,RealT,RealT,RealT)
MatrixC::MatrixC(const TFMatrixC &)
MatrixC::Inverse(void) const
MatrixC::InverseIP(void)
MatrixC::PseudoInverse(RealT) const
MatrixC::Det(void) const
TMatrixC::operator TFMatrixC(void)
TMatrixC::Rows(void) const
TMatrixC::Cols(void) const
TMatrixC::operator *(DataT) const
TMatrixC::operator *(const TVectorC &) const
TMatrixC::operator *(const TMatrixC &) const
TMatrixC::MulT(const TMatrixC &) const
TMatrixC::TMul(const TMatrixC &) const
TMatrixC::TMul(const TVectorC &) const
TMatrixC::AAT(void) const
TMatrixC::ATA(void) const
TMatrixC::T(void) const
TMatrixC::Identity(UIntT)
TMatrixC::SetDiagonal(const TVectorC &)
TMatrixC::AddDiagonal(const TVectorC &)
TMatrixC::SubMatrix(SizeT,SizeT)
TMatrixC::SumOfAbs(void) const
TMatrixC::AddOuterProduct(const TVectorC &,const TVectorC &)
TMatrixC::AddOuterProduct(const TVectorC &,const TVectorC &,const DataT &)
TMatrixC::SetSmallToBeZero(const DataT &)
TMatrixC::SwapRows(int,int)
SArray2dC::Copy(void) const
SArray2dC::Buffer(void)
SArray2dC::Buffer(void) const
SArray2dC::AsVector(bool)
SArray2dC::operator +(const SArray2dC &) const
SArray2dC::operator -(const SArray2dC &) const
SArray2dC::operator *(const SArray2dC &) const
SArray2dC::operator /(const SArray2dC &) const
SArray2dC::operator *(const DataT &) const
SArray2dC::operator /(const DataT &) const
SArray2dC::operator +(const DataT &) const
SArray2dC::operator -(const DataT &) const
SArray2dC::operator +=(const SArray2dC &)
SArray2dC::operator -=(const SArray2dC &)
SArray2dC::operator *=(const SArray2dC &)
SArray2dC::operator /=(const SArray2dC &)
SArray2dC::operator +=(const DataT &)
SArray2dC::operator -=(const DataT &)
SArray2dC::operator *=(const DataT &)
SArray2dC::operator /=(const DataT &)
SArray2dC::SumSqr(void) const
SArray2dC::Sum(void) const
SArray2dC::Diagonal(void)
SArray2dC::SliceRow(IndexC)
SArray2dC::SliceColumn(IndexC)
SArray2dC::SetColumn(IndexC,const SArray1dC &)
SArray2dC::SetRow(IndexC,const SArray1dC &)
SArray2dC::BuildAccess(UIntT,UIntT)
SizeBufferAccess2dC::Contains(const Index2dC &) const
SizeBufferAccess2dC::operator [](const Index2dC &)
SizeBufferAccess2dC::operator [](const Index2dC &) const
SizeBufferAccess2dC::operator [](IndexC)
SizeBufferAccess2dC::operator [](IndexC) const
SizeBufferAccess2dC::Size1(void) const
SizeBufferAccess2dC::Size2(void) const
SizeBufferAccess2dC::Size(void) const
SizeBufferAccess2dC::Fill(const DataT &)
SizeBufferAccess2dC::Stride(void) const
SizeBufferAccess2dC::IsContinuous(void) const
SizeBufferAccessC::operator =(DataT *)
SizeBufferAccessC::DataStart(void) const
SizeBufferAccessC::Size(void) const
SizeBufferAccessC::Limits(void) const
SizeBufferAccessC::Range(void) const
SizeBufferAccessC::IMin(void) const
SizeBufferAccessC::IMax(void) const
SizeBufferAccessC::operator [](const IndexC) const
SizeBufferAccessC::operator [](const IndexC)
SizeBufferAccessC::SAccess(void) const
SizeBufferAccessC::IsEmpty(void) const
SizeBufferAccessC::Contains(IndexC) const
SizeBufferAccessC::ShrinkHigh(SizeT)
SizeBufferAccessC::Swap(SizeBufferAccessC &)
SizeBufferAccessC::Attach(const SizeBufferAccessC &)
SizeBufferAccessC::Attach(const BufferAccessC &,SizeT)
SizeBufferAccessC::operator +(SizeT) const
SizeBufferAccessC::Fill(const DataT &)
SizeBufferAccessC::CopyFrom(const SizeBufferAccessC &)
SizeBufferAccessC::Reverse(void)
SizeBufferAccessC::BufferFrom(UIntT)
SizeBufferAccessC::BufferFrom(UIntT,UIntT)
SizeBufferAccessC::operator ==(const SizeBufferAccessC &) const
SizeBufferAccessC::Copy(void) const
BufferAccessC::ReferenceElm(void) const
BufferAccessC::ReferenceVoid(void) const
BufferAccessC::IsValid(void) const
BufferAccessC::operator [](const IndexC) const
BufferAccessC::operator [](const IndexC)
BufferAccessC::operator +=(IndexC)
BufferAccessC::operator -=(IndexC)
BufferAccessC::operator -(IndexC) const
BufferAccessC::operator +(IndexC) const
BufferAccessC::operator ==(const BufferAccessC &) const
BufferAccessC::operator !=(const BufferAccessC &) const

   MatrixC   
 
Matrix of real values.
 
include "Ravl/Matrix.hh"
Created:24/01/2001 
Source file:Ravl/Math/LinearAlgebra/General/Matrix.hh
User Level:Normal
Library:RavlMath
In Scope:RavlN

Parent Classes: Derived Classes: Methods:
MatrixC()
Default constructor.

bool IsReal() const
Test if matrix only contains real values.
This will return false if either nan's (Not an number) or infinite values are found.

MatrixC(const VectorC & vec)
Treat vector as columb matrix.

MatrixC(UIntT rows,UIntT cols)
Construct a new matrix of rows x cols.

MatrixC(UIntT rows,UIntT cols,const RealT * data)
Construct a new matrix of rows x cols with row wise array of data.

MatrixC(const TMatrixC<RealT> & oth)
Base class constructor.

MatrixC(const SArray2dC<RealT> & oth)
Base class constructor.

MatrixC(RealT v1,RealT v2,RealT v3,RealT v4)
Construct a 2 x 2 matrix from given values.

MatrixC(RealT v1,RealT v2,RealT v3,RealT v4,RealT v5,RealT v6,RealT v7,RealT v8,RealT v9)
Construct a 3 x 3 matrix from given values.

MatrixC(const TFMatrixC<RealT,N,M> & fmat)
Construct from fixed size matrix.

MatrixC Inverse() const
Calculate the inverse of this matrix.
an invalid matrix is returned if this matrix is singular.

bool InverseIP()
Calculate the inverse of this matrix in place.
Returns false if matrix is singular.

Notes: The matrix must be square

If the matrix is not stored in a continous area of memory a slightly different routine is used to do the inversion.


MatrixC PseudoInverse(RealT thresh = 1 e - 5) const
Do a pseudo inverse
Uses singular value decomposition to decompose the matrix, and sets the singular values smaller than 'thesh' to zero.

RealT Det() const
Calculate the determinant of the matrix.

#include "Ravl/TMatrix.hh"
operator TFMatrixC<RealT,N,M>()
Convert to fixed size matrix.

SizeT Rows() const
Return the number of rows

SizeT Cols() const
Return the number of columns

TMatrixC<RealT> operator *(RealT val) const
Multiply by a constant.

TVectorC<RealT> operator *(const TVectorC<RealT> & vector) const
Multiplication "TVectorC" = "This" * vector

TMatrixC<RealT> operator *(const TMatrixC<RealT> & mat) const
Multiplication "result" = "this" * "mat"

TMatrixC<RealT> MulT(const TMatrixC<RealT> & B) const
Multiplication A * B.T()

TMatrixC<RealT> TMul(const TMatrixC<RealT> & B) const
Multiplication A.T() * B

TVectorC<RealT> TMul(const TVectorC<RealT> & vec) const
Multiplication A.T() * vec

TMatrixC<RealT> AAT() const
Return A * A.T().

TMatrixC<RealT> ATA() const
Return A.T() * A.

TMatrixC<RealT> T() const
Get transpose of matrix.

static TMatrixC<RealT> Identity(UIntT n)
Returns an identity matrx of n by n.
NB. This is a static function and should be called MatrixC::Identity(n). where n is the size of the matrix.

const TMatrixC<RealT> & SetDiagonal(const TVectorC<RealT> & d)
Set the diagonal of this matrix.
If d.Size() != Cols() an error is given.

const TMatrixC<RealT> & AddDiagonal(const TVectorC<RealT> & d)
Add a vector to the diagonal of this matrix.
If d.Size() != Cols() an error is given.

TMatrixC<RealT> SubMatrix(SizeT size1,SizeT size2)
Get sub matrix of size1,size2.
The creates a new access, but does not copy the data itself. The matrix always starts from 0,0.

RealT SumOfAbs() const
Sum the absolute values of all members of the matrix.

const TMatrixC<RealT> & AddOuterProduct(const TVectorC<RealT> & vec1,const TVectorC<RealT> & vec2)
Add outer product of vec1 and vec2 to this matrix.

const TMatrixC<RealT> & AddOuterProduct(const TVectorC<RealT> & vec1,const TVectorC<RealT> & vec2,const RealT & a)
Add outer product of vec1 and vec2 multiplied by a to this matrix .

const TMatrixC<RealT> & SetSmallToBeZero(const RealT & min)
Set values smaller than 'min' to zero in vector.

void SwapRows(int i,int j)
Swap two rows in the matrix.

#include "Ravl/SArray2d.hh"
SArray2dC<RealT> Copy() const
Copy array.

Special operations
Buffer2dC<RealT> & Buffer()
Access base data buffer.
Experts only!

const Buffer2dC<RealT> & Buffer() const
Constant access base data buffer.
Experts only!

SArray1dC<RealT> AsVector(bool alwaysCopy = false)
Access 2d array as 1d vector.
This will only copy the data if the data isn't continuous or alwaysCopy is true, this can make it much more effecient than a straigh copy.

SArray2dC<RealT> operator +(const SArray2dC<RealT> & arr) const
Sums 2 numerical arrays. The operator returns the result as a new array.

SArray2dC<RealT> operator -(const SArray2dC<RealT> & arr) const
Subtracts 2 numerical arrays. The operator returns the result as a new array.

SArray2dC<RealT> operator *(const SArray2dC<RealT> & arr) const
Mutliplies 2 numerical arrays. The operator returns the result as a new array.

SArray2dC<RealT> operator /(const SArray2dC<RealT> & arr) const
Devides 2 numerical arrays. The operator returns the result as a new array.

SArray2dC<RealT> operator *(const RealT & number) const
Multiplys the array by the 'number'. The operator returns the result as a new array.

SArray2dC<RealT> operator /(const RealT & number) const
Divides all array items by the 'number'. The operator returns the result as a new array.

SArray2dC<RealT> operator +(const RealT & number) const
Adds 'number' to the array. The operator returns the result as a new array.

SArray2dC<RealT> operator -(const RealT & number) const
Subtracts 'number' from all array items. The operator returns the result as a new array.

const SArray2dC<RealT> & operator +=(const SArray2dC<RealT> & arr)
Adds the 2nd array to this array.

const SArray2dC<RealT> & operator -=(const SArray2dC<RealT> & arr)
Subtracts the 2nd array from this array.

const SArray2dC<RealT> & operator *=(const SArray2dC<RealT> & arr)
Multiplies the 2nd array to this array.

const SArray2dC<RealT> & operator /=(const SArray2dC<RealT> & arr)
Divides the 2nd array from this array.

const SArray2dC<RealT> & operator +=(const RealT & number)
Adds 'number' to all array items.

const SArray2dC<RealT> & operator -=(const RealT & number)
Subtracts 'number' from all array items.

const SArray2dC<RealT> & operator *=(const RealT & number)
Multiplies the array by the 'number'.

const SArray2dC<RealT> & operator /=(const RealT & number)
Divides the array elements by the 'number'.

RealT SumSqr() const
Calculate the sum of the squares of all the elements in the array

RealT Sum() const
Returns the sum all elements of the array.

Slice1dC<RealT> Diagonal()
Take a slice along the diagonal of the array.

SArray1dC<RealT> SliceRow(IndexC i)
Access row as 1d array.
NB. Changes made to the slice will also affect this array!

Slice1dC<RealT> SliceColumn(IndexC i)
Access columb as 1d slice.
NB. Changes made to the slice will also affect this array!

void SetColumn(IndexC i,const SArray1dC<RealT> & val)
Set the values in the column i to those in 'val'.
'val' must have a size equal to the number of rows.

void SetRow(IndexC i,const SArray1dC<RealT> & val)
Set the values in the row i to those in 'val'.
'val' must have a size equal to the number of columns

void BuildAccess(UIntT offset = 0,UIntT stride = 0)

#include "Ravl/SBfAcc2d.hh"
bool Contains(const Index2dC & i) const
Does this buffer contain the index i ?
Returns true if yes.

RealT & operator [](const Index2dC & i)
access to the item array[(i)]

const RealT & operator [](const Index2dC & i) const
return the item array[(i)]

SizeBufferAccessC<RealT> operator [](IndexC i)
access to the item array[(i)]

const SizeBufferAccessC<RealT> operator [](IndexC i) const
return the item array[(i)]

SizeT Size1() const
Size.

SizeT Size2() const
Size.

UIntT Size() const
Get the total number of elements in the array.

void Fill(const RealT & d)
Fill array with value.

IntT Stride() const
Get the stide of the 2d array.

bool IsContinuous() const
Test if the array is allocated in a continous area of memory.
Note: this only checks the first two rows follow each other in memory, this may miss other discontunities.

#include "Ravl/SBfAcc.hh"
const SizeBufferAccessC<BufferAccessC<DataT>> & operator =(BufferAccessC<DataT> * bp)
Changes the reference element to the element pointed by 'bp'. Access to the object --------------------

BufferAccessC<DataT> * DataStart() const
Returns the address of the first element of the buffer.

SizeT Size() const
Returns the number of elements of the array.

IndexRangeC Limits() const
Returns the usable range of indeces expressed by this object.

IndexRangeC Range() const
Returns the usable range of indeces expressed by this object.

IndexC IMin() const
Returns the minimum index of the range of this access.

IndexC IMax() const
Returns the maximum index of the range of this access.

const BufferAccessC<DataT> & operator [](const IndexC i) const
Read-only access to the ('i'+1)-th element of the buffer.

BufferAccessC<DataT> & operator [](const IndexC i)
Read-write access to the ('i'+1)-th element of the buffer.

const SizeBufferAccessC<BufferAccessC<DataT>> & SAccess(void) const
Returns this object. Logical functions -----------------

bool IsEmpty() const
Returns TRUE if the size of the array is zero.

bool Contains(IndexC i) const
Returns TRUE if the array contains an item with the index 'i'. Modifications of the access ---------------------------

SizeT ShrinkHigh(SizeT k)
Changes the number of elements by subtracting the last 'k' elements.

const SizeBufferAccessC<BufferAccessC<DataT>> & Swap(SizeBufferAccessC<BufferAccessC<DataT>> & a)
Exchanges the contents of this buffer with buffer 'a'.

void Attach(const SizeBufferAccessC<BufferAccessC<DataT>> & b)
Changes this buffer access to have the same access rights as 'b'.

void Attach(const BufferAccessC<BufferAccessC<DataT>> & b,SizeT size)
Changes this buffer access to have the access rights as 'b' limited for 'size' elements.

SizeBufferAccessC<BufferAccessC<DataT>> operator +(SizeT i) const
Creates the new access object shifted 'i' elements to the right (towards next elements). The size is descreased to fit the the original range of this access. Modifications of the buffer contents ------------------------------------

void Fill(const BufferAccessC<DataT> & d)
'd' value is assigned to all elements of the buffer.

void CopyFrom(const SizeBufferAccessC<BufferAccessC<DataT>> & oth)
Copy contents of another buffer into this one.
NB. Buffers MUST be the same length.

void Reverse()
Reverse the order of elements in this array in place.

SizeBufferAccessC<BufferAccessC<DataT>> BufferFrom(UIntT first)
Get an access for this buffer starting from the 'first' element to the end of the buffer.

SizeBufferAccessC<BufferAccessC<DataT>> BufferFrom(UIntT first,UIntT len)
Get an access for this buffer starting from the 'first' element for 'len' elements.
An error will be generated if the requested buffer isn't contains within this one.

bool operator ==(const SizeBufferAccessC<BufferAccessC<DataT>> & ba) const
Are two accesses the same ?

SizeBufferAccessC<BufferAccessC<DataT>> Copy(void) const
Returns a physical copy of this access pointing to the physical copy of the accessed buffer in the range accessible by this access. The new copy is necessary to attach to reference counted buffer or to delete at the end of the life of this object.

#include "Ravl/BufferAccess.hh"
BufferAccessC<DataT> * ReferenceElm() const
Returns the pointer to the reference element of the attached buffer. The reference element need not to be the valid element of the buffer.

void * ReferenceVoid() const
Returns the pointer to the reference element of the attached buffer. The reference element need not to be the valid element of the buffer. The function is intended to be used in printing.

bool IsValid() const
Returns TRUE if this buffer access is not a default access object.

const BufferAccessC<DataT> & operator [](const IndexC i) const
Read-only access to the ('i'+1)-th element of the buffer.

BufferAccessC<DataT> & operator [](const IndexC i)
Read-write access to the ('i'+1)-th element of the buffer.

const BufferAccessC<BufferAccessC<DataT>> & operator +=(IndexC ind)
Inplace Add index to start position.

const BufferAccessC<BufferAccessC<DataT>> & operator -=(IndexC ind)
Inplace Subtract index from start position.

BufferAccessC<BufferAccessC<DataT>> operator -(IndexC ind) const
Substract value from position, and return it as a new value.

BufferAccessC<BufferAccessC<DataT>> operator +(IndexC ind) const
Substract value from position, and return it as a new value.

bool operator ==(const BufferAccessC<BufferAccessC<DataT>> & ba) const
Are two accesses the same ?

bool operator !=(const BufferAccessC<BufferAccessC<DataT>> & ba) const
Are two accesses the same ?


Maintainer:Charles Galambos, Created: 24/01/2001, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002