ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
objective
ROL_QuadraticObjective_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_QUADRATIC_OBJECTIVE_DEF_H
11
#define ROL_QUADRATIC_OBJECTIVE_DEF_H
12
13
namespace
ROL
{
14
15
template
<
typename
Real>
16
QuadraticObjective<Real>::QuadraticObjective
(
const
Ptr<
const
LinearOperator<Real>
> &H,
17
const
Ptr<
const
Vector<Real>
> &g,
18
Real c)
19
:
H_
(H),
g_
(g),
c_
(c) {
20
tmp_
=
g_
->clone();
21
}
22
23
template
<
typename
Real>
24
Real
QuadraticObjective<Real>::value
(
const
Vector<Real>
&x, Real &tol ) {
25
H_
->apply(*
tmp_
,x,tol);
26
tmp_
->scale(
static_cast<
Real
>
(0.5));
27
tmp_
->plus(*
g_
);
28
//return x.dot(tmp_->dual()) + c_;
29
return
x.
apply
(*
tmp_
) +
c_
;
30
}
31
32
template
<
typename
Real>
33
void
QuadraticObjective<Real>::gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol ) {
34
H_
->apply(g,x,tol);
35
g.
plus
(*
g_
);
36
}
37
38
template
<
typename
Real>
39
void
QuadraticObjective<Real>::hessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
40
H_
->apply(hv,v,tol);
41
}
42
43
template
<
typename
Real>
44
void
QuadraticObjective<Real>::invHessVec
(
Vector<Real>
&hv,
const
Vector<Real>
&v,
const
Vector<Real>
&x, Real &tol ) {
45
H_
->applyInverse(hv,v,tol);
46
}
47
48
}
// namespace ROL
49
50
#endif
ROL::LinearOperator
Provides the interface to apply a linear operator.
Definition
ROL_LinearOperator.hpp:37
ROL::QuadraticObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Definition
ROL_QuadraticObjective_Def.hpp:33
ROL::QuadraticObjective::g_
const Ptr< const Vector< Real > > g_
Definition
ROL_QuadraticObjective.hpp:40
ROL::QuadraticObjective::H_
const Ptr< const LinearOperator< Real > > H_
Definition
ROL_QuadraticObjective.hpp:39
ROL::QuadraticObjective::c_
const Real c_
Definition
ROL_QuadraticObjective.hpp:41
ROL::QuadraticObjective::tmp_
Ptr< Vector< Real > > tmp_
Definition
ROL_QuadraticObjective.hpp:42
ROL::QuadraticObjective::invHessVec
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_QuadraticObjective_Def.hpp:44
ROL::QuadraticObjective::hessVec
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_QuadraticObjective_Def.hpp:39
ROL::QuadraticObjective::QuadraticObjective
QuadraticObjective(const Ptr< const LinearOperator< Real > > &H, const Ptr< const Vector< Real > > &g, Real c=Real(0))
Definition
ROL_QuadraticObjective_Def.hpp:16
ROL::QuadraticObjective::value
Real value(const Vector< Real > &x, Real &tol) override
Definition
ROL_QuadraticObjective_Def.hpp:24
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::plus
virtual void plus(const Vector &x)=0
Compute , where .
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0