18 #ifndef INTERPOLATION_H 19 #define INTERPOLATION_H 35 typedef std::pair<double,double>
DiffValue;
96 double bound_a()
const;
97 double bound_b()
const;
98 unsigned int size()
const;
104 void set_interval(
double bound_a,
double bound_b);
109 void set_size(
unsigned int size);
124 void set_size_automatic(
double user_tol,
unsigned int init_size,
unsigned int max_size=default_max_size);
136 virtual int interpolate() = 0;
145 unsigned int interval_miss_a,
163 void check_stats_and_reinterpolate(
double percentage=0.3);
304 template<
template<
class>
class Func,
class Type >
305 Interpolant(Func<Type>* func,
bool interpolate_derivative=
false);
308 virtual ~Interpolant(
void);
315 double val(
double x);
321 double val_test(
double x);
336 double val_p1(
double x);
346 double f_val(
double x);
358 double f_diffn(
double x,
unsigned int n);
365 virtual int interpolate();
374 template<
template<
class>
class Func,
class Type >
375 void set_functor(Func<Type>* func,
bool interpolate_derivative=
false);
412 void compute_values();
442 template<
template<
class>
class Func,
class Type >
446 virtual ~InterpolantImplicit(
void);
454 template<
template<
class>
class Func,
class Type >
455 void set_functor(Func<Type>* func,
bool interpolate_derivative=
false);
471 double val(
double u);
487 double f_val(
double x,
double y);
492 double f_val(
double u);
505 double f_diffn(
double u,
unsigned int n);
513 virtual int interpolate();
521 template<
class Type=
double>
540 void interpolate_p1();
FunctorBase< B< double > > * func_diff
Pointer to original functor with FADBAD B type.
bool automatic_size
Is true if step/size should be chosen automatically.
ErrorNorm::Type norm_type
Type of norm used to compute error of the interpolation.
static const double simpson_tolerance
Tolerance in Adaptive Simpson intergration.
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
static const unsigned int default_max_size
Default maximal size of the interpolation table.
Abstract templated implicit functor class.
unsigned int total_calls
counts total calls of evaluation
double user_tol
User set tolerance which is used during automatic step choice.
std::vector< double > df_vec
Vector of function derivatives values at nodes.
FunctorBase< T< double > > * func_diffn
Pointer to original functor with FADBAD T type.
std::pair< double, double > DiffValue
Base class for interpolation.
std::vector< double > f_vec
Vector of function values at nodes.
double error_
Error of the interpolation.
static constexpr bool value
IFunctorBase< B< double > > * func_diff
Interpolant * explicit_interpolant
Structure that keeps statistics of evaluation.
unsigned int max_size
Maximal size of the interpolation table.
Abstract templated explicit functor class.
FunctorBase< double > * func
Pointer to original functor with double type.
double step
Chosen interpolation step.
std::vector< bool > checks
Vector of boolean values telling us which parameters are set or not.
EvalStatistics stats
Structure which keeps evaluation statistics. See InterpolantBase::eval_statistics.
Extrapolation::Type extrapolation
The main class for interpolation of functors.
IFunctorBase< T< double > > * func_diffn
IFunctorBase< double > * func
FuncExplicit< double > * func_u
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
static const unsigned int n_derivatives
Defines how many derivatives we allow to be returned from Taylor's coeficients.
y variable will be fixed with given value
double p
Exponent used in norms and when computing error.
double min
minimal x for which the evaluation was called outside the interval (initially is equal the left bound...
unsigned int size_
Number of dividing intervals.