CVR-Lib last update 20 Sep 2009

cvr::qrDecomposition< T > Class Template Reference
[Linear Algebra]

This functor computes a QRDecomposition of a given rectangular m x n Matrix A of the Form:. More...

#include <cvrQrDecomposition.h>

Inheritance diagram for cvr::qrDecomposition< T >:

Inheritance graph
[legend]
Collaboration diagram for cvr::qrDecomposition< T >:

Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class qrDecomposition. More...

Public Member Functions

 qrDecomposition ()
 qrDecomposition (const parameters &par)
 qrDecomposition (const qrDecomposition &other)
virtual ~qrDecomposition ()
bool apply (matrix< T > &arh, vector< T > &tau, vector< integer > &p) const
bool apply (const matrix< T > &a, matrix< T > &rh, vector< T > &tau, vector< integer > &p) const
bool apply (matrix< T > &arh, vector< T > &tau) const
bool apply (const matrix< T > &a, matrix< T > &rh, vector< T > &tau) const
bool extractR (const matrix< T > &rh, matrix< T > &r) const
bool computeQ (const matrix< T > &rh, vector< T > &tau, matrix< T > &q) const
void buildPermutationMatrix (const vector< integer > &pv, matrix< T > &pm) const
bool apply (const matrix< T > &A, matrix< T > &Q, matrix< T > &R) const
qrDecompositioncopy (const qrDecomposition &other)
qrDecompositionoperator= (const qrDecomposition &other)
const std::string & name () const
virtual qrDecomposition< T > * clone () const
virtual qrDecomposition< T > * newInstance () const
const parametersgetParameters () const


Detailed Description

template<typename T>
class cvr::qrDecomposition< T >

This functor computes a QRDecomposition of a given rectangular m x n Matrix A of the Form:.

A = Q * R

Where R is an upper triangular m x m Matrix and Q is a m x n orthogonal matrix, i.e. the transposed matrix of Q multiplied with Q itself is the identity matrix.

If LAPACK is not used or not available, A must be of full rank!

 matrix<float> src(3,3);
 float data[] =  {1,2,3,4,5,6,7,8,9};
 src.fill(data);
 matrix<float> q,r;

 qrDecomposition<float> qrd;
 qrd.apply(src,q,r);

 matrix<float> result;
 result.multiply(q,r);

 std::cout << "Q:\n" << q << "\n";
 std::cout << "R:\n" << r << "\n";
 // should be identical to src
 std::cout << "A = Q * R:\n"<< result << "\n";

Constructor & Destructor Documentation

template<typename T>
cvr::qrDecomposition< T >::qrDecomposition (  ) 

Default constructor.

template<typename T>
cvr::qrDecomposition< T >::qrDecomposition ( const parameters par  ) 

Construct a functor using the given parameters.

template<typename T>
cvr::qrDecomposition< T >::qrDecomposition ( const qrDecomposition< T > &  other  ) 

Copy constructor.

Parameters:
other the object to be copied

template<typename T>
virtual cvr::qrDecomposition< T >::~qrDecomposition (  )  [virtual]

Destructor.


Member Function Documentation

template<typename T>
bool cvr::qrDecomposition< T >::apply ( const matrix< T > &  A,
matrix< T > &  Q,
matrix< T > &  R 
) const

Computes the QR decomposition.

Warning:
You usually don't need this explicit decomposition, since most methods use the compact outputs of the other apply() to speed up the computations. However, this is provided for completeness.
Parameters:
A input m x n matrix.
Q Q is a m x n orthogonal matrix.
R R is an upper triangular m x m matrix.
Returns:
true if successful or false otherwise.

template<typename T>
bool cvr::qrDecomposition< T >::apply ( const matrix< T > &  a,
matrix< T > &  rh,
vector< T > &  tau 
) const

Apply QR (on copy).

Parameters:
a The source matrix on input
rh The compact representation (R + elementary reflectors) on output
tau The beta components on output
Returns:
true if the application was successful, false otherwise

template<typename T>
bool cvr::qrDecomposition< T >::apply ( matrix< T > &  arh,
vector< T > &  tau 
) const

Apply QR (in place).

Parameters:
arh The source matrix on input, and on output the compact representation (R + elementary reflectors)
tau The beta components on output
Returns:
true if the application was successful, false otherwise

template<typename T>
bool cvr::qrDecomposition< T >::apply ( const matrix< T > &  a,
matrix< T > &  rh,
vector< T > &  tau,
vector< integer > &  p 
) const

Apply QR using column pivoting (on copy).

Parameters:
a The source matrix on input
rh The compact representation (R + elementary reflectors) on output
tau The beta components on output
p The column permutation vector on output
Returns:
true if the application was successful, false otherwise

template<typename T>
bool cvr::qrDecomposition< T >::apply ( matrix< T > &  arh,
vector< T > &  tau,
vector< integer > &  p 
) const

Apply QR using column pivoting (in place).

Parameters:
arh The source matrix on input, and on output the compact representation (R + elementary reflectors)
tau The beta components on output
p The column permutation vector on output
Returns:
true if the application was successful, false otherwise

template<typename T>
void cvr::qrDecomposition< T >::buildPermutationMatrix ( const vector< integer > &  pv,
matrix< T > &  pm 
) const

Builds the permutation matrix for the given permutation vector.

Parameters:
pv The column permutation vector on input
pm The column permutation matrix on output

template<typename T>
virtual qrDecomposition<T>* cvr::qrDecomposition< T >::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::functor.

template<typename T>
bool cvr::qrDecomposition< T >::computeQ ( const matrix< T > &  rh,
vector< T > &  tau,
matrix< T > &  q 
) const

Compute Q from RH and tau.

Parameters:
rh The compact representation (R + elementary reflectors) on input
tau The beta components on input
q Q on output

template<typename T>
qrDecomposition& cvr::qrDecomposition< T >::copy ( const qrDecomposition< T > &  other  ) 

Copy data of "other" functor.

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

template<typename T>
bool cvr::qrDecomposition< T >::extractR ( const matrix< T > &  rh,
matrix< T > &  r 
) const

Extract R from RH.

Parameters:
rh The compact representation (R + elementary reflectors) on input
r R on output

template<typename T>
const parameters& cvr::qrDecomposition< T >::getParameters (  )  const

Returns used parameters.

Reimplemented from cvr::linearAlgebraFunctor.

template<typename T>
const std::string& cvr::qrDecomposition< T >::name (  )  const [virtual]

Returns the name of this class.

Reimplemented from cvr::lapackInterface.

template<typename T>
virtual qrDecomposition<T>* cvr::qrDecomposition< T >::newInstance (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::functor.

template<typename T>
qrDecomposition& cvr::qrDecomposition< T >::operator= ( const qrDecomposition< T > &  other  ) 

Alias for copy member.

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


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

Generated on Sun Sep 20 22:09:01 2009 for CVR-Lib by Doxygen 1.5.8