#include <cgalg.hh>
Inheritance diagram for RVLUmin::CGStep< Scalar >:
Public Member Functions | |
void | run () |
Execute a single CG step. | |
CGStep (Vector< Scalar > &x0, LinearOp< Scalar > const &inA, Vector< Scalar > const &rhs, atype &_rnormsq) | |
constructor: | |
Protected Member Functions | |
void | restart () |
restart CG for the current x. | |
Protected Attributes | |
Vector< Scalar > & | x |
const LinearOp< Scalar > & | A |
Vector< Scalar > const & | b |
Vector< Scalar > | r |
Scalar | curv |
atype & | rnormsq |
Vector< Scalar > | p |
Vector< Scalar > | w |
Stores const references for linear map, represented as RVL::LinearOp, and right-hand side vector, represented as RVL::Vector. Updates solution vector and residual norm, for which the class stores mutable references. Detection of negative curvature (implying failure of SPD condition) throws exception. Uses RVL::ProtectedDivision to compute alpha, beta, with default zerodivide tolerance.
Definition at line 82 of file cgalg.hh.
RVLUmin::CGStep< Scalar >::CGStep | ( | Vector< Scalar > & | x0, | |
LinearOp< Scalar > const & | inA, | |||
Vector< Scalar > const & | rhs, | |||
atype & | _rnormsq | |||
) |
constructor:
x0 | - mutable reference to solution vector (external), updated by CGStep::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; constructor initializes, CGStep::run() updates |
void RVLUmin::CGStep< Scalar >::run | ( | ) | [virtual] |
Execute a single CG step.
If CG finds a direction of negative curvature <p, Ap> < 0, it will NOT take a step
Implements RVLAlg::Algorithm.
Definition at line 92 of file cgalg.hh.
References RVLUmin::CGStep< Scalar >::A, RVLUmin::CGStep< Scalar >::curv, RVLUmin::CGStep< Scalar >::p, RVLUmin::CGStep< Scalar >::r, RVLUmin::realgt(), RVLUmin::CGStep< Scalar >::rnormsq, RVLUmin::CGStep< Scalar >::w, and RVLUmin::CGStep< Scalar >::x.
void RVLUmin::CGStep< Scalar >::restart | ( | ) | [protected] |
restart CG for the current x.
This should only be used if x is modified outside of this algorithm.
Definition at line 163 of file cgalg.hh.
References RVLUmin::CGStep< Scalar >::A, RVLUmin::CGStep< Scalar >::b, RVLUmin::CGStep< Scalar >::p, RVLUmin::CGStep< Scalar >::r, RVLUmin::CGStep< Scalar >::rnormsq, RVLUmin::CGStep< Scalar >::w, and RVLUmin::CGStep< Scalar >::x.
Vector<Scalar>& RVLUmin::CGStep< Scalar >::x [protected] |
Definition at line 171 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().
const LinearOp<Scalar>& RVLUmin::CGStep< Scalar >::A [protected] |
Definition at line 172 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().
Vector<Scalar> const& RVLUmin::CGStep< Scalar >::b [protected] |
Vector<Scalar> RVLUmin::CGStep< Scalar >::r [protected] |
Definition at line 174 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().
Scalar RVLUmin::CGStep< Scalar >::curv [protected] |
atype& RVLUmin::CGStep< Scalar >::rnormsq [protected] |
Definition at line 176 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().
Vector<Scalar> RVLUmin::CGStep< Scalar >::p [protected] |
Definition at line 177 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().
Vector<Scalar> RVLUmin::CGStep< Scalar >::w [protected] |
Definition at line 178 of file cgalg.hh.
Referenced by RVLUmin::CGStep< Scalar >::restart(), and RVLUmin::CGStep< Scalar >::run().