STK++ 0.9.13
|
The class IQr is an interface class for the method computing the QR Decomposition of a ArrayXX. More...
#include <STK_IQr.h>
Public Member Functions | |
virtual | ~IQr () |
virtual destructor | |
IQr & | operator= (IQr const &decomp) |
Operator = : overwrite the this with decomp. | |
bool | isCompQ () const |
int | rank () const |
Array const & | Q () const |
give the matrix Q of the QR decomposition. | |
ArrayUpperTriangularXX const & | R () const |
give the matrix R of the QR decomposition. | |
void | setCompQ (bool compq) |
Set the compq_ flag. | |
virtual bool | run () |
Compute the QR decomposition. | |
void | compQ () |
Compute Q (to use after run). | |
void | popBackCols (int n=1) |
Delete the n last columns and update the QR decomposition. | |
void | eraseCol (int pos) |
Delete the column pos and update the QR decomposition. | |
template<class ColVector_ > | |
void | pushBackCol (ColVector_ const &T) |
Add a column with value T and update th QR decomposition. | |
template<class ColVector_ > | |
void | insertCol (ColVector_ const &T, int pos) |
Add a column with value T at the position pos and update the QR decomposition. | |
template<class OtherDerived > | |
void | setData (ExprBase< OtherDerived > const &data) |
overloading of setData. | |
![]() | |
String const & | error () const |
get the last error message. | |
![]() | |
Derived & | asDerived () |
static cast : return a reference of this with a cast to the derived class. | |
Derived const & | asDerived () const |
static cast : return a const reference of this with a cast to the derived class. | |
Derived * | asPtrDerived () |
static cast : return a ptr on a Derived of this with a cast to the derived class. | |
Derived const * | asPtrDerived () const |
static cast : return a ptr on a constant Derived of this with a cast to the derived class. | |
Derived * | clone () const |
create a leaf using the copy constructor of the Derived class. | |
Derived * | clone (bool isRef) const |
create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not. | |
Protected Types | |
typedef hidden::AlgebraTraits< Derived >::Array | Array |
typedef hidden::AlgebraTraits< Derived >::ColVector | ColVector |
typedef hidden::AlgebraTraits< Derived >::RowVector | RowVector |
Protected Member Functions | |
IQr (Array const &Q, bool ref=false) | |
Constructor. | |
template<class DerivedExpr > | |
IQr (ExprBase< DerivedExpr > const &Q) | |
Constructor. | |
IQr (IQr const &decomp) | |
Copy constructor. | |
![]() | |
IRunnerBase () | |
default constructor | |
IRunnerBase (IRunnerBase const &runner) | |
copy constructor | |
virtual | ~IRunnerBase () |
destructor | |
virtual void | update () |
update the runner. | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
Protected Attributes | |
Array | Q_ |
Q Array of the QR decomposition. | |
ArrayUpperTriangularXX | R_ |
R Array of th QR decomposition. | |
bool | compq_ |
is Q computed ? | |
int | rank_ |
estimated rank_ of the matrix A | |
![]() | |
String | msg_error_ |
String with the last error message. | |
bool | hasRun_ |
true if run has been used, false otherwise | |
The class IQr is an interface class for the method computing the QR Decomposition of a ArrayXX.
The QR decomposition of a matrix require
Computation of matrices Q
and R
is triggered by the run()
method. Some tuning parameters can be adjusted before running.
The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n).
Each H(i) has the form H(i) = I - tau * v * v'
run
method of IRunnerBase
by calling the derived method runImpl
|
protected |
|
protected |
|
protected |
|
inlineprotected |
Constructor.
Q | The matrix to decompose |
ref | is Q_ a reference ? (avoid data copy, but the original data set is destroyed) |
Definition at line 112 of file STK_IQr.h.
References STK::IQr< Derived >::Q(), and STKRUNTIME_ERROR_NO_ARG.
|
inlineprotected |
Constructor.
Q | The matrix to decompose |
Definition at line 122 of file STK_IQr.h.
References STK::IQr< Derived >::Q(), STK::IQr< Derived >::Q_, and STKRUNTIME_ERROR_NO_ARG.
Compute Q (to use after run).
After the run process, Q_ store the householder vector in its column. Call compQ, if you want to obtain Q in its true form. Without effect if (compq_ == true)
Definition at line 245 of file STK_IQr.h.
References _R, _T, STK::applyLeftHouseholderVector(), and stk_cout.
Delete the column pos and update the QR decomposition.
pos | the position of the column to delete |
Definition at line 298 of file STK_IQr.h.
References _R, STK::compGivens(), STK::IQr< Qr >::eraseCol(), STK::leftGivens(), STK::rightGivens(), and STKOUT_OF_RANGE_1ARG.
Referenced by main().
void STK::IQr< Derived >::insertCol | ( | ColVector_ const & | T, |
int | pos | ||
) |
Add a column with value T at the position pos and update the QR decomposition.
T | the column to insert |
pos | the position of the column to insert |
Definition at line 370 of file STK_IQr.h.
References _R, STK::compGivens(), STK::IQr< Qr >::insertCol(), STK::leftGivens(), STK::Arrays::point_, STK::rightGivens(), STK_STATIC_ASSERT, STKOUT_OF_RANGE_1ARG, STKRUNTIME_ERROR_1ARG, STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::update(), and STK::Arrays::vector_.
Referenced by main().
true
if Q_ is computed, false
otherwise Definition at line 149 of file STK_IQr.h.
References STK::IQr< Derived >::compq_.
|
inline |
Operator = : overwrite the this with decomp.
Definition at line 139 of file STK_IQr.h.
References STK::IQr< Derived >::compq_, STK::IQr< Derived >::Q_, STK::IQr< Derived >::R_, and STK::IQr< Derived >::rank_.
Delete the n last columns and update the QR decomposition.
n | number of column to delete |
Definition at line 293 of file STK_IQr.h.
void STK::IQr< Derived >::pushBackCol | ( | ColVector_ const & | T | ) |
Add a column with value T and update th QR decomposition.
T | the column to add |
Definition at line 335 of file STK_IQr.h.
References STK::compGivens(), STK::Arrays::point_, STK::IQr< Qr >::pushBackCol(), STK::rightGivens(), STK_STATIC_ASSERT, STKRUNTIME_ERROR_NO_ARG, and STK::Arrays::vector_.
give the matrix Q of the QR decomposition.
Definition at line 155 of file STK_IQr.h.
References STK::IQr< Derived >::Q_.
Referenced by STK::IQr< Derived >::IQr(), STK::IQr< Derived >::IQr(), and main().
|
inline |
give the matrix R of the QR decomposition.
Definition at line 159 of file STK_IQr.h.
References STK::IQr< Derived >::R_.
Referenced by main().
Definition at line 151 of file STK_IQr.h.
References STK::IQr< Derived >::rank_.
Compute the QR decomposition.
Delegate to Derived classes the concrete computation of the decomposition using runImpl
method.
true
if the computation succeed, false
otherwise Implements STK::IRunnerBase.
Definition at line 227 of file STK_IQr.h.
Referenced by main().
Set the compq_ flag.
By default compq is true
.
compq | true if we want to compute the Q matrix, false otherwise |
Definition at line 165 of file STK_IQr.h.
References STK::IQr< Derived >::compq_.
|
inline |
overloading of setData.
data | the data set to set. |
Definition at line 204 of file STK_IQr.h.
References STK::IArray2D< Derived >::clear(), STK::IQr< Derived >::compq_, STK::IQr< Derived >::Q_, STK::IQr< Derived >::R_, and STK::IQr< Derived >::rank_.
is Q computed ?
Definition at line 221 of file STK_IQr.h.
Referenced by STK::IQr< Derived >::isCompQ(), STK::IQr< Derived >::operator=(), STK::IQr< Derived >::setCompQ(), and STK::IQr< Derived >::setData().
Q Array of the QR decomposition.
Definition at line 217 of file STK_IQr.h.
Referenced by STK::IQr< Derived >::IQr(), STK::IQr< Derived >::operator=(), STK::IQr< Derived >::Q(), and STK::IQr< Derived >::setData().
|
protected |
R Array of th QR decomposition.
Definition at line 219 of file STK_IQr.h.
Referenced by STK::IQr< Derived >::operator=(), STK::IQr< Derived >::R(), and STK::IQr< Derived >::setData().
estimated rank_ of the matrix A
Definition at line 223 of file STK_IQr.h.
Referenced by STK::IQr< Derived >::operator=(), STK::IQr< Derived >::rank(), and STK::IQr< Derived >::setData().