18 #ifndef INTERPOLANT_IMPL_H
19 #define INTERPOLANT_IMPL_H
55 template<
template<
class>
class Func,
class Type >
58 interpolate_derivative(interpolate_derivative)
70 template<
template<
class>
class Func,
class Type >
210 return func->operator()(x);
274 double x_step = x /
step;
288 double x_step = x /
step;
307 inline double p() {
return p_;}
315 return std::pow(a,
p_);
333 inline double p() {
return p_;}
340 double a = std::abs(f.first - g.first) / (std::abs(f.first) +
tol_)
341 + std::abs(f.second - g.second) / (std::abs(f.second) +
tol_);
343 return std::pow(a,
p_);
356 template<
template<
class>
class Func,
class Type >
371 template<
template<
class>
class Func,
class Type >
374 interpolate_derivative(interpolate_derivative),
375 explicit_interpolant(NULL),
399 template<
class TType>
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
Abstract templated explicit functor class.
void set_param_from_func(FunctorCommon< TType > *func)
Sets a functor's parameters from another functor.
Abstract templated implicit functor class.
unsigned int size() const
Returns the size of the interpolation table.
double bound_a() const
Returns left boundary of the interval.
double bound_b_
Right interval boundary.
double bound_b() const
Returns right boundary of the interval.
double step
Chosen interpolation step.
std::vector< bool > checks
Vector of boolean values telling us which parameters are set or not.
EvalStatistics statistics() const
Returns structure with evaluation statistics.
double error_
Error of the interpolation.
double error()
Returns error of the interpolation.
Extrapolation::Type extrapolation
double bound_a_
Left interval boundary.
unsigned int size_
Number of dividing intervals.
double a_div_step
bound_ divided by step - precomputed value for evaluation
EvalStatistics stats
Structure which keeps evaluation statistics. See InterpolantBase::eval_statistics.
IFunctorBase< Type > * func_impl
FuncExplicit(IFunctorBase< TType > &func_impl, IFixVariable::Type fix, double fix_val)
Type operator()(Type u)
Virtual operator () with type Type.
FuncExplicit()
Constructor.
DiffValue diff(double u)
Returns interpolated value of the derivation.
IFunctorBase< B< double > > * func_diff
InterpolantImplicit()
constructor
Interpolant * explicit_interpolant
IFunctorBase< double > * func
IFunctorBase< T< double > > * func_diffn
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
double val(double u)
Returns interpolated value.
void set_functor(Func< Type > *func, bool interpolate_derivative=false)
Sets the implicit functor.
virtual double operator()(double x)
Virtual operator () with type Type.
Interpolant * interpolant
FuncError_lp(Interpolant *interpolant, double p, double tol)
FuncError_wp1(Interpolant *interpolant, double p, double tol)
virtual double operator()(double x)
Virtual operator () with type Type.
Interpolant * interpolant
The main class for interpolation of functors.
FunctorBase< T< double > > * func_diffn
Pointer to original functor with FADBAD T type.
std::vector< double > f_vec
Vector of function values at nodes.
FunctorBase< B< double > > * func_diff
Pointer to original functor with FADBAD B type.
DiffValue diff_p1(double x)
Finds interval on which x lies.
double f_val(double x)
Returns value of the original functor.
double val_test(double x)
Do NOT use, only for testing purpose.
std::vector< double > df_vec
Vector of function derivatives values at nodes.
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
double val(double x)
Returns interpolated value.
double val_p1(double x)
Do NOT use, unless you are 100% sure.
Interpolant()
Default constructor.
DiffValue f_diff(double x)
Returns 1st derivative of original functor using FADBAD.
DiffValue diff(double x)
Returns interpolated value of the derivation.
FunctorBase< double > * func
Pointer to original functor with double type.
void set_functor(Func< Type > *func, bool interpolate_derivative=false)
Sets the functor.
std::pair< double, double > DiffValue
@ fix_x
x variable will be fixed with given value
@ fix_y
y variable will be fixed with given value
@ no_fix
no variable is fixed (used when InterpolantImplicit is created)
Structure that keeps statistics of evaluation.
double max
maximal x for which the evaluation was called outside the interval ((initially is equal the right bou...
unsigned int interval_miss_a
counts left misses of the interval
unsigned int interval_miss_b
counts right misses of the interval
unsigned int total_calls
counts total calls of evaluation
double min
minimal x for which the evaluation was called outside the interval (initially is equal the left bound...