42 #include "ConstrainedOptPack_MeritFuncCalc1DQuadratic.hpp"
43 #include "ConstrainedOptPack_MeritFuncCalc.hpp"
44 #include "AbstractLinAlgPack_VectorMutable.hpp"
45 #include "AbstractLinAlgPack_VectorStdOps.hpp"
46 #include "Teuchos_Assert.hpp"
48 namespace ConstrainedOptPack {
50 MeritFuncCalc1DQuadratic::MeritFuncCalc1DQuadratic(
56 : phi_(phi), p_(p), x_(x)
59 !(1 <= p && p <= 2 ), std::invalid_argument
60 ,
"MeritFuncCalc1DQuadratic::MeritFuncCalc1DQuadratic(...) : Error! "
61 "p = " << p <<
" must be in the range 1 <= p <= 2"
71 value_type alpha_i = alpha;
72 for(
size_type i = 1; i <= p_; ++i, alpha_i *= alpha ) {
73 Vp_StV( x_, alpha_i, *d_[i] );
84 std::ostream& out,
const std::string& L
87 out << L <<
"*** MeritFuncCalc1DQuadratic\n"
88 << L <<
"x = xo + alpha*d[1] + alpha^2*d[2]\n";
value_type operator()(value_type alpha) const
Returns phi( x = sum( alpha^k * d[k], k = 0...p-1 ) ).
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
value_type deriv() const
Returns phi.deriv()
void print_merit_func(std::ostream &out, const std::string &leading_str) const
Calls phi->print_merit_func().
Abstract iterface for n-D merit functions {abstract}.
const Vector * const_VectorWithOp_ptr
virtual value_type deriv() const =0
Calls value(d_k) on aggregate merit_func.
virtual void print_merit_func(std::ostream &out, const std::string &leading_str) const =0
Print what this merit function is.