ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
constraint
ROL_UpperBoundToConstraint_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_UPPER_BOUND_TO_CONSTRAINT_DEF_H
11
#define ROL_UPPER_BOUND_TO_CONSTRAINT_DEF_H
12
13
namespace
ROL
{
14
15
template
<
typename
Real>
16
UpperBoundToConstraint<Real>::UpperBoundToConstraint
(
BoundConstraint<Real>
&bnd) {
17
up_
= bnd.
getUpperBound
()->clone();
18
up_
->set(*bnd.
getUpperBound
());
19
}
20
21
template
<
typename
Real>
22
UpperBoundToConstraint<Real>::UpperBoundToConstraint
(
const
Vector<Real>
&up) {
23
up_
= up.
clone
();
24
up_
->set(up);
25
}
26
27
template
<
typename
Real>
28
void
UpperBoundToConstraint<Real>::value
(
Vector<Real>
&c,
const
Vector<Real>
&x, Real &tol) {
29
const
Real one(1);
30
c.
set
(*
up_
);
31
c.
axpy
(-one,x);
32
}
33
34
template
<
typename
Real>
35
void
UpperBoundToConstraint<Real>::applyJacobian
(
Vector<Real>
&jv,
36
const
Vector<Real>
&v,
37
const
Vector<Real>
&x,
38
Real &tol) {
39
const
Real one(1);
40
jv.
set
(v);
41
jv.
scale
(-one);
42
}
43
44
template
<
typename
Real>
45
void
UpperBoundToConstraint<Real>::applyAdjointJacobian
(
Vector<Real>
&ajv,
46
const
Vector<Real>
&v,
47
const
Vector<Real>
&x,
48
Real &tol) {
49
const
Real one(1);
50
ajv.
set
(v);
51
ajv.
scale
(-one);
52
}
53
54
template
<
typename
Real>
55
void
UpperBoundToConstraint<Real>::applyAdjointHessian
(
Vector<Real>
&ahuv,
56
const
Vector<Real>
&u,
57
const
Vector<Real>
&v,
58
const
Vector<Real>
&x,
59
Real &tol) {
60
ahuv.
zero
();
61
}
62
63
}
64
65
#endif
ROL::BoundConstraint
Provides the interface to apply upper and lower bound constraints.
Definition
ROL_BoundConstraint.hpp:39
ROL::BoundConstraint::getUpperBound
virtual const Ptr< const Vector< Real > > getUpperBound(void) const
Return the ref count pointer to the upper bound vector.
Definition
ROL_BoundConstraint_Def.hpp:90
ROL::UpperBoundToConstraint::up_
Ptr< Vector< Real > > up_
Definition
ROL_UpperBoundToConstraint.hpp:26
ROL::UpperBoundToConstraint::applyJacobian
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_UpperBoundToConstraint_Def.hpp:35
ROL::UpperBoundToConstraint::UpperBoundToConstraint
UpperBoundToConstraint(BoundConstraint< Real > &bnd)
Definition
ROL_UpperBoundToConstraint_Def.hpp:16
ROL::UpperBoundToConstraint::applyAdjointHessian
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_UpperBoundToConstraint_Def.hpp:55
ROL::UpperBoundToConstraint::value
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Definition
ROL_UpperBoundToConstraint_Def.hpp:28
ROL::UpperBoundToConstraint::applyAdjointJacobian
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Definition
ROL_UpperBoundToConstraint_Def.hpp:45
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
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::zero
virtual void zero()
Set to zero vector.
Definition
ROL_Vector.hpp:134
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
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