ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
prox
ROL_ShiftedProxObjective.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_SHIFTEDPROXOBJECTIVE_HPP
11
#define ROL_SHIFTEDPROXOBJECTIVE_HPP
12
13
#include "
ROL_ProxObjective.hpp
"
14
15
namespace
ROL
{
16
17
template
<
typename
Real>
18
class
ShiftedProxObjective
:
public
ProxObjective
<Real> {
19
private
:
20
const
Ptr<ProxObjective<Real>>
prox_
;
21
const
Ptr<Vector<Real>>
x_
,
xtmp_
;
22
23
public
:
24
ShiftedProxObjective
(
const
Ptr<
ProxObjective<Real>
> &
prox
,
const
Ptr<
Vector<Real>
> &x)
25
:
prox_
(
prox
),
x_
(x->clone()),
xtmp_
(x->clone()) {}
26
27
void
setX
(
const
Vector<Real>
&x) {
28
x_
->set(x);
29
}
30
31
Real
value
(
const
Vector<Real>
x, Real &tol)
override
{
32
xtmp_
->set(*
x_
);
xtmp_
->plus(x);
33
return
prox_
->(*
xtmp_
,tol);
34
}
35
36
void
gradient
(
Vector<Real>
&g,
const
Vector<Real>
&x, Real &tol)
override
{
37
xtmp_
->set(*
x_
);
xtmp_
->plus(x);
38
prox_
->gradient(g,*
xtmp_
,tol);
39
}
40
41
void
prox
(
Vector<Real>
&x, Real gamma)
override
{
42
x.
plus
(*
x_
);
43
prox_
->prox(x,gamma);
44
x.
axpy
(
static_cast<
Real
>
(-1),*
x_
);
45
}
46
47
};
48
49
}
50
51
#endif
ROL_ProxObjective.hpp
ROL::ProxObjective
Definition
ROL_ProxObjective.hpp:18
ROL::ShiftedProxObjective::x_
const Ptr< Vector< Real > > x_
Definition
ROL_ShiftedProxObjective.hpp:21
ROL::ShiftedProxObjective::xtmp_
const Ptr< Vector< Real > > xtmp_
Definition
ROL_ShiftedProxObjective.hpp:21
ROL::ShiftedProxObjective::prox
void prox(Vector< Real > &x, Real gamma) override
Definition
ROL_ShiftedProxObjective.hpp:41
ROL::ShiftedProxObjective::prox_
const Ptr< ProxObjective< Real > > prox_
Definition
ROL_ShiftedProxObjective.hpp:20
ROL::ShiftedProxObjective::value
Real value(const Vector< Real > x, Real &tol) override
Definition
ROL_ShiftedProxObjective.hpp:31
ROL::ShiftedProxObjective::setX
void setX(const Vector< Real > &x)
Definition
ROL_ShiftedProxObjective.hpp:27
ROL::ShiftedProxObjective::ShiftedProxObjective
ShiftedProxObjective(const Ptr< ProxObjective< Real > > &prox, const Ptr< Vector< Real > > &x)
Definition
ROL_ShiftedProxObjective.hpp:24
ROL::ShiftedProxObjective::gradient
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Definition
ROL_ShiftedProxObjective.hpp:36
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::Vector::axpy
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Definition
ROL_Vector.hpp:120
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0