26#ifndef UTILS_ALGO_HNEWTON_dot_HH
27#define UTILS_ALGO_HNEWTON_dot_HH
80 template <
typename Real>
89 virtual Real
eval( Real x )
const = 0;
96 virtual Real
D( Real x )
const = 0;
99 #ifndef DOXYGEN_SHOULD_SKIP_THIS
100 template <
typename Real,
typename PFUN,
typename PFUN_D>
105 explicit AlgoHNewton_fun( PFUN f, PFUN_D Df ) : m_fun(f), m_fun_D(Df) {}
106 Real eval( Real x )
const override {
return m_fun(x); };
107 Real D ( Real x )
const override {
return m_fun_D(x); };
209 template <
typename Real>
215 bool m_converged{
false};
217 Real m_a{0}, m_fa{0};
218 Real m_b{0}, m_fb{0};
219 Real m_c{0}, m_fc{0};
220 Real m_d{0}, m_fd{0};
226 Integer m_max_iteration{200};
228 mutable Integer m_iteration_count{0};
229 mutable Integer m_fun_evaluation_count{0};
230 mutable Integer m_fun_D_evaluation_count{0};
232 Real evaluate ( Real x )
const { ++m_fun_evaluation_count;
return m_function->
eval(x); };
233 Real evaluate_D( Real x )
const { ++m_fun_D_evaluation_count;
return m_function->D(x); };
236 Real eval( Real
a, Real
b );
237 Real eval( Real
a, Real
b, Real amin, Real bmax );
239 void set_tolerance( Real tol );
241 Real p_zero2()
const;
242 Real invp_zero2()
const;
243 Real invp_zero3()
const;
261 return this->eval(
a,
b );
277 return this->eval(
a,
b, amin, bmax );
312 Real
a()
const {
return m_a; }
313 Real
b()
const {
return m_b; }
314 Real
fa()
const {
return m_fa; }
315 Real
fb()
const {
return m_fb; }
319 #ifndef UTILS_OS_WINDOWS
320 extern template class AlgoHNewton<float>;
321 extern template class AlgoHNewton<double>;
Abstract base class for defining mathematical functions used in the zero search algorithm.
Definition Utils_AlgoHNewton.hh:81
virtual Real eval(Real x) const =0
virtual Real D(Real x) const =0
Real b() const
Definition Utils_AlgoHNewton.hh:313
Integer num_fun_D_eval() const
Definition Utils_AlgoHNewton.hh:300
void set_max_iterations(Integer mit)
Definition Utils_AlgoHNewton.cc:49
Real eval(Real a, Real b, Real amin, Real bmax, AlgoHNewton_base_fun< Real > const *fun)
Definition Utils_AlgoHNewton.hh:275
Real fa() const
Definition Utils_AlgoHNewton.hh:314
Real tolerance() const
Definition Utils_AlgoHNewton.hh:305
Integer used_iter() const
Definition Utils_AlgoHNewton.hh:290
Real eval(Real a, Real b, AlgoHNewton_base_fun< Real > const *fun)
Definition Utils_AlgoHNewton.hh:259
Integer num_fun_eval() const
Definition Utils_AlgoHNewton.hh:295
bool converged() const
Definition Utils_AlgoHNewton.hh:310
Real fb() const
Definition Utils_AlgoHNewton.hh:315
Real a() const
Definition Utils_AlgoHNewton.hh:312
Definition SystemUtils.cc:39