ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
objective
ROL_ScaledObjective_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_SCALED_OBJECTIVE_DEF_HPP
11
#define ROL_SCALED_OBJECTIVE_DEF_HPP
12
13
namespace
ROL
{
14
15
template
<
typename
Real>
16
void
ScaledObjective<Real>::update
(
const
Vector<Real>
&x,
UpdateType
type,
int
iter) {
17
obj_
->update(x,type,iter);
18
}
19
20
template
<
typename
Real>
21
void
ScaledObjective<Real>::setParameter
(
const
std::vector<Real> ¶m) {
22
Objective<Real>::setParameter
(param);
23
obj_
->setParameter(param);
24
}
25
26
template
<
typename
Real>
27
Real
ScaledObjective<Real>::value
(
const
Vector<Real>
&x, Real &tol ) {
28
return
scale_
*
obj_
->value(x,tol);
29
}
30
31
template
<
typename
Real>
32
void
ScaledObjective<Real>::gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol ) {
33
obj_
->gradient(g,x,tol);
34
g.
scale
(
scale_
);
35
}
36
37
template
<
typename
Real>
38
void
ScaledObjective<Real>::hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
39
obj_
->hessVec(hv,v,x,tol);
40
hv.
scale
(
scale_
);
41
}
42
43
template
<
typename
Real>
44
void
ScaledObjective<Real>::invHessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
45
obj_
->invHessVec(hv,v,x,tol);
46
hv.
scale
(
static_cast<
Real
>
(1)/
scale_
);
47
}
48
49
template
<
typename
Real>
50
void
ScaledObjective<Real>::precond
(
Vector<Real>
&Pv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
51
obj_
->precond(Pv,v,x,tol);
52
Pv.
scale
(
static_cast<
Real
>
(1)/
scale_
);
53
}
54
55
}
// End ROL Namespace
56
57
#endif
ROL::Objective::setParameter
virtual void setParameter(const std::vector< Real > ¶m)
Definition
ROL_Objective.hpp:509
ROL::ScaledObjective::value
Real value(const Vector< Real > &x, Real &tol) override
Definition
ROL_ScaledObjective_Def.hpp:27
ROL::ScaledObjective::invHessVec
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_ScaledObjective_Def.hpp:44
ROL::ScaledObjective::update
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Definition
ROL_ScaledObjective_Def.hpp:16
ROL::ScaledObjective::setParameter
void setParameter(const std::vector< Real > ¶m) override
Definition
ROL_ScaledObjective_Def.hpp:21
ROL::ScaledObjective::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_ScaledObjective_Def.hpp:38
ROL::ScaledObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Definition
ROL_ScaledObjective_Def.hpp:32
ROL::ScaledObjective::scale_
const Real scale_
Definition
ROL_ScaledObjective.hpp:21
ROL::ScaledObjective::obj_
const Ptr< Objective< Real > > obj_
Definition
ROL_ScaledObjective.hpp:20
ROL::ScaledObjective::precond
void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_ScaledObjective_Def.hpp:50
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::scale
virtual void scale(const Real alpha)=0
Compute where .
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::UpdateType
UpdateType
Definition
ROL_UpdateType.hpp:18
Generated by
1.17.0