50 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
64 *num_adds = *num_drops = *num_adds_indep = *num_drops_indep = 0;
65 *num_active_indep = nu_k(indep).nz();
67 if( !nu_k.nz() && !nu_km1.nz() )
76 <<
"\n*** Changes in active set\n\n"
79 << setw(w) <<
"dep/indep"
80 << setw(w) <<
"change\n"
81 << setw(w) <<
"----------"
82 << setw(w) <<
"----------"
83 << setw(w) <<
"----------"
84 << setw(w) <<
"----------\n";
87 SpVectorSlice::const_iterator
88 nu_k_itr = nu_k.begin(),
89 nu_k_end = nu_k.end(),
90 nu_km1_itr = nu_km1.begin(),
91 nu_km1_end = nu_km1.end();
93 while( nu_k_itr != nu_k_end || nu_km1_itr != nu_km1_end ) {
94 if( nu_k_itr != nu_k_end && ( nu_km1_itr == nu_km1_end || ( nu_k_itr != nu_k_end
95 && nu_k_itr->indice()+nu_k.offset() < nu_km1_itr->indice()+nu_km1.offset() ) ) )
98 const size_type i = nu_k_itr->indice() + nu_k.offset();
99 const bool is_indep = indep.in_range(i);
106 << setw(w) << ( nu_k_itr->value() >= 0.0 ?
"upper" :
"lower" )
107 << setw(w) << ( is_indep ?
"indep" :
"dep" )
108 << setw(w) <<
"added" << endl;
111 else if( nu_km1_itr != nu_km1_end && ( nu_k_itr == nu_k_end || ( nu_km1_itr != nu_km1_end
112 && nu_k_itr->indice()+nu_k.offset() > nu_km1_itr->indice()+nu_km1.offset() ) ) )
115 const size_type i = nu_km1_itr->indice() + nu_km1.offset();
116 const bool is_indep = indep.in_range(i);
118 (*num_drops_indep)++;
123 << setw(w) << ( nu_km1_itr->value() >= 0.0 ?
"upper" :
"lower" )
124 << setw(w) << ( is_indep ?
"indep" :
"dep" )
125 << setw(w) <<
"dropped" << endl;
130 const size_type i = nu_k_itr->indice() + nu_k.offset();
131 const bool is_indep = indep.in_range(i);
132 if( nu_k_itr->value() * nu_km1_itr->value() < 0.0 ) {
136 (*num_drops_indep)++;
143 << setw(w) << ( nu_k_itr->value() >= 0.0 ?
"upper" :
"lower" )
144 << setw(w) << ( is_indep ?
"indep" :
"dep" )
145 << setw(w) <<
"switch bnd" << endl;
155 <<
"\n*** Active set change summary\n"
156 <<
"nact_old = " << nu_km1.nz() << endl
157 <<
"nact_new = " << nu_k.nz() << endl
158 <<
"num_adds = " << *num_adds << endl
159 <<
"num_drops = " << *num_drops << endl
160 <<
"nact_indep_old = " << nu_km1(indep).nz() << endl
161 <<
"nact_indep_new = " << *num_active_indep << endl
162 <<
"num_indep_adds = " << *num_adds_indep << endl
163 <<
"num_indep_drops = " << *num_drops_indep << endl;
AbstractLinAlgPack::size_type size_type
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec f_int f_int f_dbl_prec w[]
EJournalOutputLevel
enum for journal output.
void active_set_change(const SpVectorSlice &nu_k, const SpVectorSlice &nu_km1, Range1D indep, EJournalOutputLevel olevel, std::ostream *out, size_type *num_adds, size_type *num_drops, size_type *num_active_indep, size_type *num_adds_indep, size_type *num_drops_indep)
Calculate the change in the active set and output change if asked to.
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
RangePack::Range1D Range1D
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)