ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
algorithm
TypeU
linesearch
descent
ROL_Newton_U.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_NEWTON_U_H
11
#define ROL_NEWTON_U_H
12
13
#include "
ROL_DescentDirection_U.hpp
"
14
#include "
ROL_Types.hpp
"
15
21
22
namespace
ROL
{
23
24
template
<
typename
Real>
25
class
Newton_U
:
public
DescentDirection_U
<Real> {
26
public
:
27
Newton_U
() {}
28
29
void
compute
(
Vector<Real>
&s, Real &snorm, Real &sdotg,
int
&iter,
int
&flag,
30
const
Vector<Real>
&x,
const
Vector<Real>
&g,
Objective<Real>
&obj)
override
{
31
Real tol = std::sqrt(
ROL_EPSILON<Real>
());
32
// Compute unconstrained step
33
obj.
invHessVec
(s,g,x,tol);
34
//sdotg = -s.dot(g.dual());
35
sdotg = -s.
apply
(g);
36
if
(sdotg >=
static_cast<
Real
>
(0)) {
37
s.
set
(g.
dual
());
38
//sdotg = -s.dot(g.dual());
39
sdotg = -s.
apply
(g);
40
}
41
s.
scale
(
static_cast<
Real
>
(-1));
42
snorm = s.
norm
();
43
iter = 0;
44
flag = 0;
45
}
46
47
std::string
printName
(
void
)
const override
{
48
std::string name =
"Newton's Method"
;
49
return
name;
50
}
51
};
// class ROL::TypeU::LineSearch::Newton
52
53
}
// namespace ROL
54
55
#endif
ROL_DescentDirection_U.hpp
ROL_Types.hpp
Contains definitions of custom data types in ROL.
ROL::DescentDirection_U
Provides the interface to compute unconstrained optimization steps for line search.
Definition
ROL_DescentDirection_U.hpp:24
ROL::Newton_U::printName
std::string printName(void) const override
Definition
ROL_Newton_U.hpp:47
ROL::Newton_U::Newton_U
Newton_U()
Definition
ROL_Newton_U.hpp:27
ROL::Newton_U::compute
void compute(Vector< Real > &s, Real &snorm, Real &sdotg, int &iter, int &flag, const Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj) override
Definition
ROL_Newton_U.hpp:29
ROL::Objective
Provides the interface to evaluate objective functions.
Definition
ROL_Objective.hpp:44
ROL::Objective::invHessVec
virtual void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
Definition
ROL_Objective.hpp:131
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::apply
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
Definition
ROL_Vector.hpp:205
ROL::Vector::norm
virtual Real norm() const =0
Returns where .
ROL::Vector::set
virtual void set(const Vector &x)
Set where .
Definition
ROL_Vector.hpp:176
ROL::Vector::scale
virtual void scale(const Real alpha)=0
Compute where .
ROL::Vector::dual
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
Definition
ROL_Vector.hpp:193
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::ROL_EPSILON
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
Definition
ROL_Types.hpp:57
Generated by
1.17.0