|
STK++ 0.9.13
|
The class MultiLeastSQquare solve the least square problem when the response b is multidimensional. More...
#include <STK_lapack_MultiLeastSquare.h>

Public Types | |
| typedef ILeastSquare< MultiLeastSquare< ArrayB, ArrayA > > | Base |
Public Member Functions | |
| MultiLeastSquare (ArrayB const &b, ArrayA const &a, bool isBref=false, bool isAref=false) | |
| constructor | |
| template<class ArrayB_ , class ArrayA_ > | |
| MultiLeastSquare (ExprBase< ArrayB_ > const &b, ExprBase< ArrayA_ > const &a) | |
| template constructor | |
| virtual | ~MultiLeastSquare () |
| Destructor. | |
| Real | rcond () const |
| CVectorX const & | s () const |
| return the array with the singular values of A | |
| void | setRcond (Real rcond) |
| bool | runImpl () |
| solve the multi-linear least square problem. | |
| template<class Weights > | |
| bool | runImpl (Weights const &weights) |
| solve the weighted least square problem. | |
| bool | runImpl () |
Public Member Functions inherited from STK::ILeastSquare< MultiLeastSquare< ArrayB, ArrayA > > | |
| virtual | ~ILeastSquare () |
| Destructor. | |
| Integer const & | rank () const |
| ArrayA const & | a () const |
| ArrayB const & | b () const |
| ArrayB const & | x () const |
| virtual bool | run () |
| Compute the Least-Square solution. | |
| bool | run (VecWeights const &weights) |
| Compute the weighted Least-Square solution. | |
| bool | run (Weights const &weights) |
Public Member Functions inherited from STK::IRunnerBase | |
| String const & | error () const |
| get the last error message. | |
Public Member Functions inherited from STK::IRecursiveTemplate< Derived > | |
| 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 Attributes | |
| Real | rcond_ |
| condition number used for determining the effective rank of A | |
| CVectorX | s_ |
| Array of the singular values. | |
Protected Attributes inherited from STK::ILeastSquare< MultiLeastSquare< ArrayB, ArrayA > > | |
| ArrayB | b_ |
| Array or vector of the left hand side. | |
| ArrayA | a_ |
| Array of the right hand side. | |
| ArrayB | x_ |
| Array of the solution (a vector if b is a vector, a matrix otherwise) | |
| Integer | rank_ |
| rank of matrix A | |
Protected Attributes inherited from STK::IRunnerBase | |
| String | msg_error_ |
| String with the last error message. | |
| bool | hasRun_ |
true if run has been used, false otherwise | |
Private Member Functions | |
| bool | computeLS (CArrayXX &b, CArrayXX &a) |
| private method for computing the LS solution | |
Additional Inherited Members | |
Protected Types inherited from STK::ILeastSquare< MultiLeastSquare< ArrayB, ArrayA > > | |
| typedef hidden::AlgebraTraits< MultiLeastSquare< ArrayB, ArrayA > >::ArrayB | ArrayB |
| typedef hidden::AlgebraTraits< MultiLeastSquare< ArrayB, ArrayA > >::ArrayA | ArrayA |
Protected Member Functions inherited from STK::ILeastSquare< MultiLeastSquare< ArrayB, ArrayA > > | |
| ILeastSquare (ArrayB const &b, ArrayA const &a, bool isBref=false, bool isAref=false) | |
| Default constructor. | |
| ILeastSquare (ExprBase< OtherArrayB > const &b, ExprBase< OtherArrayA > const &a) | |
| template constructor | |
Protected Member Functions inherited from STK::IRunnerBase | |
| IRunnerBase () | |
| default constructor | |
| IRunnerBase (IRunnerBase const &runner) | |
| copy constructor | |
| virtual | ~IRunnerBase () |
| destructor | |
| virtual void | update () |
| update the runner. | |
Protected Member Functions inherited from STK::IRecursiveTemplate< Derived > | |
| IRecursiveTemplate () | |
| constructor. | |
| ~IRecursiveTemplate () | |
| destructor. | |
The class MultiLeastSQquare solve the least square problem when the response b is multidimensional.
The class MultiLeastSquare allows to solve the least-square problem
![\[
\min_{x} \|b - A*x\|^2.
\]](form_52.png)
It computes the minimum-norm solution to a real linear least squares problem: minimize 2-norm(| b - A*x |) using the singular value decomposition (SVD) of A. A is an M-by-N matrix which may be rank-deficient.
Definition at line 101 of file STK_lapack_MultiLeastSquare.h.
| typedef ILeastSquare< MultiLeastSquare<ArrayB, ArrayA> > STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::Base |
Definition at line 104 of file STK_lapack_MultiLeastSquare.h.
|
inline |
constructor
| b,a | the left hand side and the right hand side of the least square problem. |
| isBref,isAref | are the left hand side and the right hand side references ? |
Definition at line 113 of file STK_lapack_MultiLeastSquare.h.
|
inlinevirtual |
|
private |
private method for computing the LS solution
Definition at line 196 of file STK_lapack_MultiLeastSquare.h.
References STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::computeLS(), STK::lapack::gelsd(), STK::ICArray< Derived >::isRef(), STK::ICArray< Derived >::p_data(), STK::ICArray< Derived >::resize(), STK::ICArray< Derived >::shift(), STKERROR_1ARG, STKERROR_NO_ARG, STKRUNTIME_ERROR_NO_ARG, and STK::ICArray< Derived >::sub().
Referenced by STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::computeLS().
|
inline |
Definition at line 125 of file STK_lapack_MultiLeastSquare.h.
References STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::rcond_.
Referenced by STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::setRcond().
| bool STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::runImpl | ( | ) |
solve the multi-linear least square problem.
Launch gelsd LAPACK routine to perform the decomposition.
true if no error occur, false otherwise Definition at line 159 of file STK_lapack_MultiLeastSquare.h.
References STK::ICArray< Derived >::sub().
|
inline |
Definition at line 190 of file STK_lapack_MultiLeastSquare.h.
solve the weighted least square problem.
Launch gelsd LAPACK routine to perform the decomposition.
true if no error occur, false otherwise Definition at line 174 of file STK_lapack_MultiLeastSquare.h.
References STK_STATIC_ASSERT_ONE_DIMENSION_ONLY, and STK::ICArray< Derived >::sub().
|
inline |
return the array with the singular values of A
Definition at line 127 of file STK_lapack_MultiLeastSquare.h.
References STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::s_.
|
inline |
| rcond | the condition number. If rcond<0, the machine precision is used. |
Definition at line 130 of file STK_lapack_MultiLeastSquare.h.
References STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::rcond(), and STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::rcond_.
|
protected |
condition number used for determining the effective rank of A
Definition at line 145 of file STK_lapack_MultiLeastSquare.h.
Referenced by STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::rcond(), and STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::setRcond().
|
protected |
Array of the singular values.
Definition at line 147 of file STK_lapack_MultiLeastSquare.h.
Referenced by STK::lapack::MultiLeastSquare< ArrayB, ArrayA >::s().