ConstrainedOptPack: C++ Tools for Constrained (and Unconstrained) Optimization  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ConstrainedOptPack_DecompositionSystem.hpp
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_H
43 #define DECOMPOSITION_SYSTEM_H
44 
45 #include <stdexcept>
46 
47 #include "ConstrainedOptPack_Types.hpp"
48 #include "AbstractLinAlgPack_VectorSpace.hpp"
49 
50 namespace ConstrainedOptPack {
51 
90 public:
91 
94 
96  typedef Teuchos::RCP<
99  typedef Teuchos::RCP<
102  class SingularDecomposition : public std::logic_error
103  {public: SingularDecomposition(const std::string& what_arg) : std::logic_error(what_arg) {}};
105  class InvalidMatrixType : public std::logic_error
106  {public: InvalidMatrixType(const std::string& what_arg) : std::logic_error(what_arg) {}};
108  class TestFailed : public std::runtime_error
109  {public: TestFailed(const std::string& what_arg) : std::runtime_error(what_arg) {}};
112  PRINT_NONE = 0,
113  PRINT_BASIC_INFO = 1,
114  PRINT_MORE_INFO = 2,
115  PRINT_VECTORS = 3,
116  PRINT_EVERY_THING = 4
117  };
119  enum ERunTests { RUN_TESTS, NO_TESTS };
121  enum EMatRelations { MATRICES_INDEP_IMPS, MATRICES_ALLOW_DEP_IMPS };
122 
124 
126  virtual ~DecompositionSystem() {}
127 
130 
140  virtual size_type n() const;
141 
148  virtual size_type m() const = 0;
149 
159  virtual size_type r() const;
160 
165  virtual Range1D equ_decomp() const;
166 
172  virtual Range1D equ_undecomp() const;
173 
175 
178 
186  virtual const VectorSpace::space_ptr_t space_range() const = 0;
187 
195  virtual const VectorSpace::space_ptr_t space_null() const = 0;
196 
198 
201 
204  virtual const mat_fcty_ptr_t factory_Z() const = 0;
205 
208  virtual const mat_fcty_ptr_t factory_Y() const = 0;
209 
212  virtual const mat_nonsing_fcty_ptr_t factory_R() const = 0;
213 
216  virtual const mat_fcty_ptr_t factory_Uz() const = 0;
217 
220  virtual const mat_fcty_ptr_t factory_Uy() const = 0;
221 
223 
226 
351  virtual void update_decomp(
352  std::ostream *out
353  ,EOutputLevel olevel
354  ,ERunTests test_what
355  ,const MatrixOp &Gc
356  ,MatrixOp *Z
357  ,MatrixOp *Y
358  ,MatrixOpNonsing *R
359  ,MatrixOp *Uz
360  ,MatrixOp *Vy
361  ,EMatRelations mat_rel = MATRICES_INDEP_IMPS
362  ) const = 0;
363 
367  virtual void print_update_decomp(
368  std::ostream& out, const std::string& leading_str ) const = 0;
369 
371 
372 }; // end class DecompositionSystem
373 
374 } // end namespace ConstrainedOptPack
375 
376 #endif // DECOMPOSITION_SYSTEM_H
virtual const mat_fcty_ptr_t factory_Uz() const =0
Return a matrix factory object for Uz
virtual const mat_fcty_ptr_t factory_Y() const =0
Return a matrix factory object for Y
virtual Range1D equ_undecomp() const
Returns the range of the undecomposed equalities.
EOutputLevel
Enumeration for the amount of output to create from update_decomp().
ERunTests
Enumeration for if to run internal tests or not.
virtual size_type r() const
Returns the rank of Gc(:,equ_decomp()).
virtual const VectorSpace::space_ptr_t space_range() const =0
Return a VectorSpace object for the range space.
virtual Range1D equ_decomp() const
Returns the range of the decomposed equalities.
virtual void print_update_decomp(std::ostream &out, const std::string &leading_str) const =0
Print the sub-algorithm by which the decomposition is formed.
virtual const mat_fcty_ptr_t factory_Uy() const =0
Return a matrix factory object for Uy
size_t size_type
This class abstracts a decomposition choice for the quasi-range space Y and null space Z matrices for...
virtual const mat_fcty_ptr_t factory_Z() const =0
Return a matrix factory object for Z
virtual size_type n() const
Return the number of rows in Gc.
virtual void update_decomp(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const MatrixOp &Gc, MatrixOp *Z, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uz, MatrixOp *Vy, EMatRelations mat_rel=MATRICES_INDEP_IMPS) const =0
Creates the range/null decomposition for Gc(:,equ_decomp)'.
Teuchos::RCP< const Teuchos::AbstractFactory< MatrixOp > > mat_fcty_ptr_t
virtual const VectorSpace::space_ptr_t space_null() const =0
Return a VectorSpace object for the range space.
virtual size_type m() const =0
Return the number of columns in Gc.
Teuchos::RCP< const Teuchos::AbstractFactory< MatrixOpNonsing > > mat_nonsing_fcty_ptr_t
virtual const mat_nonsing_fcty_ptr_t factory_R() const =0
Return a matrix factory object for R.