Debian Codegraph @

packages/rol/example/l1-penalty/identity_constraint.hpp

raw
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 #pragma once
11 #ifndef IDENTITY_CONSTRAINT_HPP
12 #define IDENTITY_CONSTRAINT_HPP
13
14 #include "ROL_Constraint.hpp"
15
16 namespace ROL {
17
18 template<typename Real>
19 class IdentityConstraint : public ROL::Constraint<Real> {
20 public:
21
22 IdentityConstraint() = default;
23
24 void value( Vector<Real>& c,
25 const Vector<Real>& x,
26 Real& tol ) override {
27 c.set(x);
28 }
29
30 void applyJacobian( Vector<Real>& jv,
31 const Vector<Real>& v,
32 const Vector<Real>& x,
33 Real& tol ) override {
34 jv.set(v);
35 }
36
37 void applyAdjointJacobian( Vector<Real>& ajv,
38 const Vector<Real>& v,
39 const Vector<Real>& x,
40 Real& tol ) override {
41 ajv.set(v);
42 }
43
44 void applyAdjointHessian( Vector<Real>& ahuv,
45 const Vector<Real>& u,
46 const Vector<Real>& v,
47 const Vector<Real>& x,
48 Real& tol ) override {
49 ahuv.zero();
50 }
51 };
52
53 } // namespace ROL
54
55 #endif //IDENTITY_CONSTRAINT_HPP
56