ROL
ROL_SchurComplement.hpp
Go to the documentation of this file.
1 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
2 // license for use of this work by or on behalf of the U.S. Government.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // 1. Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // 3. Neither the name of the Corporation nor the names of the
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 //
31 // Questions? Contact lead developers:
32 // Drew Kouri (dpkouri@sandia.gov) and
33 // Denis Ridzal (dridzal@sandia.gov)
34 //
35 // ************************************************************************
36 // @HEADER
37 
38 #ifndef ROL_SCHURCOMPLEMENT_H
39 #define ROL_SCHURCOMPLEMENT_H
40 
44 
45 namespace ROL {
46 
71 template class<Real>
73 
74  typedef Vector<Real> V;
79 
80 private:
81 
82  ROL::Ptr<OP> A_, B_, C_, D_;
83 
84  ROL::Ptr<OP> L_,U_;
85  ROL::Ptr<V> scratch1_;
86 
87 
88 
89 public:
90 
91  SchurComplement( ROL::Ptr<OP> &A, ROL::Ptr<OP> &B,
92  ROL::Ptr<OP> &C, ROL::Ptr<OP> &D,
93  ROL::Ptr<V> &scratch1 ) :
94  A_(A), B_(B), C_(C), D_(D), scratch1_(scratch1) {
95 
96  U_ = ROL::makePtr<UPPER>(B_);
97  L_ = ROL::makePtr<LOWER>(C_);
98 
99  }
100 
101 
102  SchurComplement( BlockOperator2<Real> &op, ROL::Ptr<Vector<Real> > &scratch1 ) :
103  scratch1_(scratch1) {}
104 
105 
106 
107  A_ = op.getOperator(0,0);
108  B_ = op.getOperator(0,1);
109  C_ = op.getOperator(1,0);
110  D_ = op.getOperator(1,1);
111 
112  U_ = ROL::makePtr<UPPER>(B_);
113  L_ = ROL::makePtr<LOWER>(C_);
114 
115  void applyLower( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) {
116  L_->apply(Hv,v,tol);
117  }
118 
119  void applyLowerInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) {
120  L_->applyInverse(Hv,v,tol);
121  }
122 
123  void applyUpper( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) {
124  U_->apply(Hv,v,tol);
125  }
126 
127  void applyUpperInverse( Vector<Real> &Hv, const Vector<Real> &v, Real &tol ) {
128  U_->applyInverse(Hv,v,tol);
129  }
130 
131  ROL::Ptr<OP> getS11( void ) {
132  return ROL::makePtr<BlockOperator2Determinant<Real>>(A_,B_,C_,D_,scratch1_);
133  }
134 
135  void solve2( Vector<Real> &Hv2, const Vector<Real> &v2, Real &tol ) {
136  D_->applyInverse(Hv2,v2,tol);
137  }
138 
139 }; // class SchurComplement
140 
141 
142 } // namesapce ROL
143 
144 #endif // ROL_SCHURCOMPLEMENT_H
145 
void solve2(Vector< Real > &Hv2, const Vector< Real > &v2, Real &tol)
Provides the interface to apply a 2x2 block unit upper operator to a partitioned vector.
SchurComplement(ROL::Ptr< OP > &A, ROL::Ptr< OP > &B, ROL::Ptr< OP > &C, ROL::Ptr< OP > &D, ROL::Ptr< V > &scratch1)
ROL::Ptr< OP > B_
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Ptr< OP > D_
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
BlockOperator2UnitUpper UPPER
ROL::Ptr< OP > A_
ROL::Ptr< OP > getS11(void)
BlockOperator2UnitLower LOWER
Provides the interface to apply a linear operator.
Provides the interface to apply a 2x2 block unit lower operator to a partitioned vector.
PartitionedVector< Real > PV
void applyUpperInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol)
Provides the interface to apply a 2x2 block operator to a partitioned vector.
ROL::Ptr< OP > C_
void applyUpper(Vector< Real > &Hv, const Vector< Real > &v, Real &tol)
void applyLower(Vector< Real > &Hv, const Vector< Real > &v, Real &tol)
SchurComplement(BlockOperator2< Real > &op, ROL::Ptr< Vector< Real > > &scratch1)
LinearOperator< Real > OP
Given a 2x2 block operator, perform the Schur reduction and return the decoupled system components...
void applyLowerInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol)