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"
15 #include "ROL_LinearOperator.hpp"
16 
26 namespace ROL {
27 
28 template <class Real>
30 private:
31  const ROL::Ptr<const Vector<Real> > x_;
32  ROL::Ptr<Constraint<Real> > con_;
33 
34 
35 public:
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
LinearOperatorFromConstraint(const ROL::Ptr< const Vector< Real > > &x, const ROL::Ptr< Constraint< Real > > &con)
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
const ROL::Ptr< const Vector< Real > > x_
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.
Provides the interface to apply a linear operator.
virtual void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
virtual void set(const Vector &x)
Set where .
Definition: ROL_Vector.hpp:175
Defines the general constraint operator interface.