#include <ConstrainedLS.H>
Public Types | |
enum | Bound { LOWER_BOUND, UPPER_BOUND, UNCONSTRAINED } |
enum | LSResult { SUCCESS, INCONSISTENT_BOUNDS, UNDERDETERMINED, SINGULAR, UNCONVERGED } |
Public Member Functions | |
ConstrainedLS () | |
LSResult | solveBoundConstrained (Vector< Real > &a_x, Real **a_A, const Vector< Real > &a_rhs, const Vector< Real > &a_lowerBound, const Vector< Real > &a_upperBound) |
LSResult | solveUnconstrained (Vector< Real > &a_x, Real **a_A, const Vector< Real > &a_rhs) |
bool | boundsConsistent (const Vector< Real > &a_lowBound, const Vector< Real > &a_hiBound) const |
Vector< Bound > | getConstraints () const |
int | numberActiveConstraints () const |
Real | getResidual () const |
LSResult | qrSolution (Real **a_A, Vector< Real > &a_x, Vector< Real > &a_b, Real &resq) |
Protected Attributes | |
Vector< Bound > | m_boundState |
int | m_nbound |
Private Member Functions | |
void | allocArray (const int &rows, const int &cols, Real **&A) |
void | freeArray (const int &rows, const int &cols, Real **&A) |
Private Attributes | |
Real | m_residual |
enum ConstrainedLS::Bound |
ConstrainedLS::ConstrainedLS | ( | ) |
LSResult ConstrainedLS::solveBoundConstrained | ( | Vector< Real > & | a_x, | |
Real ** | a_A, | |||
const Vector< Real > & | a_rhs, | |||
const Vector< Real > & | a_lowerBound, | |||
const Vector< Real > & | a_upperBound | |||
) |
Solve the bound-constrained least squares Uses the Lawson-Hanson active set method as given by P.B. Stark and R.L. Parker, Bounded-Variable Least-Squares: An Algorithm and Applications, Computational Statistics, 10:129-141, 1995. Uses solveUnconstrained for sub-problems
Referenced by LSProblem< dim >::invertNormalEq().
LSResult ConstrainedLS::solveUnconstrained | ( | Vector< Real > & | a_x, | |
Real ** | a_A, | |||
const Vector< Real > & | a_rhs | |||
) |
Solve the unconstrained least squares problem
bool ConstrainedLS::boundsConsistent | ( | const Vector< Real > & | a_lowBound, | |
const Vector< Real > & | a_hiBound | |||
) | const |
Get a vector of Bound indicating constraint activity.
int ConstrainedLS::numberActiveConstraints | ( | ) | const |
Query the number of active constraints. Bails if a LS problem has not been solved yet
Referenced by LSProblem< dim >::invertNormalEq().
Real ConstrainedLS::getResidual | ( | ) | const |
Get the LS residual Bails if a LS problem has not been solved yet
LSResult ConstrainedLS::qrSolution | ( | Real ** | a_A, | |
Vector< Real > & | a_x, | |||
Vector< Real > & | a_b, | |||
Real & | resq | |||
) |
Solve the least squares problem. Uses successive Householder rotations
void ConstrainedLS::allocArray | ( | const int & | rows, | |
const int & | cols, | |||
Real **& | A | |||
) | [private] |
void ConstrainedLS::freeArray | ( | const int & | rows, | |
const int & | cols, | |||
Real **& | A | |||
) | [private] |
Vector<Bound> ConstrainedLS::m_boundState [protected] |
int ConstrainedLS::m_nbound [protected] |
Real ConstrainedLS::m_residual [private] |