ROL
ROL_BlockOperator2Determinant.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_BLOCKOPERATOR2DETERMINANT_H
11#define ROL_BLOCKOPERATOR2DETERMINANT_H
12
14
22namespace ROL {
23
24template <class Real>
26
27 typedef Vector<Real> V;
29
30private:
31
32 ROL::Ptr<OP> A_, B_, C_, D_;
33 ROL::Ptr<V> scratch_;
34
35public:
36
37 BlockOperator2Determinant( ROL::Ptr<OP> &A,
38 ROL::Ptr<OP> &B,
39 ROL::Ptr<OP> &C,
40 ROL::Ptr<OP> &D,
41 ROL::Ptr<V> &scratch ) :
42 A_(A), B_(B), C_(C), D_(D), scratch_(scratch) {}
43
44
45 virtual void update( const Vector<Real> &x, bool flag = true, int iter = -1 ) {
46 A_->update(x,flag,true);
47 B_->update(x,flag,true);
48 C_->update(x,flag,true);
49 D_->update(x,flag,true);
50 }
51
52 // Apply the determinant \f$(A-BD^{-1}B)\f$
53 virtual void apply( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
54 B_->apply(*scratch_,v,tol);
55 D_->applyInverse(Hv,*scratch_,tol);
56 C_->apply(*scratch_,Hv,tol);
57 A_->apply(Hv,v,tol);
58 Hv.axpy(-1.0,*scratch_);
59 }
60
61 virtual void applyInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) const {
62
63 ROL_TEST_FOR_EXCEPTION( true , std::logic_error,
64 ">>> ERROR (ROL_BlockOperator2Determinant, applyInverse): "
65 "Not implemented.");
66 }
67
68}; // class BlockOperator2Determinant
69
70} // namespace ROL
71
72#endif // ROL_BLOCKOPERATOR2DETERMINANT_H
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update linear operator.
virtual void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
BlockOperator2Determinant(ROL::Ptr< OP > &A, ROL::Ptr< OP > &B, ROL::Ptr< OP > &C, ROL::Ptr< OP > &D, ROL::Ptr< V > &scratch)
virtual 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.
Defines the linear algebra or vector space interface.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .