latest version v1.9 - last update 10 Apr 2010 |
Backsubstitution. More...
#include <ltiBackSubstitution.h>
Classes | |
class | parameters |
the parameters for the class backSubstitution More... | |
Public Member Functions | |
backSubstitution () | |
backSubstitution (const matrix< T > &theMatrix, const typename parameters::eTriangularType &tType=parameters::Lower) | |
backSubstitution (const parameters &par) | |
backSubstitution (const backSubstitution &other) | |
virtual | ~backSubstitution () |
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 |
backSubstitution & | copy (const backSubstitution &other) |
backSubstitution & | operator= (const backSubstitution &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
Backsubstitution.
Let L be a lower triangular matrix and U an upper triangular matrix. Backsubstitution solves the following linear equation systems for x:
U*x=b or x*L=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 backsubstitution 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.
lti::backSubstitution< T >::backSubstitution | ( | ) |
default constructor
lti::backSubstitution< T >::backSubstitution | ( | 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
backSubstitution<double>::parameters param;
param.theMatrix.useExternData(myData.rows(),myData.columns(),&myData.at(0,0))
backSubstitution<double> mySubst(param);
The fastest method is to use one of the apply-methods where the data matrix is an argument.
theMatrix | the data matrix | |
tType | triangularType of theMatrix |
lti::backSubstitution< T >::backSubstitution | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::backSubstitution< T >::backSubstitution | ( | const backSubstitution< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::backSubstitution< T >::~backSubstitution | ( | ) | [virtual] |
destructor
bool lti::backSubstitution< T >::apply | ( | const matrix< T > & | theMatrix, | |
const matrix< T > & | b, | |||
matrix< T > & | x, | |||
const typename parameters::eTriangularType & | tType | |||
) | const |
Performs backsubstitution with unknowns X.
U*X=B if theMatrix is upper triagonal and X*L=B if theMatrix is lower triagonal. In the first case X and B contain the vectors in colums, in the latter case in rows.
theMatrix | data matrix (L or U) | |
b | the right side of the backsubstitution. The result will be left here too. | |
x | the result | |
tType | defines whether theMatrix is lower or upper triangular |
bool lti::backSubstitution< T >::apply | ( | const matrix< T > & | theMatrix, | |
matrix< T > & | b, | |||
const typename parameters::eTriangularType & | tType | |||
) | const |
Performs backsubstitution with unknowns X.
U*X=B if theMatrix is upper triagonal and X*L=B if theMatrix is lower 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.
theMatrix | data matrix (L or U) | |
b | the right side of the backsubstitution. The result will be left here too. | |
tType | defines whether theMatrix is lower or upper triangular |
bool lti::backSubstitution< T >::apply | ( | const matrix< T > & | b, | |
matrix< T > & | x | |||
) | const |
Performs backsubstitution with unknowns X.
U*X=B if theMatrix is upper triagonal and X*L=B if theMatrix is lower 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.
b | the right side of the backsubstitution. | |
x | the result |
bool lti::backSubstitution< T >::apply | ( | matrix< T > & | b | ) | const |
Performs backsubstitution with unknowns X.
U*X=B if theMatrix is upper triagonal and X*L=B if theMatrix is lower 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.
b | the right side of the backsubstitution. The result will be left here too. |
bool lti::backSubstitution< T >::apply | ( | const matrix< T > & | theMatrix, | |
const vector< T > & | b, | |||
vector< T > & | x, | |||
const typename parameters::eTriangularType & | tType | |||
) | const |
Performs backsubstitution with unknown x.
U*x=b if theMatrix is upper triagonal and x*L=b if theMatrix is lower triagonal.
theMatrix | data matrix (L or U) | |
b | the right side of the backsubstitution. The result will be left here too. | |
x | the result. | |
tType | defines whether theMatrix is lower or upper triangular |
bool lti::backSubstitution< T >::apply | ( | const matrix< T > & | theMatrix, | |
vector< T > & | b, | |||
const typename parameters::eTriangularType & | tType | |||
) | const |
Performs backsubstitution with unknown x.
U*x=b if theMatrix is upper triagonal and x*L=b if theMatrix is lower triagonal. The result x is left in b.
theMatrix | data matrix (L or U) | |
b | the right side of the backsubstitution. The result will be left here too. | |
tType | defines whether theMatrix is lower or upper triangular |
bool lti::backSubstitution< T >::apply | ( | const vector< T > & | b, | |
vector< T > & | x | |||
) | const |
Performs backsubstitution with unknown x.
U*x=b if theMatrix is upper triagonal and x*L=b if theMatrix is lower triagonal. The matrix in the parameters is used.
b | the right side of the backsubstitution. | |
x | the result. |
bool lti::backSubstitution< T >::apply | ( | vector< T > & | b | ) | const |
Performs backsubstitution with unknown x.
U*x=b if theMatrix is upper triagonal and x*L=b if theMatrix is lower triagonal. The result x is left in b. The matrix in the parameters is used.
b | the right side of the backsubstitution. The result will be left here too. |
virtual functor* lti::backSubstitution< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
backSubstitution& lti::backSubstitution< T >::copy | ( | const backSubstitution< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
const parameters& lti::backSubstitution< T >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::backSubstitution< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("backSubstitution")
Reimplemented from lti::linearAlgebraFunctor.
backSubstitution& lti::backSubstitution< T >::operator= | ( | const backSubstitution< T > & | other | ) |