#include <cgalg.hh>
Inheritance diagram for RVLUmin::CGAlg< Scalar >:
Public Member Functions | |
CGAlg (RVL::Vector< Scalar > &_x, LinearOp< Scalar > const &_inA, Vector< Scalar > const &_rhs, atype &_rnormsq, atype _tol=100.0 *numeric_limits< atype >::epsilon(), int _maxcount=10, atype _maxstep=numeric_limits< atype >::max(), ostream &_str=cout) | |
constructor: | |
int | getCount () |
void | run () |
Combines CGStep with a terminator which displays iteration count and mean square residual, and terminates if iteration count exceeds max or residual norm tolerance falls below threshhold (default = 10*sqrt(macheps)). Note that the thresshold is expressed in terms of the norm squared, not the norm. Also terminates if step (net, from initial estimate of solution) exceeds maxstep argument to constructor. In this latter case, the computed step is projected onto the ball of radius maxstep centered at the initial estimate. This maximum step limit and projection turns the algorithm into an approximate trust region subproblem solver. The default choice of maxstep is the max Scalar, which effectively turns off the trust region feature.
Note that the solution vector (constructor parameter _x) is not altered by the constructor, and represents an externally defined initial estimate. In particular, it is not presumed to be the zero vector, nor is it set to zero by the constructor.
For definition of arguments to constructor, see below.
Usage: construct CGAlg object, supplying arguments as indicated below. Invoke run() method.
Typical use case: see functional test source.
Definition at line 207 of file cgalg.hh.
RVLUmin::CGAlg< Scalar >::CGAlg | ( | RVL::Vector< Scalar > & | _x, | |
LinearOp< Scalar > const & | _inA, | |||
Vector< Scalar > const & | _rhs, | |||
atype & | _rnormsq, | |||
atype | _tol = 100.0*numeric_limits<atype>::epsilon() , |
|||
int | _maxcount = 10 , |
|||
atype | _maxstep = numeric_limits<atype>::max() , |
|||
ostream & | _str = cout | |||
) |
constructor:
_x | - mutable reference to solution vector (external), estimated solution on return from CGAlg::run(). | |
_inA | - const reference to LinearOp (external) defining problem; presumed to be SPD | |
_rhs | - const reference to RHS or target vector (external) | |
_rnormsq | - mutable reference to residual norm-squared scalar (external), initialized to norm-squared of RHS on construction, norm-squared of estimated residual at solution on return from CGAlg::run() | |
_tol | - stopping threshold for residual norm-squared, default value = 100.0*macheps | |
_maxcount | - max number of iterations permitted, default value = 10 | |
_maxstep | - max permitted step length (trust radius), default value = max absval scalar (which makes the trust region feature inactive) | |
_str | - output stream |
int RVLUmin::CGAlg< Scalar >::getCount | ( | ) |
void RVLUmin::CGAlg< Scalar >::run | ( | ) | [virtual] |
Implements RVLAlg::Algorithm.
Definition at line 262 of file cgalg.hh.
References RVLAlg::CountTerminator::getCount(), RVLAlg::BallProjTerminator< Scalar >::query(), and RVLAlg::LoopAlg::run().