42 #include "ConstrainedOptPack_DecompositionSystemVarReductPermStd.hpp"
43 #include "ConstrainedOptPack_DecompositionSystemVarReductImp.hpp"
44 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
45 #include "AbstractLinAlgPack_BasisSystemPerm.hpp"
46 #include "AbstractLinAlgPack_PermutationOut.hpp"
47 #include "AbstractLinAlgPack_MatrixOpOut.hpp"
48 #include "Teuchos_Assert.hpp"
50 namespace ConstrainedOptPack {
54 DecompositionSystemVarReductPermStd::DecompositionSystemVarReductPermStd(
62 this->
initialize(decomp_sys_imp,basis_sys,basis_selected,D_imp,Uz_imp);
75 basis_selected_ = basis_selected;
107 const VectorSpace::space_ptr_t
113 const VectorSpace::space_ptr_t
135 if( factory_R.
get() != NULL )
138 return basis_sys_->factory_C();
166 assert_basis_selected();
168 out,olevel,test_what,Gc,Z,Y
174 std::ostream& out,
const std::string& L )
const
184 return basis_sys_.
get() ? basis_sys_->var_indep() : Range1D::Invalid;
189 return basis_sys_.
get() ? basis_sys_->var_dep() : Range1D::Invalid;
208 return basis_selected_;
215 ,
const Permutation &P_var
216 ,
const Range1D &var_dep
217 ,
const Permutation *P_equ
218 ,
const Range1D *equ_decomp
229 decomp_sys_imp_->D_imp( this->D_imp() );
230 decomp_sys_imp_->Uz_imp( this->Uz_imp() );
236 decomp_sys_imp_->get_basis_matrices(
237 out, olevel, test_what
244 basis_sys_->set_basis(
250 ,this->Uz_imp() == MAT_IMP_EXPLICIT ? Uz : NULL
251 ,(mat_rel == MATRICES_INDEP_IMPS
252 ? BasisSystem::MATRICES_INDEP_IMPS : BasisSystem::MATRICES_ALLOW_DEP_IMPS )
256 catch(
const BasisSystem::SingularBasis& except ) {
257 if(out && olevel >= PRINT_BASIC_INFO)
258 *out <<
"Passed in basis is singular, throwing SingularDecomposition: "
259 << except.what() << std::endl;
262 ,
"DecompositionSystemVarReductPermStd::set_decomp(...): Passed in basis selection "
263 "gave a singular basis matrix! : " << except.what() );
271 decomp_sys_imp_->set_basis_matrices(
272 out, olevel, test_what
278 C_ptr = Teuchos::null;
279 D_ptr = Teuchos::null;
281 out,olevel,test_what,Gc,Z,Y,R
287 basis_selected_ =
true;
309 decomp_sys_imp_->D_imp( this->D_imp() );
310 decomp_sys_imp_->Uz_imp( this->Uz_imp() );
317 decomp_sys_imp_->get_basis_matrices(
318 out, olevel, test_what
324 basis_sys_->select_basis(
331 ,this->Uz_imp() == MAT_IMP_EXPLICIT ? Uz : NULL
332 ,(mat_rel == MATRICES_INDEP_IMPS
333 ? BasisSystem::MATRICES_INDEP_IMPS : BasisSystem::MATRICES_ALLOW_DEP_IMPS )
337 if( out && (
int)olevel >= (int)PRINT_BASIC_INFO ) {
340 <<
"\nSelected a new basis\n"
341 <<
"\nbs.var_dep() = ["<<var_dep->lbound()<<
","<<var_dep->ubound()<<
"]"
342 <<
"\nds.var_indep() = ["<<var_indep.lbound()<<
","<<var_indep.ubound()<<
"]"
343 <<
"\nds.equ_decomp() = ["<<equ_decomp->lbound()<<
","<<equ_decomp->ubound()<<
"]"
347 if( out && (
int)olevel >= (
int)PRINT_VECTORS ) {
349 <<
"\nP_var =\n" << *P_var
350 <<
"\nP_equ =\n" << *P_equ
353 if( out && (
int)olevel >= (
int)PRINT_EVERY_THING ) {
355 <<
"\nGc =\n" << *Gc;
365 decomp_sys_imp_->set_basis_matrices(
366 out, olevel, test_what
372 C_ptr = Teuchos::null;
373 D_ptr = Teuchos::null;
375 out,olevel,test_what,*Gc,Z,Y,R
381 basis_selected_ =
true;
386 void DecompositionSystemVarReductPermStd::assert_basis_selected()
const
389 !basis_selected_, std::logic_error
390 ,
"DecompositionSystemVarReductPermStd::assert_basis_selected(): Error, "
391 "the methods set_decomp() or select_decomp() must be called first!" );
const mat_fcty_ptr_t factory_Y() const
const decomp_sys_imp_ptr_t & decomp_sys_imp() const
Range1D equ_decomp() const
void initialize(const decomp_sys_imp_ptr_t &decomp_sys_imp, const basis_sys_ptr_t &basis_sys, bool basis_selected=false, EExplicitImplicit D_imp=MAT_IMP_AUTO, EExplicitImplicit Uz_imp=MAT_IMP_AUTO)
Initialize given decomposition system and basis system objects.
EOutputLevel
Enumeration for the amount of output to create from update_decomp().
ERunTests
Enumeration for if to run internal tests or not.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void set_decomp(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const Permutation &P_var, const Range1D &var_dep, const Permutation *P_equ, const Range1D *equ_decomp, const MatrixOp &Gc, MatrixOp *Z, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uz, MatrixOp *Uy, EMatRelations mat_rel)
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
const mat_nonsing_fcty_ptr_t factory_R() const
Range1D var_indep() const
const mat_fcty_ptr_t factory_Z() const
void print_update_decomp(std::ostream &out, const std::string &leading_str) const
const mat_fcty_ptr_t factory_Uz() const
const perm_fcty_ptr_t factory_P_var() const
const mat_fcty_ptr_t factory_Uy() const
const perm_fcty_ptr_t factory_P_equ() const
const VectorSpace::space_ptr_t space_range() const
const VectorSpace::space_ptr_t space_null() const
const basis_sys_ptr_t & basis_sys() const
void select_decomp(std::ostream *out, EOutputLevel olevel, ERunTests test_what, const Vector *nu, MatrixOp *Gc, Permutation *P_var, Range1D *var_dep, Permutation *P_equ, Range1D *equ_decomp, MatrixOp *Z, MatrixOp *Y, MatrixOpNonsing *R, MatrixOp *Uz, MatrixOp *Uy, EMatRelations mat_rel)
Range1D equ_undecomp() const