ROL
ROL_PQNObjective_Def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Rapid Optimization Library (ROL) Package
4//
5// Copyright 2014 NTESS and the ROL contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef ROL_PQNOBJECTIVEDEF_H
11#define ROL_PQNOBJECTIVEDEF_H
12
13
14namespace ROL {
15
16template<typename Real>
18 const Vector<Real> &x,
19 const Vector<Real> &g)
20 : secant_(secant), x_(x.clone()), g_(g.clone()), pwa_(x.clone()), dwa_(g.clone()) {
21 setAnchor(x,g);
22}
23
24template<typename Real>
25Real PQNObjective<Real>::value( const Vector<Real> &x, Real &tol ) {
26 pwa_->set(x);
27 pwa_->axpy(static_cast<Real>(-1),*x_);
28 secant_->applyB(*dwa_, *pwa_);
29 dwa_->scale(static_cast<Real>(0.5));
30 dwa_->plus(*g_);
31 return dwa_->apply(*pwa_);
32}
33
34template<typename Real>
36 pwa_->set(x);
37 pwa_->axpy(static_cast<Real>(-1),*x_);
38 secant_->applyB(g, *pwa_);
39 g.plus(*g_);
40}
41
42template<typename Real>
43void PQNObjective<Real>::hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
44 secant_->applyB(hv, v);
45}
46
47template<typename Real>
49 x_->set(x); g_->set(g);
50}
51
52} // namespace ROL
53
54#endif
void setAnchor(const Vector< Real > &x, const Vector< Real > &g)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
PQNObjective(const Ptr< Secant< Real > > &secant, const Vector< Real > &x, const Vector< Real > &g)
Provides interface for and implements limited-memory secant operators.
Defines the linear algebra or vector space interface.
virtual void plus(const Vector &x)=0
Compute , where .