ROL
ROL_RangeSpaceOperator.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_RANGE_SPACE_OPERATOR_H
11#define ROL_RANGE_SPACE_OPERATOR_H
12
13#include "ROL_Constraint.hpp"
14
22namespace ROL {
23
24template <class Real>
25class RangeSpaceOperator : public LinearOperator<Real> {
26private:
27 const Ptr<Constraint<Real>> con_;
28 const Ptr<Vector<Real>> x_;
29
30 mutable Ptr<Vector<Real>> b1_;
31 mutable Ptr<Vector<Real>> b2_;
32 mutable Ptr<Vector<Real>> mul_;
33
34public:
37 const Ptr<const Vector<Real>> &dom,
38 const Ptr<const Vector<Real>> &ran)
39 : con_(con), x_(dom->clone()) {
40 x_->set(*dom);
41 b1_ = dom->dual().clone();
42 b2_ = ran->clone();
43 mul_ = ran->dual().clone();
44 }
45
46 virtual void update( const Vector<Real> &x, bool flag = true, int iter = -1 ) {
47 x_->set(x);
48 }
49
50 virtual void apply( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
51 b1_->zero(); b2_->set(v);
52 con_->solveAugmentedSystem(Hv,*mul_,*b1_,*b2_,*x_,tol); // This assumes linearity
53 }
54
55 void applyAdjoint( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
56 throw Exception::NotImplemented(">>> RangeSpaceOperator::applyAdjoint : Not Implemented!");
57 }
58
59 void applyInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
60 throw Exception::NotImplemented(">>> RangeSpaceOperator::applyInverse : Not Implemented!");
61 }
62
63 void applyAdjointInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
64 throw Exception::NotImplemented(">>> RangeSpaceOperator::applyAdjointInverse : Not Implemented!");
65 }
66
67}; // class RangeSpaceOperator
68
69} // namespace ROL
70
71#endif
Defines the general constraint operator interface.
Provides the interface to apply a linear operator.
Projects on to the null space of a linear constraint.
void applyAdjoint(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of linear operator.
const Ptr< Vector< Real > > x_
virtual void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update linear operator.
const Ptr< Constraint< Real > > con_
void applyAdjointInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of the inverse linear operator.
RangeSpaceOperator(const Ptr< Constraint< Real > > &con, const Ptr< const Vector< Real > > &dom, const Ptr< const Vector< Real > > &ran)
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
Defines the linear algebra or vector space interface.