45 #include "MoochoPack_CalcDFromYPYZPZ_Step.hpp"
46 #include "MoochoPack_moocho_algo_conversion.hpp"
47 #include "IterationPack_print_algorithm_step.hpp"
49 #include "AbstractLinAlgPack_MatrixOpOut.hpp"
50 #include "AbstractLinAlgPack_VectorMutable.hpp"
51 #include "AbstractLinAlgPack_VectorStdOps.hpp"
52 #include "AbstractLinAlgPack_VectorOut.hpp"
53 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
54 #include "Teuchos_implicit_cast.hpp"
56 namespace LinAlgOpPack {
68 NLPAlgo &algo = rsqp_algo(_algo);
71 EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
72 EJournalOutputLevel ns_olevel = algo.algo_cntr().null_space_journal_output_level();
76 if( implicit_cast<int>(olevel) >= implicit_cast<int>(PRINT_ALGORITHM_STEPS) ) {
77 using IterationPack::print_algorithm_step;
78 print_algorithm_step( algo, step_poss, type, assoc_step_poss, out );
82 VectorMutable &d_k = s.d().set_k(0);
83 const Vector &Ypy_k = s.Ypy().get_k(0);
84 const Vector &Zpz_k = s.Zpz().get_k(0);
85 V_VpV( &d_k, Ypy_k, Zpz_k );
88 var_dep = s.var_dep(),
89 var_indep = s.var_indep();
91 if( implicit_cast<int>(olevel) >= implicit_cast<int>(PRINT_ALGORITHM_STEPS) ) {
92 const value_type very_small = std::numeric_limits<value_type>::min();
94 <<
"\n(Ypy_k'*Zpz_k)/(||Ypy_k||2 * ||Zpz_k||2 + eps)\n"
95 <<
" = ("<<
dot(Ypy_k,Zpz_k)<<
")/("<<Ypy_k.norm_2()<<
" * "<<Zpz_k.norm_2()<<
" + "<<very_small<<
")\n"
96 <<
" = " <<
dot(Ypy_k,Zpz_k) / ( Ypy_k.norm_2() * Zpz_k.norm_2() + very_small ) <<
"\n";
104 if( implicit_cast<int>(olevel) >=
implicit_cast<
int>(PRINT_ALGORITHM_STEPS) ) {
105 out <<
"\n||d_k||inf = " << d_k.norm_inf();
107 out <<
"\n||d(var_dep)_k||inf = " << d_k.sub_view(var_dep)->norm_inf();
108 if( var_indep.size() )
109 out <<
"\n||d(var_indep)_k||inf = " << d_k.sub_view(var_indep)->norm_inf();
112 if( implicit_cast<int>(olevel) >= implicit_cast<int>(PRINT_VECTORS) ) {
113 out <<
"\nd_k = \n" << d_k;
115 out <<
"\nd(var_dep)_k = \n" << *d_k.sub_view(var_dep);
117 if( implicit_cast<int>(ns_olevel) >= implicit_cast<int>(PRINT_VECTORS) ) {
118 if( var_indep.size() )
119 out <<
"\nd(var_indep)_k = \n" << *d_k.sub_view(var_indep);
128 , std::ostream& out,
const std::string& L )
const
131 << L <<
"*** Calculates the search direction d from Ypy and Zpz\n"
132 << L <<
"d_k = Ypy_k + Zpz_k \n";
rSQP Algorithm control class.
void print_step(const Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
virtual std::ostream & journal_out() const
void V_VpV(VectorMutable *v_lhs, const V1 &V1_rhs1, const V2 &V2_rhs2)
Reduced space SQP state encapsulation interface.
TypeTo implicit_cast(const TypeFrom &t)
AlgorithmTracker & track()
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr