ROL
ROL_AugmentedSystemOperator.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_AUGMENTED_SYSTEM_OPERATOR_H
11#define ROL_AUGMENTED_SYSTEM_OPERATOR_H
12
13#include "ROL_Constraint.hpp"
15
23namespace ROL {
24
25template <class Real>
27private:
28 const Ptr<Constraint<Real>> con_;
29 const Ptr<const Vector<Real>> x_;
30 const Real delta_;
31
32public:
35 const Ptr<const Vector<Real>> &x,
36 const Real delta = 0.0)
37 : con_(con), x_(x), delta_(delta) {}
38
39 void apply( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
40 PartitionedVector<Real> &Hvp = dynamic_cast<PartitionedVector<Real>&>(Hv);
41 const PartitionedVector<Real> &vp = dynamic_cast<const PartitionedVector<Real>&>(v);
42
43 Ptr<Vector<Real>> h1 = Hvp.get(0)->dual().clone();
44 con_->applyAdjointJacobian(*h1, *(vp.get(1)), *x_, tol);
45 //con_->applyAdjointJacobian(*(Hvp.get(0)), *(vp.get(1)), *x_, tol);
46 //Hvp.get(0)->plus(*(vp.get(0)));
47 Hvp.get(0)->set(h1->dual()); Hvp.get(0)->plus(*(vp.get(0)));
48
49 con_->applyJacobian(*(Hvp.get(1)), *(vp.get(0)), *x_, tol);
50 if ( delta_ > static_cast<Real>(0) ) {
51 Hvp.get(1)->axpy(-delta_*delta_, *(vp.get(1)));
52 }
53 }
54
55 void applyAdjoint( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
56 apply(Hv,v,tol);
57 }
58
59 void applyInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
60 throw Exception::NotImplemented(">>> AugmentedSystemOperator::applyInverse : Not implemented!");
61 }
62
63 void applyAdjointInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
64 throw Exception::NotImplemented(">>> AugmentedSystemOperator::applyAdjointInverse : Not implemented!");
65 }
66
67}; // class AugmentedSystemOperator
68
69} // namespace ROL
70
71#endif
Apply the augmented system operator.
AugmentedSystemOperator(const Ptr< Constraint< Real > > &con, const Ptr< const Vector< Real > > &x, const Real delta=0.0)
void applyAdjointInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of the inverse linear operator.
const Ptr< const Vector< Real > > x_
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
const Ptr< Constraint< Real > > con_
void applyAdjoint(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of linear operator.
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
Defines the general constraint operator interface.
Provides the interface to apply a linear operator.
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Ptr< const Vector< Real > > get(size_type i) const
const V & dual(void) const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
Defines the linear algebra or vector space interface.