#include <NOX_LAPACK_Group.H>
Public Member Functions | |
Group (Interface &i) | |
Constructor. | |
Group (const NOX::LAPACK::Group &source, NOX::CopyType type=DeepCopy) | |
Copy constructor. | |
~Group () | |
Destructor. | |
NOX::Abstract::Group & | operator= (const NOX::Abstract::Group &source) |
Copies the source group into this group. | |
NOX::Abstract::Group & | operator= (const NOX::LAPACK::Group &source) |
See above. | |
virtual Teuchos::RCP < NOX::Abstract::Group > | clone (NOX::CopyType type=NOX::DeepCopy) const |
Create a new Group of the same derived type as this one by cloning this one, and return a ref count pointer to the new group. | |
void | print () const |
Print out the group. | |
"Compute" functions. | |
void | setX (const NOX::Abstract::Vector &y) |
Set the solution vector x to y. | |
void | setX (const NOX::LAPACK::Vector &y) |
See above. | |
void | computeX (const NOX::Abstract::Group &grp, const NOX::Abstract::Vector &d, double step) |
Compute x = grp.x + step * d. | |
void | computeX (const NOX::LAPACK::Group &grp, const NOX::LAPACK::Vector &d, double step) |
See above. | |
NOX::Abstract::Group::ReturnType | computeF () |
Compute and store F(x). | |
NOX::Abstract::Group::ReturnType | computeJacobian () |
Compute and store Jacobian. | |
NOX::Abstract::Group::ReturnType | computeGradient () |
Compute and store gradient. | |
NOX::Abstract::Group::ReturnType | computeNewton (Teuchos::ParameterList ¶ms) |
Compute the Newton direction, using parameters for the linear solve. | |
Jacobian operations. | |
Operations using the Jacobian matrix. These may not be defined in matrix-free scenarios. | |
NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::LAPACK::Vector &input, NOX::LAPACK::Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
See above. | |
NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::LAPACK::Vector &input, NOX::LAPACK::Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
See above. | |
NOX::Abstract::Group::ReturnType | applyJacobianInverse (Teuchos::ParameterList ¶ms, const NOX::LAPACK::Vector &input, Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobianInverse (Teuchos::ParameterList ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result. | |
virtual NOX::Abstract::Group::ReturnType | applyJacobianInverseMultiVector (Teuchos::ParameterList ¶ms, const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
applyJacobianInverse for multiple right-hand sides | |
"Is" functions | |
Checks to see if various objects have been computed. Returns true if the corresponding "compute" function has been called since the last update to the solution vector (via instantiation or computeX). | |
bool | isF () const |
Return true if F is valid. | |
bool | isJacobian () const |
Return true if the Jacobian is valid. | |
bool | isGradient () const |
Return true if the gradient is valid. | |
bool | isNewton () const |
Return true if the Newton direction is valid. | |
"Get" functions | |
Note that these function do not check whether or not the vectors are valid. Must use the "Is" functions for that purpose. | |
const NOX::Abstract::Vector & | getX () const |
Return solution vector. | |
const NOX::Abstract::Vector & | getF () const |
Return F(x). | |
double | getNormF () const |
Return 2-norm of F(x). | |
const NOX::Abstract::Vector & | getGradient () const |
Return gradient. | |
const NOX::Abstract::Vector & | getNewton () const |
Return Newton direction. | |
Protected Member Functions | |
void | resetIsValid () |
resets the isValid flags to false | |
Protected Attributes | |
NOX::LAPACK::LinearSolver< double > | jacSolver |
Jacobian Matrix & LAPACK solver. | |
NOX::LAPACK::Interface & | problemInterface |
Problem interface. | |
Vectors | |
NOX::LAPACK::Vector | xVector |
Solution vector. | |
NOX::LAPACK::Vector | fVector |
Right-hand-side vector (function evaluation). | |
NOX::LAPACK::Vector | newtonVector |
Newton direction vector. | |
NOX::LAPACK::Vector | gradientVector |
Gradient vector (steepest descent vector). | |
IsValid flags | |
True if the current solution is up-to-date with respect to the currect xVector. | |
bool | isValidF |
bool | isValidJacobian |
bool | isValidGradient |
bool | isValidNewton |
Definition at line 63 of file NOX_LAPACK_Group.H.
NOX::LAPACK::Group::Group | ( | Interface & | i | ) |
Constructor.
Definition at line 48 of file NOX_LAPACK_Group.C.
References resetIsValid(), and NOX::ShapeCopy.
NOX::LAPACK::Group::Group | ( | const NOX::LAPACK::Group & | source, | |
NOX::CopyType | type = DeepCopy | |||
) |
Copy constructor.
Definition at line 59 of file NOX_LAPACK_Group.C.
References NOX::DeepCopy, resetIsValid(), and NOX::ShapeCopy.
NOX::LAPACK::Group::~Group | ( | ) | [virtual] |
Destructor.
Reimplemented from NOX::Abstract::Group.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 89 of file NOX_LAPACK_Group.C.
NOX::Abstract::Group & NOX::LAPACK::Group::operator= | ( | const NOX::Abstract::Group & | source | ) | [virtual] |
Copies the source group into this group.
Implements NOX::Abstract::Group.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 110 of file NOX_LAPACK_Group.C.
NOX::Abstract::Group & NOX::LAPACK::Group::operator= | ( | const NOX::LAPACK::Group & | source | ) |
See above.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 115 of file NOX_LAPACK_Group.C.
References fVector, gradientVector, jacSolver, newtonVector, and xVector.
void NOX::LAPACK::Group::setX | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Set the solution vector x to y.
Throw an error if the copy fails.
Implements NOX::Abstract::Group.
Definition at line 147 of file NOX_LAPACK_Group.C.
void NOX::LAPACK::Group::setX | ( | const NOX::LAPACK::Vector & | y | ) |
See above.
Definition at line 152 of file NOX_LAPACK_Group.C.
References resetIsValid(), and xVector.
void NOX::LAPACK::Group::computeX | ( | const NOX::Abstract::Group & | grp, | |
const NOX::Abstract::Vector & | d, | |||
double | step | |||
) | [virtual] |
Compute x = grp.x + step * d.
Let denote this group's solution vector. Let
denote the result of grp.getX(). Then set
Throw an error if the copy fails.
Implements NOX::Abstract::Group.
Definition at line 158 of file NOX_LAPACK_Group.C.
void NOX::LAPACK::Group::computeX | ( | const NOX::LAPACK::Group & | grp, | |
const NOX::LAPACK::Vector & | d, | |||
double | step | |||
) |
See above.
Definition at line 168 of file NOX_LAPACK_Group.C.
References resetIsValid(), and xVector.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::computeF | ( | ) | [virtual] |
Compute and store F(x).
Implements NOX::Abstract::Group.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 174 of file NOX_LAPACK_Group.C.
References NOX::LAPACK::Interface::computeF(), NOX::Abstract::Group::Failed, fVector, NOX::Abstract::Group::Ok, problemInterface, and xVector.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::computeJacobian | ( | ) | [virtual] |
Compute and store Jacobian.
Recall that
The Jacobian is denoted by and defined by
Reimplemented from NOX::Abstract::Group.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 184 of file NOX_LAPACK_Group.C.
References NOX::LAPACK::Interface::computeJacobian(), NOX::Abstract::Group::Failed, NOX::LAPACK::LinearSolver< T >::getMatrix(), jacSolver, NOX::Abstract::Group::Ok, problemInterface, and xVector.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::computeGradient | ( | ) | [virtual] |
Compute and store gradient.
We can pose the nonlinear equation problem as an optimization problem as follows:
In that case, the gradient (of ) is defined as
Reimplemented from NOX::Abstract::Group.
Definition at line 196 of file NOX_LAPACK_Group.C.
References NOX::LAPACK::LinearSolver< T >::apply(), NOX::Abstract::Group::BadDependency, fVector, gradientVector, isF(), isJacobian(), jacSolver, and NOX::Abstract::Group::Ok.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::computeNewton | ( | Teuchos::ParameterList & | params | ) | [virtual] |
Compute the Newton direction, using parameters for the linear solve.
The Newton direction is the solution, s, of
The parameters are from the "Linear %Solver" sublist of the "Direction" sublist that is passed to solver during construction.
The "Tolerance" parameter may be added/modified in the sublist of "Linear Solver" parameters that is passed into this function. The solution should be such that
params
Reimplemented from NOX::Abstract::Group.
Definition at line 221 of file NOX_LAPACK_Group.C.
References fVector, isF(), isJacobian(), isNewton(), newtonVector, NOX::Abstract::Group::Ok, and NOX::LAPACK::Vector::scale().
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::applyJacobian | ( | const NOX::Abstract::Vector & | input, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
See above.
Reimplemented from NOX::Abstract::Group.
Definition at line 247 of file NOX_LAPACK_Group.C.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::applyJacobianTranspose | ( | const NOX::Abstract::Vector & | input, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
See above.
Reimplemented from NOX::Abstract::Group.
Definition at line 269 of file NOX_LAPACK_Group.C.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::applyJacobianInverse | ( | Teuchos::ParameterList & | params, | |
const NOX::Abstract::Vector & | input, | |||
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result.
Computes
where is the Jacobian,
is the input vector, and
is the result vector.
The "Tolerance" parameter specifies that the solution should be such that
params
Reimplemented from NOX::Abstract::Group.
Definition at line 291 of file NOX_LAPACK_Group.C.
NOX::Abstract::Group::ReturnType NOX::LAPACK::Group::applyJacobianInverseMultiVector | ( | Teuchos::ParameterList & | params, | |
const NOX::Abstract::MultiVector & | input, | |||
NOX::Abstract::MultiVector & | result | |||
) | const [virtual] |
applyJacobianInverse for multiple right-hand sides
Reimplemented from NOX::Abstract::Group.
Definition at line 319 of file NOX_LAPACK_Group.C.
References NOX::Abstract::Group::Failed, NOX::LAPACK::LinearSolver< T >::getMatrix(), isJacobian(), jacSolver, NOX::LAPACK::Matrix< T >::numRows(), NOX::Abstract::MultiVector::numVectors(), NOX::Abstract::Group::Ok, and NOX::LAPACK::LinearSolver< T >::solve().
bool NOX::LAPACK::Group::isF | ( | ) | const [virtual] |
Return true if F is valid.
Implements NOX::Abstract::Group.
Definition at line 362 of file NOX_LAPACK_Group.C.
Referenced by computeGradient(), and computeNewton().
bool NOX::LAPACK::Group::isJacobian | ( | ) | const [virtual] |
Return true if the Jacobian is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 367 of file NOX_LAPACK_Group.C.
Referenced by applyJacobianInverseMultiVector(), LOCA::LAPACK::Group::applyJacobianTransposeInverse(), LOCA::LAPACK::Group::applyJacobianTransposeInverseMultiVector(), computeGradient(), and computeNewton().
bool NOX::LAPACK::Group::isGradient | ( | ) | const [virtual] |
Return true if the gradient is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 372 of file NOX_LAPACK_Group.C.
bool NOX::LAPACK::Group::isNewton | ( | ) | const [virtual] |
Return true if the Newton direction is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 377 of file NOX_LAPACK_Group.C.
Referenced by computeNewton().
const NOX::Abstract::Vector & NOX::LAPACK::Group::getX | ( | ) | const [virtual] |
Return solution vector.
Implements NOX::Abstract::Group.
Definition at line 382 of file NOX_LAPACK_Group.C.
References xVector.
const NOX::Abstract::Vector & NOX::LAPACK::Group::getF | ( | ) | const [virtual] |
Return F(x).
Implements NOX::Abstract::Group.
Definition at line 387 of file NOX_LAPACK_Group.C.
References fVector.
double NOX::LAPACK::Group::getNormF | ( | ) | const [virtual] |
Return 2-norm of F(x).
In other words,
Implements NOX::Abstract::Group.
Definition at line 392 of file NOX_LAPACK_Group.C.
References fVector, and NOX::LAPACK::Vector::norm().
const NOX::Abstract::Vector & NOX::LAPACK::Group::getGradient | ( | ) | const [virtual] |
Return gradient.
Implements NOX::Abstract::Group.
Definition at line 404 of file NOX_LAPACK_Group.C.
References gradientVector.
const NOX::Abstract::Vector & NOX::LAPACK::Group::getNewton | ( | ) | const [virtual] |
Return Newton direction.
Implements NOX::Abstract::Group.
Definition at line 409 of file NOX_LAPACK_Group.C.
References newtonVector.
Teuchos::RCP< NOX::Abstract::Group > NOX::LAPACK::Group::clone | ( | NOX::CopyType | type = NOX::DeepCopy |
) | const [virtual] |
Create a new Group of the same derived type as this one by cloning this one, and return a ref count pointer to the new group.
If type is NOX::DeepCopy, then we need to create an exact replica of "this". Otherwise, if type is NOX::ShapeCopy, we need only replicate the shape of "this" (only the memory is allocated, the values are not copied into the vectors and Jacobian). Returns NULL if clone is not supported.
Implements NOX::Abstract::Group.
Reimplemented in LOCA::LAPACK::Group.
Definition at line 103 of file NOX_LAPACK_Group.C.
void NOX::LAPACK::Group::print | ( | ) | const |
void NOX::LAPACK::Group::resetIsValid | ( | ) | [protected] |
resets the isValid flags to false
Reimplemented in LOCA::LAPACK::Group.
Definition at line 93 of file NOX_LAPACK_Group.C.
References jacSolver, and NOX::LAPACK::LinearSolver< T >::reset().
Referenced by computeX(), Group(), and setX().
NOX::LAPACK::Vector NOX::LAPACK::Group::xVector [protected] |
Solution vector.
Definition at line 189 of file NOX_LAPACK_Group.H.
Referenced by LOCA::LAPACK::Group::computeComplex(), computeF(), computeJacobian(), LOCA::LAPACK::Group::computeShiftedMatrix(), computeX(), getX(), operator=(), print(), LOCA::LAPACK::Group::printSolution(), and setX().
NOX::LAPACK::Vector NOX::LAPACK::Group::fVector [protected] |
Right-hand-side vector (function evaluation).
Definition at line 191 of file NOX_LAPACK_Group.H.
Referenced by computeF(), computeGradient(), computeNewton(), getF(), getNormF(), operator=(), and print().
NOX::LAPACK::Vector NOX::LAPACK::Group::newtonVector [protected] |
Newton direction vector.
Definition at line 193 of file NOX_LAPACK_Group.H.
Referenced by computeNewton(), getNewton(), and operator=().
Gradient vector (steepest descent vector).
Definition at line 195 of file NOX_LAPACK_Group.H.
Referenced by computeGradient(), getGradient(), and operator=().
NOX::LAPACK::LinearSolver<double> NOX::LAPACK::Group::jacSolver [mutable, protected] |
Jacobian Matrix & LAPACK solver.
Definition at line 200 of file NOX_LAPACK_Group.H.
Referenced by applyJacobianInverseMultiVector(), LOCA::LAPACK::Group::applyJacobianTransposeInverse(), LOCA::LAPACK::Group::applyJacobianTransposeInverseMultiVector(), LOCA::LAPACK::Group::augmentJacobianForHomotopy(), LOCA::LAPACK::Group::computeComplex(), computeGradient(), computeJacobian(), LOCA::LAPACK::Group::getJacobianMatrix(), operator=(), and resetIsValid().
Problem interface.
Definition at line 203 of file NOX_LAPACK_Group.H.
Referenced by computeF(), and computeJacobian().