ROL
ROL_NullOperator.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_NULLOPERATOR_H
11 #define ROL_NULLOPERATOR_H
12 
13 #include "ROL_LinearOperator.hpp"
14 
15 
21 namespace ROL {
22 
23 template<class Real>
24 class NullOperator : public LinearOperator<Real> {
25 
26  void apply( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
27  Hv.zero();
28  }
29 
30  void applyInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
31  ROL_TEST_FOR_EXCEPTION( true, std::logic_error,
32  ">>> ERROR (ROL_NullOperator, applyInverse): "
33  "Null Operator has no inverse.");
34  }
35 
36 };
37 
38 } // namespace ROL
39 
40 
41 
42 
43 #endif // ROL_NULLOPERATOR_H
44 
virtual void zero()
Set to zero vector.
Definition: ROL_Vector.hpp:133
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
Provides the interface to apply a linear operator.
Multiplication by zero.