ROL
ROL_LinearOperatorFromConstraint.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_LINEAROPERATOR_FROM_EQUALITYCONSTRAINT_H
11#define ROL_LINEAROPERATOR_FROM_EQUALITYCONSTRAINT_H
12
13#include "ROL_Vector.hpp"
14#include "ROL_Constraint.hpp"
16
26namespace ROL {
27
28template <class Real>
30private:
31 const ROL::Ptr<const Vector<Real> > x_;
32 ROL::Ptr<Constraint<Real> > con_;
33
34
35public:
36
37 LinearOperatorFromConstraint( const ROL::Ptr<const Vector<Real> > &x,
38 const ROL::Ptr<Constraint<Real> > &con ) :
39 x_(x), con_(con) {
40 }
41
43
44 virtual void apply( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
45 con_->applyJacobian(Hv,v,*x_,tol);
46 }
47
48 // Not implemented for generic equality constraint
49 virtual void applyInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
50 Hv.set(v);
51 }
52
53}; // class LinearOperator
54
55} // namespace ROL
56
57#endif
Defines the general constraint operator interface.
A simple wrapper which allows application of constraint Jacobians through the LinearOperator interfac...
virtual void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
const ROL::Ptr< const Vector< Real > > x_
virtual void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
LinearOperatorFromConstraint(const ROL::Ptr< const Vector< Real > > &x, const ROL::Ptr< Constraint< Real > > &con)
Provides the interface to apply a linear operator.
Defines the linear algebra or vector space interface.
virtual void set(const Vector &x)
Set where .