MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConstrainedOptPack_DecompositionSystemVarReductImp.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
43 #define DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
44 
50 
51 namespace ConstrainedOptPack {
52 
93 public:
94 
97 
102 
104 
107 
109  STANDARD_COMPOSITION_MEMBERS( BasisSystemTester, basis_sys_tester );
110 
124  const VectorSpace::space_ptr_t &space_x
125  ,const VectorSpace::space_ptr_t &space_c
126  ,const basis_sys_ptr_t &basis_sys
127  ,const basis_sys_tester_ptr_t &basis_sys_tester
128  ,EExplicitImplicit D_imp
129  ,EExplicitImplicit Uz_imp
130  );
131 
133 
157  void initialize(
158  const VectorSpace::space_ptr_t &space_x
159  ,const VectorSpace::space_ptr_t &space_c
160  ,const basis_sys_ptr_t &basis_sys
161  );
162 
165 
167  const VectorSpace::space_ptr_t& space_x() const;
169  const VectorSpace::space_ptr_t& space_c() const;
171  const basis_sys_ptr_t& basis_sys() const;
172 
174 
177 
214  void get_basis_matrices(
215  std::ostream *out
216  ,EOutputLevel olevel
217  ,ERunTests test_what
218  ,MatrixOp *Z
219  ,MatrixOp *Y
220  ,MatrixOpNonsing *R
221  ,MatrixOp *Uz
222  ,MatrixOp *Uy
224  ,Teuchos::RCP<MatrixOp> *D_ptr
225  );
226 
255  void set_basis_matrices(
256  std::ostream *out
257  ,EOutputLevel olevel
258  ,ERunTests test_what
259  ,const Teuchos::RCP<MatrixOpNonsing> &C_ptr
260  ,const Teuchos::RCP<MatrixOp> &D_ptr
261  ,MatrixOp *Uz
263  );
264 
266  EExplicitImplicit D_imp_used() const;
267 
269 
272 
274  size_type n() const;
276  size_type m() const;
278  size_type r() const;
280  const VectorSpace::space_ptr_t space_range() const;
282  const VectorSpace::space_ptr_t space_null() const;
284  const mat_fcty_ptr_t factory_Z() const;
286  const mat_fcty_ptr_t factory_Uz() const;
295  void update_decomp(
296  std::ostream *out
297  ,EOutputLevel olevel
298  ,ERunTests test_what
299  ,const MatrixOp &Gc
300  ,MatrixOp *Z
301  ,MatrixOp *Y
302  ,MatrixOpNonsing *R
303  ,MatrixOp *Uz
304  ,MatrixOp *Uy
305  ,EMatRelations mat_rel
306  ) const;
308  void print_update_decomp(
309  std::ostream& out, const std::string& leading_str ) const;
310 
312 
315 
317  Range1D var_indep() const;
319  Range1D var_dep() const;
320 
322 
323 protected:
324 
326  virtual void update_D_imp_used(EExplicitImplicit *D_imp_used) const;
327 
336  virtual mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t uninitialize_matrices(
337  std::ostream *out
338  ,EOutputLevel olevel
339  ,MatrixOp *Y
340  ,MatrixOpNonsing *R
341  ,MatrixOp *Uy
342  ) const = 0;
343 
352  virtual void initialize_matrices(
353  std::ostream *out
354  ,EOutputLevel olevel
355  ,const mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t &C_ptr
356  ,const mat_fcty_ptr_t::element_type::obj_ptr_t &D_ptr
357  ,MatrixOp *Y
358  ,MatrixOpNonsing *R
359  ,MatrixOp *Uy
360  ,EMatRelations mat_rel
361  ) const = 0;
362 
367  virtual void print_update_matrices(
368  std::ostream& out, const std::string& leading_str ) const = 0;
369 
370 private:
371 
372  // //////////////////////////////////
373  // Private data members
374 
375 #ifdef DOXYGEN_COMPILE
377  VectorSpace *space_x;
378  VectorSpace *space_c;
379  VectorSpace *space_range;
380  VectorSpace *space_null;
381 #else
382  basis_sys_ptr_t basis_sys_;
383  VectorSpace::space_ptr_t space_x_;
384  VectorSpace::space_ptr_t space_c_;
385  VectorSpace::space_ptr_t space_range_;
386  VectorSpace::space_ptr_t space_null_;
387  mutable Teuchos::RCP<MatrixOpNonsing> C_ptr_;
388  mutable Teuchos::RCP<MatrixOp> D_ptr_;
389  mutable EExplicitImplicit D_imp_used_;
390 #endif
391  // //////////////////////////////////
392  // Private member functions
393 
395  void alloc_new_D_matrix(
396  std::ostream *out
397  ,EOutputLevel olevel
398  ,Teuchos::RCP<MatrixOp> *D_ptr
399  ) const;
400 
401  // not defined and not to be called!
404 
405 }; // end class DecompositionSystemVarReductImp
406 
407 // //////////////////////////////////////////
408 // Inline members
409 
410 inline
411 const VectorSpace::space_ptr_t&
413 {
414  return space_x_;
415 }
416 
417 inline
418 const VectorSpace::space_ptr_t&
420 {
421  return space_c_;
422 }
423 
424 inline
427 {
428  return basis_sys_;
429 }
430 
431 inline
434 {
435  update_D_imp_used(&D_imp_used_);
436  return D_imp_used_;
437 }
438 
439 } // end namespace ConstrainedOptPack
440 
441 #endif // DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
DecompositionSystemVarReductImp(const VectorSpace::space_ptr_t &space_x, const VectorSpace::space_ptr_t &space_c, const basis_sys_ptr_t &basis_sys, const basis_sys_tester_ptr_t &basis_sys_tester, EExplicitImplicit D_imp, EExplicitImplicit Uz_imp)
Construct a variable reduction decomposition.
f_dbl_prec const f_int f_dbl_prec * Y
AbstractLinAlgPack::size_type size_type
virtual void update_D_imp_used(EExplicitImplicit *D_imp_used) const
Update D_imp_used.
Interface for the creation and maintainance of a basis matrix for a decomposition of linearlized cons...
virtual mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t uninitialize_matrices(std::ostream *out, EOutputLevel olevel, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uy) const =0
Overridden by subclasses to uninitialized Y, R and Uy then return C if referenced.
const VectorSpace::space_ptr_t space_range() const
Returns this->space_x()->sub_space(var_dep)
void print_update_decomp(std::ostream &out, const std::string &leading_str) const
EOutputLevel
Enumeration for the amount of output to create from update_decomp().
ERunTests
Enumeration for if to run internal tests or not.
virtual void initialize_matrices(std::ostream *out, EOutputLevel olevel, const mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t &C_ptr, const mat_fcty_ptr_t::element_type::obj_ptr_t &D_ptr, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uy, EMatRelations mat_rel) const =0
Overridden by subclasses to initialize Y, R and Uy given C and D.
const basis_sys_ptr_t & basis_sys() const
STANDARD_COMPOSITION_MEMBERS(BasisSystemTester, basis_sys_tester)
Set the BasisSystem tester object.
const VectorSpace::space_ptr_t & space_c() const
void get_basis_matrices(std::ostream *out, EOutputLevel olevel, ERunTests test_what, MatrixOp *Z, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uz, MatrixOp *Uy, Teuchos::RCP< MatrixOpNonsing > *C_ptr, Teuchos::RCP< MatrixOp > *D_ptr)
Called by client to uninitialize decomposition matrices in prepairation for selecting a different bas...
void initialize(const VectorSpace::space_ptr_t &space_x, const VectorSpace::space_ptr_t &space_c, const basis_sys_ptr_t &basis_sys)
Initialize.
void update_decomp(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const MatrixOp &Gc, MatrixOp *Z, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uz, MatrixOp *Uy, EMatRelations mat_rel) const
Preconditions:
DecompositionSystemVarReductImp & operator=(const DecompositionSystemVarReductImp &)
void alloc_new_D_matrix(std::ostream *out, EOutputLevel olevel, Teuchos::RCP< MatrixOp > *D_ptr) const
Allocate a new D_ptr matrix.
virtual void print_update_matrices(std::ostream &out, const std::string &leading_str) const =0
Print the sub-algorithm by which the matrices Y, R, Uy and Uy are updated.
std::ostream * out
EExplicitImplicit D_imp_used() const
Get the type of D matrix to be used or is being used (returns MAT_IMP_EXPLICIT or MAT_IMP_IMPLICIT on...
This class abstracts a decomposition choice for the quasi-range space Y and null space Z matrices for...
Specialization of DecompositionSystem for variable reduction decompositions.
size_type r() const
Returns this->basis_sys()->equ_decomp().size().
const VectorSpace::space_ptr_t & space_x() const
const VectorSpace::space_ptr_t space_null() const
Returns this->space_x()->sub_space(var_indep)
Specialization node implementation subclass of DecompositionSystem for variable reduction decompositi...
void set_basis_matrices(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const Teuchos::RCP< MatrixOpNonsing > &C_ptr, const Teuchos::RCP< MatrixOp > &D_ptr, MatrixOp *Uz, const basis_sys_ptr_t &basis_sys=Teuchos::null)
Set updated basis matrices along with a possibly updated basis system object.