LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::forwardSubstitution< T > Class Template Reference

Forward substitution. More...

#include <ltiForwardSubstitution.h>

Inheritance diagram for lti::forwardSubstitution< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::forwardSubstitution< T >:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class forwardSubstitution More...

Public Member Functions

 forwardSubstitution ()
 forwardSubstitution (const matrix< T > &theMatrix, const typename parameters::eTriangularType &tType=parameters::Lower)
 forwardSubstitution (const parameters &par)
 forwardSubstitution (const forwardSubstitution &other)
virtual ~forwardSubstitution ()
virtual const char * getTypeName () const
bool apply (vector< T > &b) const
bool apply (const vector< T > &b, vector< T > &x) const
bool apply (const matrix< T > &theMatrix, vector< T > &b, const typename parameters::eTriangularType &tType) const
bool apply (const matrix< T > &theMatrix, const vector< T > &b, vector< T > &x, const typename parameters::eTriangularType &tType) const
bool apply (matrix< T > &b) const
bool apply (const matrix< T > &b, matrix< T > &x) const
bool apply (const matrix< T > &theMatrix, matrix< T > &b, const typename parameters::eTriangularType &tType) const
bool apply (const matrix< T > &theMatrix, const matrix< T > &b, matrix< T > &x, const typename parameters::eTriangularType &tType) const
forwardSubstitutioncopy (const forwardSubstitution &other)
forwardSubstitutionoperator= (const forwardSubstitution &other)
virtual functorclone () const
const parametersgetParameters () const

Detailed Description

template<class T>
class lti::forwardSubstitution< T >

Forward substitution.

Let L be a lower triangular matrix and U an upper triangular matrix. Forward substitution solves the following linear equation systems for x:

L*x=b or x*U=b

In the first case, x and b are column vectors, in the latter case they are row vectors. The data matrix can be given to the functor via the parameters or directly in the apply methods. There are also apply methods that calculate the forward substitution for multiple right-sides b. The vectors are treated as before, ie they are in columns for the first case and in rows for the second.

Note that the column vector matrix will be transposed twice and thus takes longer to compute, try to use the vector-apply instead.

See also:
lti::backSubstitution

Constructor & Destructor Documentation

template<class T >
lti::forwardSubstitution< T >::forwardSubstitution (  ) 

default constructor

template<class T >
lti::forwardSubstitution< T >::forwardSubstitution ( const matrix< T > &  theMatrix,
const typename parameters::eTriangularType tType = parameters::Lower 
)

constructor, sets the data matrix and its triangular type in the parameters.

Note: Using this constructor, the data matrix is copied twice (Once to internally put it into a parameters object and then when setting the parameters). It can be better to let parameters::theMatrix use the data of some matrix you have:

 matrix<double> myData; //let this contain the data
 forwardSubstitution<double>::parameters param;
 param.theMatrix.useExternData(myData.rows(),myData.columns(),&myData.at(0,0))
 forwardSubstitution<double> mySubst(param);

The fastest method is to use one of the apply-methods where the data matrix is an argument.

Parameters:
theMatrix the data matrix
tType triangularType of theMatrix
template<class T >
lti::forwardSubstitution< T >::forwardSubstitution ( const parameters par  ) 

Construct a functor using the given parameters.

template<class T >
lti::forwardSubstitution< T >::forwardSubstitution ( const forwardSubstitution< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied
template<class T >
virtual lti::forwardSubstitution< T >::~forwardSubstitution (  )  [virtual]

destructor


Member Function Documentation

template<class T >
bool lti::forwardSubstitution< T >::apply ( const matrix< T > &  theMatrix,
const matrix< T > &  b,
matrix< T > &  x,
const typename parameters::eTriangularType tType 
) const

Performs forward substitution with unknowns X.

L*X=B if theMatrix is lower triagonal and X*U=B if theMatrix is upper triagonal. In the first case X and B contain the vectors in colums, in the latter case in rows.

Parameters:
theMatrix data matrix (L or U)
b the right side of the forward substitution. The result will be left here too.
x the result
tType defines whether theMatrix is lower or upper triangular
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( const matrix< T > &  theMatrix,
matrix< T > &  b,
const typename parameters::eTriangularType tType 
) const

Performs forward substitution with unknowns X.

L*X=B if theMatrix is lower triagonal and X*U=B if theMatrix is upper triagonal. In the first case X and B contain the vectors in colums, in the latter case in rows. The result x is left in b.

Parameters:
theMatrix data matrix (L or U)
b the right side of the forward substitution. The result will be left here too.
tType defines whether theMatrix is lower or upper triangular
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( const matrix< T > &  b,
matrix< T > &  x 
) const

Performs forward substitution with unknowns X.

L*X=B if theMatrix is lower triagonal and X*U=B if theMatrix is upper triagonal. In the first case X and B contain the vectors in colums, in the latter case in rows. The data matrix in the parameters is used.

Parameters:
b the right side of the forward substitution.
x the result
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( matrix< T > &  b  )  const

Performs forward substitution with unknowns X.

L*X=B if theMatrix is lower triagonal and X*U=B if theMatrix is upper triagonal. In the first case X and B contain the vectors in colums, in the latter case in rows. The result x is left in b. The matrix in the parameters is used.

Parameters:
b the right side of the forward substitution. The result will be left here too.
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( const matrix< T > &  theMatrix,
const vector< T > &  b,
vector< T > &  x,
const typename parameters::eTriangularType tType 
) const

Performs forward substitution with unknown x.

L*x=b if theMatrix is lower triagonal and x*U=b if theMatrix is upper triagonal.

Parameters:
theMatrix data matrix (L or U)
b the right side of the forward substitution. The result will be left here too.
x the result.
tType defines whether theMatrix is lower or upper triangular
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( const matrix< T > &  theMatrix,
vector< T > &  b,
const typename parameters::eTriangularType tType 
) const

Performs forward substitution with unknown x.

L*x=b if theMatrix is lower triagonal and x*U=b if theMatrix is upper triagonal. The result x is left in b.

Parameters:
theMatrix data matrix (L or U)
b the right side of the forward substitution. The result will be left here too.
tType defines whether theMatrix is lower or upper triangular
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( const vector< T > &  b,
vector< T > &  x 
) const

Performs forward substitution with unknown x.

L*x=b if theMatrix is lower triagonal and x*U=b if theMatrix is upper triagonal. The matrix in the parameters is used.

Parameters:
b the right side of the forward substitution.
x the result.
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::forwardSubstitution< T >::apply ( vector< T > &  b  )  const

Performs forward substitution with unknown x.

L*x=b if theMatrix is lower triagonal and x*U=b if theMatrix is upper triagonal. The result x is left in b. The matrix in the parameters is used.

Parameters:
b the right side of the forward substitution. The result will be left here too.
Returns:
true if apply successful or false otherwise.
template<class T >
virtual functor* lti::forwardSubstitution< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

template<class T >
forwardSubstitution& lti::forwardSubstitution< T >::copy ( const forwardSubstitution< T > &  other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

template<class T >
const parameters& lti::forwardSubstitution< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

template<class T >
virtual const char* lti::forwardSubstitution< T >::getTypeName (  )  const [virtual]

returns the name of this type ("forwardSubstitution")

Reimplemented from lti::linearAlgebraFunctor.

template<class T >
forwardSubstitution& lti::forwardSubstitution< T >::operator= ( const forwardSubstitution< T > &  other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:20 2010 for LTI-Lib by Doxygen 1.6.1