Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Matrix< S, MatrixBaseType > Class Template Reference

#include <Matrix.h>

List of all members.


Detailed Description

template<typename S, typename MatrixBaseType>
class Matrix< S, MatrixBaseType >

Square lower triangular, upper triangular, symmetric or general rectangular matrix with indices based on arbitrary bases a,b stored in row major order. This means that the indices used with the subscripting operators are

where rows and cols are the number of rows and columns respectively.

Parameters:
S type of matrix entries.
MatrixBaseType: UpperTriangular<S>, LowerTriangular<S>, Symmetric<S> or Rectangular<S>.

Definition at line 735 of file Matrix.h.

Public Types

typedef MatrixBaseType::TransposeType TransposeType

Public Member Functions

void deallocate ()
S ** getData () const
int getRowIndexBase () const
void setRowIndexBase (int r)
int getColIndexBase () const
void setColIndexBase (int c)
S & operator() (int i, int j)
const S & operator() (int i, int j) const
void testEquals (const Matrix &B, S precision, S epsilon, string test) const
 Matrix (int dim, int c=0)
 Matrix (int nRows, int nCols, int row_base, int col_base)
 Matrix (const Matrix &A)
template<int dim>  Matrix (S A[dim][dim], int row_base=0, int col_base=0)
Matrix & operator= (const Matrix &B)
Real norm () const
Real rowNorm (int i) const
Real colNorm (int j)
Matrix & scaleRow (int i, Real f)
Matrix & scaleCol (int j, Real f)
quadraticForm (const Vector< S > &x) const
Matrix< S, TransposeType > & transpose () const
Matrix & operator+= (const Matrix &B)
Matrix & operator *= (Real f)
Matrix & operator *= (const Matrix &B)
Matrix & operator^= (const Matrix< S, TransposeType > &B)
Matrix< S, UpperTriangular<
S > > & 
aat () const
Matrix & exp () const
std::ostream & printSelf (std::ostream &os) const

Protected Attributes

int a
int b

Static Protected Attributes

cache [SMALL][SMALL] = { }


Member Typedef Documentation

template<typename S, typename MatrixBaseType>
typedef MatrixBaseType::TransposeType Matrix< S, MatrixBaseType >::TransposeType
 

The type of the matrix: UpperTriangular<S>, LowerTriangular<S>,...

Definition at line 748 of file Matrix.h.


Constructor & Destructor Documentation

template<typename S, typename MatrixBaseType>
Matrix< S, MatrixBaseType >::Matrix int    dim,
int    c = 0
[inline]
 

Constructor for square matrix with both row and column index base = a, all components intialized with zeroes.

Parameters:
dim square matrix: rows=cols=dim.
c index base (i,j=c,...,c+dim-1), default 0.

Definition at line 846 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix< S, MatrixBaseType >::Matrix int    nRows,
int    nCols,
int    row_base,
int    col_base
[inline]
 

Rectangular matrix, all components intialized with zeroes.

Parameters:
nRows number of rows.
nCols number of columns.
row_base row index base.
col_base column index base.

Definition at line 855 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix< S, MatrixBaseType >::Matrix const Matrix< S, MatrixBaseType > &    A [inline]
 

Copy constructor, matrix types must be equal.

Definition at line 864 of file Matrix.h.

template<typename S, typename MatrixBaseType>
template<int dim>
Matrix< S, MatrixBaseType >::Matrix   A[dim][dim],
int    row_base = 0,
int    col_base = 0
[inline]
 

Construct from square data array, zero based indices only. Cannot be extended to the nonsquare case as template parameters cannot be deduced. All matrix types, only the relevant array entries are used.

Parameters:
A data array A[dim][dim] with entries of type S.
row_base row index base (default 0).
col_base column index base (default 0).

Definition at line 881 of file Matrix.h.


Member Function Documentation

template<typename S, typename MatrixBaseType>
void Matrix< S, MatrixBaseType >::deallocate   [inline]
 

Definition at line 753 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::operator *=(), and Matrix< Real, UpperTriangular< Real > >::operator^=().

template<typename S, typename MatrixBaseType>
S** Matrix< S, MatrixBaseType >::getData   const [inline]
 

Pointer to data.

Definition at line 758 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::operator *=(), and Matrix< Real, UpperTriangular< Real > >::operator^=().

template<typename S, typename MatrixBaseType>
int Matrix< S, MatrixBaseType >::getRowIndexBase   const [inline]
 

Row index base a, row indices i=a,a+1,...,a+rows-1

Definition at line 761 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::operator=(), and Matrix< Real, UpperTriangular< Real > >::testEquals().

template<typename S, typename MatrixBaseType>
void Matrix< S, MatrixBaseType >::setRowIndexBase int    r [inline]
 

Row index base set equal to r.

Definition at line 763 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::exp().

template<typename S, typename MatrixBaseType>
int Matrix< S, MatrixBaseType >::getColIndexBase   const [inline]
 

Column index base b, column indices j=b,b+1,...,b+cols-1

Definition at line 766 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::operator=(), and Matrix< Real, UpperTriangular< Real > >::testEquals().

template<typename S, typename MatrixBaseType>
void Matrix< S, MatrixBaseType >::setColIndexBase int    c [inline]
 

Column index base set equal to r.

Definition at line 768 of file Matrix.h.

template<typename S, typename MatrixBaseType>
S& Matrix< S, MatrixBaseType >::operator() int    i,
int    j
[inline]
 

Subscripting relative to the index bases a,b, that is, we use indices

Definition at line 774 of file Matrix.h.

template<typename S, typename MatrixBaseType>
const S& Matrix< S, MatrixBaseType >::operator() int    i,
int    j
const [inline]
 

Subscripting relative to the index bases a,b, that is, we use indices

Definition at line 786 of file Matrix.h.

template<typename S, typename MatrixBaseType>
void Matrix< S, MatrixBaseType >::testEquals const Matrix< S, MatrixBaseType > &    B,
  precision,
  epsilon,
string    test
const [inline]
 

Test for entry by entry equality. Matrix types must be equal. Type S must support absolute value and comparison ">". Equality is defined by an upper bound on the acceptable relative error in percent.

Parameters:
B matrix to compare this with.
precision upper bound on the acceptable relative error in percent.
epsilon zero denominator reset to epsilon.
test string printed to identify test.

Definition at line 807 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::operator= const Matrix< S, MatrixBaseType > &    B [inline]
 

Assignement, matrix types and sizes must be equal.

Definition at line 892 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Real Matrix< S, MatrixBaseType >::norm   const [inline]
 

Square root of sum of absolute values of entries squared. Type S must support absolute value abs(S& s) mapping to Real.

Definition at line 915 of file Matrix.h.

Referenced by Matrix< Real, UpperTriangular< Real > >::exp().

template<typename S, typename MatrixBaseType>
Real Matrix< S, MatrixBaseType >::rowNorm int    i const [inline]
 

L2-norm of row i. Type S must have a function abs(S& s) (absolute value mapping to Real).

Definition at line 929 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Real Matrix< S, MatrixBaseType >::colNorm int    j [inline]
 

L2-norm of column j. Type S must have a function Real fabs(S s) (absolute value mapping to Real).

Definition at line 942 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::scaleRow int    i,
Real    f
[inline]
 

Multiplication of row i by scalar f. Uses row index i relative to the base.

Definition at line 955 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::scaleCol int    j,
Real    f
[inline]
 

Multiplication of column j by scalar f. Uses column index j relative to the base.

Definition at line 965 of file Matrix.h.

template<typename S, typename MatrixBaseType>
S Matrix< S, MatrixBaseType >::quadraticForm const Vector< S > &    x const [inline]
 

The quadratic form where C is the symmetric matrix of which this is the upper half.

Definition at line 979 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix<S,TransposeType>& Matrix< S, MatrixBaseType >::transpose   const [inline]
 

Transpose. Must allocate new memory to preserve row major order.

Definition at line 1002 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::operator+= const Matrix< S, MatrixBaseType > &    B [inline]
 

Matrix addition. Dimensions and types must match (not checked), index bases need not.

Definition at line 1016 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::operator *= Real    f [inline]
 

Multiplication of matrix by a Real scalar

Definition at line 1032 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::operator *= const Matrix< S, MatrixBaseType > &    B [inline]
 

Multiplication on the right by the matrix B of the same type. Dimensional compatibility not checked.

Definition at line 1045 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::operator^= const Matrix< S, TransposeType > &    B [inline]
 

RIGHT multiplication of this by the transpose B'. Because of row major allocation the matrix product AB' is faster than AB. Dimensions and types of A,B' must match (not checked), bases need not.

Definition at line 1098 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix< S,UpperTriangular<S> >& Matrix< S, MatrixBaseType >::aat   const [inline]
 

The upper half of the product C=RR', where R=this. Zero based indexation.

Definition at line 1152 of file Matrix.h.

template<typename S, typename MatrixBaseType>
Matrix& Matrix< S, MatrixBaseType >::exp   const [inline]
 

Matrix exponential exp(A).

Reimplemented in UTRRealMatrix.

Definition at line 1172 of file Matrix.h.

template<typename S, typename MatrixBaseType>
std::ostream& Matrix< S, MatrixBaseType >::printSelf std::ostream &    os const [inline]
 

Definition at line 1212 of file Matrix.h.


Member Data Documentation

template<typename S, typename MatrixBaseType>
int Matrix< S, MatrixBaseType >::a [protected]
 

Definition at line 739 of file Matrix.h.

template<typename S, typename MatrixBaseType>
int Matrix< S, MatrixBaseType >::b [protected]
 

Definition at line 740 of file Matrix.h.

template<typename S, typename MatrixBaseType>
S Matrix< S, MatrixBaseType >::cache = { } [static, protected]
 

Definition at line 1233 of file Matrix.h.


The documentation for this class was generated from the following file:
Generated on Mon Sep 22 02:16:33 2003 for Libor-Library by doxygen1.3-rc3