ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
algorithm
TypeB
pqn
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
14
namespace
ROL
{
15
16
template
<
typename
Real>
17
PQNObjective<Real>::PQNObjective
(
const
Ptr<
Secant<Real>
> &secant,
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
24
template
<
typename
Real>
25
Real
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
34
template
<
typename
Real>
35
void
PQNObjective<Real>::gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol ) {
36
pwa_
->set(x);
37
pwa_
->axpy(
static_cast<
Real
>
(-1),*
x_
);
38
secant_
->applyB(g, *
pwa_
);
39
g.
plus
(*
g_
);
40
}
41
42
template
<
typename
Real>
43
void
PQNObjective<Real>::hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
44
secant_
->applyB(hv, v);
45
}
46
47
template
<
typename
Real>
48
void
PQNObjective<Real>::setAnchor
(
const
Vector<Real>
&x,
const
Vector<Real>
&g) {
49
x_
->set(x);
g_
->set(g);
50
}
51
52
}
// namespace ROL
53
54
#endif
ROL::PQNObjective::setAnchor
void setAnchor(const Vector< Real > &x, const Vector< Real > &g)
Definition
ROL_PQNObjective_Def.hpp:48
ROL::PQNObjective::dwa_
const Ptr< Vector< Real > > dwa_
Definition
ROL_PQNObjective.hpp:39
ROL::PQNObjective::secant_
const Ptr< Secant< Real > > secant_
Definition
ROL_PQNObjective.hpp:38
ROL::PQNObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Definition
ROL_PQNObjective_Def.hpp:35
ROL::PQNObjective::x_
const Ptr< Vector< Real > > x_
Definition
ROL_PQNObjective.hpp:39
ROL::PQNObjective::pwa_
const Ptr< Vector< Real > > pwa_
Definition
ROL_PQNObjective.hpp:39
ROL::PQNObjective::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_PQNObjective_Def.hpp:43
ROL::PQNObjective::value
Real value(const Vector< Real > &x, Real &tol) override
Definition
ROL_PQNObjective_Def.hpp:25
ROL::PQNObjective::PQNObjective
PQNObjective(const Ptr< Secant< Real > > &secant, const Vector< Real > &x, const Vector< Real > &g)
Definition
ROL_PQNObjective_Def.hpp:17
ROL::PQNObjective::g_
const Ptr< Vector< Real > > g_
Definition
ROL_PQNObjective.hpp:39
ROL::Secant
Provides interface for and implements limited-memory secant operators.
Definition
ROL_Secant.hpp:45
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::plus
virtual void plus(const Vector &x)=0
Compute , where .
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0