44 #ifndef ROL_STDOBJECTIVE_H
45 #define ROL_STDOBJECTIVE_H
62 virtual void update(
const std::vector<Real> &x,
bool flag =
true,
int iter = -1 ) {}
70 virtual Real
value(
const std::vector<Real> &x, Real &tol ) = 0;
78 virtual void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
79 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
80 ">>> ERROR (ROL::StdObjective): gradient not implemented!");
90 catch (std::exception &e) {
95 virtual Real
dirDeriv(
const std::vector<Real> &x,
const std::vector<Real> &d, Real &tol ) {
96 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
97 ">>> ERROR (ROL::StdObjective): dirDeriv not implemented!");
107 catch (std::exception &e) {
112 virtual void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
113 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
114 ">>> ERROR (ROL::StdObjective): hessVec not implemented!");
125 catch (std::exception &e) {
130 virtual void invHessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
131 ROL_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
132 ">>> ERROR (ROL::StdObjective): invHessVec not implemented!");
143 virtual void precond( std::vector<Real> &Pv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
144 Pv.assign(v.begin(),v.end());
virtual Real value(const std::vector< Real > &x, Real &tol)=0
Provides the interface to evaluate objective functions.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual Real dirDeriv(const Vector< Real > &x, const Vector< Real > &d, Real &tol)
Compute directional derivative.
virtual void hessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Ptr< const std::vector< Element > > getVector() const
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual Real dirDeriv(const std::vector< Real > &x, const std::vector< Real > &d, Real &tol)
Defines the linear algebra or vector space interface.
Real dirDeriv(const Vector< Real > &x, const Vector< Real > &d, Real &tol)
Compute directional derivative.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply preconditioner to vector.
virtual void precond(std::vector< Real > &Pv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
virtual void invHessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
virtual void update(const std::vector< Real > &x, bool flag=true, int iter=-1)
virtual void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)