ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization Version of the Day
ConstrainedOptPack_DecompositionSystemVarReductImp.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
00043 #define DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
00044 
00045 #include "ConstrainedOptPack_DecompositionSystemVarReduct.hpp"
00046 #include "AbstractLinAlgPack_BasisSystemTester.hpp"
00047 #include "AbstractLinAlgPack_VectorSpace.hpp"
00048 #include "Teuchos_StandardCompositionMacros.hpp"
00049 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00050 
00051 namespace ConstrainedOptPack {
00052 
00092 class DecompositionSystemVarReductImp : public DecompositionSystemVarReduct {
00093 public:
00094 
00097 
00099   typedef DecompositionSystem                                inherited;
00101   typedef Teuchos::RCP<const BasisSystem>       basis_sys_ptr_t;
00102 
00104 
00107 
00109   STANDARD_COMPOSITION_MEMBERS( BasisSystemTester, basis_sys_tester );
00110 
00123   DecompositionSystemVarReductImp(
00124     const VectorSpace::space_ptr_t     &space_x
00125     ,const VectorSpace::space_ptr_t    &space_c
00126     ,const basis_sys_ptr_t             &basis_sys
00127     ,const basis_sys_tester_ptr_t      &basis_sys_tester
00128     ,EExplicitImplicit                 D_imp
00129     ,EExplicitImplicit                 Uz_imp
00130     );
00131 
00133 
00157   void initialize(
00158     const VectorSpace::space_ptr_t     &space_x
00159     ,const VectorSpace::space_ptr_t    &space_c
00160     ,const basis_sys_ptr_t             &basis_sys
00161     );
00162 
00165   
00167   const VectorSpace::space_ptr_t& space_x() const;
00169   const VectorSpace::space_ptr_t& space_c() const;
00171   const basis_sys_ptr_t& basis_sys() const;
00172 
00174 
00177 
00214   void get_basis_matrices(
00215     std::ostream                                      *out
00216     ,EOutputLevel                                     olevel
00217     ,ERunTests                                        test_what
00218     ,MatrixOp                                         *Z
00219     ,MatrixOp                                         *Y
00220     ,MatrixOpNonsing                                  *R
00221     ,MatrixOp                                         *Uz
00222     ,MatrixOp                                         *Uy
00223     ,Teuchos::RCP<MatrixOpNonsing>       *C_ptr
00224     ,Teuchos::RCP<MatrixOp>              *D_ptr
00225     );
00226 
00255   void set_basis_matrices(
00256     std::ostream                                       *out
00257     ,EOutputLevel                                      olevel
00258     ,ERunTests                                         test_what
00259     ,const Teuchos::RCP<MatrixOpNonsing>  &C_ptr
00260     ,const Teuchos::RCP<MatrixOp>         &D_ptr
00261     ,MatrixOp                                          *Uz
00262     ,const basis_sys_ptr_t                             &basis_sys   = Teuchos::null
00263     );
00264 
00266   EExplicitImplicit D_imp_used() const; 
00267 
00269 
00272 
00274   size_type n() const;
00276   size_type m() const;
00278   size_type r() const;
00280   const VectorSpace::space_ptr_t space_range() const;
00282   const VectorSpace::space_ptr_t space_null() const;
00284   const mat_fcty_ptr_t factory_Z() const;
00286   const mat_fcty_ptr_t factory_Uz() const;
00295   void update_decomp(
00296     std::ostream          *out
00297     ,EOutputLevel         olevel
00298     ,ERunTests            test_what
00299     ,const MatrixOp       &Gc
00300     ,MatrixOp             *Z
00301     ,MatrixOp             *Y
00302     ,MatrixOpNonsing      *R
00303     ,MatrixOp             *Uz
00304     ,MatrixOp             *Uy
00305     ,EMatRelations        mat_rel
00306     ) const;
00308   void print_update_decomp(
00309     std::ostream& out, const std::string& leading_str ) const;
00310 
00312 
00315 
00317   Range1D var_indep() const;
00319   Range1D var_dep() const;
00320 
00322 
00323 protected:
00324 
00326   virtual void update_D_imp_used(EExplicitImplicit *D_imp_used) const;
00327 
00336   virtual mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t uninitialize_matrices(
00337     std::ostream                     *out
00338     ,EOutputLevel                    olevel
00339     ,MatrixOp                        *Y
00340     ,MatrixOpNonsing                 *R
00341     ,MatrixOp                        *Uy
00342     ) const = 0;
00343 
00352   virtual void initialize_matrices(
00353     std::ostream                                           *out
00354     ,EOutputLevel                                          olevel
00355     ,const mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t &C_ptr
00356     ,const mat_fcty_ptr_t::element_type::obj_ptr_t         &D_ptr
00357     ,MatrixOp                                              *Y
00358     ,MatrixOpNonsing                                       *R
00359     ,MatrixOp                                              *Uy
00360     ,EMatRelations                                         mat_rel
00361     ) const = 0;
00362 
00367   virtual void print_update_matrices(
00368     std::ostream& out, const std::string& leading_str ) const = 0;
00369 
00370 private:
00371 
00372   // //////////////////////////////////
00373   // Private data members
00374   
00375 #ifdef DOXYGEN_COMPILE
00376   AbstractLinAlgPack::BasisSystem       *basis_sys;
00377   VectorSpace                           *space_x;
00378   VectorSpace                           *space_c;
00379   VectorSpace                           *space_range;
00380   VectorSpace                           *space_null;
00381 #else
00382   basis_sys_ptr_t                       basis_sys_;
00383   VectorSpace::space_ptr_t              space_x_;
00384   VectorSpace::space_ptr_t              space_c_;
00385   VectorSpace::space_ptr_t              space_range_;
00386   VectorSpace::space_ptr_t              space_null_;
00387   mutable Teuchos::RCP<MatrixOpNonsing>  C_ptr_;
00388   mutable Teuchos::RCP<MatrixOp>             D_ptr_;
00389   mutable EExplicitImplicit                                   D_imp_used_;
00390 #endif
00391   // //////////////////////////////////
00392   // Private member functions
00393 
00395   void alloc_new_D_matrix( 
00396     std::ostream                             *out
00397     ,EOutputLevel                            olevel
00398     ,Teuchos::RCP<MatrixOp> *D_ptr
00399     ) const;
00400   
00401   // not defined and not to be called!
00402   DecompositionSystemVarReductImp(const DecompositionSystemVarReductImp&);
00403   DecompositionSystemVarReductImp& operator=(const DecompositionSystemVarReductImp&);
00404   
00405 };  // end class DecompositionSystemVarReductImp
00406 
00407 // //////////////////////////////////////////
00408 // Inline members
00409 
00410 inline
00411 const VectorSpace::space_ptr_t&
00412 DecompositionSystemVarReductImp::space_x() const
00413 {
00414   return space_x_;
00415 }
00416 
00417 inline
00418 const VectorSpace::space_ptr_t&
00419 DecompositionSystemVarReductImp::space_c() const
00420 {
00421   return space_c_;
00422 }
00423 
00424 inline
00425 const DecompositionSystemVarReductImp::basis_sys_ptr_t&
00426 DecompositionSystemVarReductImp::basis_sys() const
00427 {
00428   return basis_sys_;
00429 }
00430 
00431 inline
00432 DecompositionSystemVarReductImp::EExplicitImplicit
00433 DecompositionSystemVarReductImp::D_imp_used() const
00434 {
00435   update_D_imp_used(&D_imp_used_);
00436   return D_imp_used_;
00437 }
00438 
00439 } // end namespace ConstrainedOptPack
00440 
00441 #endif  // DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends