Flow123d  jenkins-Flow123d-linux-release-multijob-282
interpolant.cc
Go to the documentation of this file.
1 #include "adaptivesimpson.hh"
2 #include "functors_impl.hh"
3 #include "interpolant_impl.hh"
4 
5 #include "system/xio.h"
6 //#include "system/sys_profiler.hh"
7 
8 #include <limits>
9 #include <iomanip>
10 
11 /********************************** InterpolantBase ******************************/
12 const unsigned int InterpolantBase::n_derivatives = 10;
13 const unsigned int InterpolantBase::default_max_size = 10*1000;
14 const double InterpolantBase::simpson_tolerance = 1e-10;
15 
17  : bound_a_(0),
18  bound_b_(0),
19  max_size(default_max_size),
20  automatic_size(false),
21  norm_type(ErrorNorm::max),
22  error_(-1.0),
23  extrapolation(Extrapolation::functor)
24  //use_statistics(true)
25 {
26  reset_stat();
27  checks.resize(4,false);
28 }
29 
31 {}
32 
33 
34 void InterpolantBase::set_interval(double bound_a, double bound_b)
35 {
36  ASSERT(bound_a != bound_b,"Bounds overlap.");
37  ASSERT(bound_a < bound_b,"a must be lower and b must be upper bound.");
38  this->bound_a_ = bound_a;
39  checks[Check::bound_a] = true;
40  this->bound_b_ = bound_b;
41  checks[Check::bound_b] = true;
42 
43  //used to be use to collect the minimum and maximum "x" through all the evaluations (not only outside interval)
44  //are given oposite to be able to response to all calls
45  //stats.min = std::numeric_limits<double>::max();
46  //stats.max = -std::numeric_limits<double>::max();
47  stats.min = bound_a;
48  stats.max = bound_b;
49 }
50 
51 void InterpolantBase::set_size(unsigned int size)
52 {
53  ASSERT(size >0, "Size of interpolation table must be positive number!.");
54  this->size_ = size;
55  checks[Check::size] = true;
56 
57  automatic_size = false;
58 }
59 
60 void InterpolantBase::set_norm(ErrorNorm::Type norm_type, double p)
61 {
62  this->norm_type = norm_type;
63  this->p = p;
64 }
65 
66 
67 void InterpolantBase::set_size_automatic(double user_tol, unsigned int init_size, unsigned int max_size)
68 {
69  ASSERT(init_size >0, "Maximal size of interpolation table must be positive number!.");
70  ASSERT(max_size >= init_size, "Maximal size of interpolation table is smaller than initial size.");
71  this->user_tol = user_tol;
72  this->max_size = max_size;
73  size_ = init_size;
74  automatic_size = true;
75 
76  checks[Check::size] = true;
77 }
78 
80 {
81  this->extrapolation = extrapolation;
82 }
83 
85 {
88  stats.total_calls = 0;
89  //stats.min = std::numeric_limits<double>::max();
90  //stats.max = -std::numeric_limits<double>::max();
91  stats.min = bound_a_;
92  stats.max = bound_b_;
93  //switch statistics on
94  //use_statistics = true;
95 }
96 
98 {
99  //DBGMSG("Check and reinterpolate.\n");
100  bool reinterpolate = false; //should we remake interpolation?
101  if((double)stats.interval_miss_a/stats.total_calls > percentage)
102  {
103  //DBGMSG("Check and reinterpolate.\n");
104  bound_a_ = stats.min;
105  reinterpolate = true;
106  }
107  if((double)stats.interval_miss_b/stats.total_calls > percentage)
108  {
109  //DBGMSG("Check and reinterpolate.\n");
110  bound_b_ = stats.max;
111  reinterpolate = true;
112  }
113 
114  if(reinterpolate)
115  {
116  xprintf(Msg, "Interpolation: Reinterpolating...\n");
117  interpolate();
118  reset_stat();
119  }
120 }
121 
122 
124 {
125  ASSERT(checks[Check::functor], "Functor is not set.");
126  ASSERT(checks[Check::bound_a], "Left boundary of the interval is not set.");
127  ASSERT(checks[Check::bound_b], "Right boundary of the interval is not set.");
128  ASSERT(checks[Check::size], "Step is not set.");
129  ASSERT(! ((user_tol == 0) && automatic_size), "Tolerance for automatic interpolation is not set.");
130 }
131 
133 {
134  if (n > 1)
135  return n*fact(n-1);
136  else
137  return 1;
138 }
139 
140 /********************************** Interpolant ********************************/
141 
143  : InterpolantBase(),
144  func(NULL),
145  func_diff(NULL),
146  func_diffn(NULL),
147  interpolate_derivative(false)
148  {
149  }
150 
152 {
153  if(func_diff) delete func_diff;
154  if(func_diffn) delete func_diffn;
155 }
156 
157 
158 double Interpolant::f_diffn(double x,unsigned int n)
159 {
160  ASSERT(n <= n_derivatives,"Not allowed to obtain higher than n-th derivate.");
161  T<double> xx,f;
162 
163  xx = x;
164  xx[1] = 1;
165  f = func_diffn->operator()(xx);
166  f.eval(n_derivatives);
167 
168  for(unsigned int i = 0; i<n_derivatives; i++) //goes through the field of Taylor's coeficients
169  { //and divide them by the factorial to get derivates
170  f[i] = f[i] * this->fact(i);
171  }
172 
173  return f[n]; //returns n-th derivate
174 }
175 
177 {
178  check_all(); //checks if all needed parameters were set
179  unsigned int result = 10;
180 
181  //switch off statistics due to error computation
182  //is switched on automatically by reset_stat()
183  //use_statistics = false;
184 
185  //POSSIBLE WAY TO USE MORE KINDS OF INTERPOLATION
186  //selecting the interpolation
187  /*
188  void (Interpolant::*interpolate_func)(void);
189  switch(degree)
190  {
191  case 0: interpolate_func = &Interpolant::interpolate_p0; break;
192  case 1: interpolate_func = &Interpolant::interpolate_p1; break;
193  default: ASSERT(degree > 1, "Higher order interpolation is not available at the moment.");
194  }
195  */
196 
197  //temporary vectors for values in the middle of intervals
198  std::vector<double> f_vec_half;
199  std::vector<double> df_vec_half;
200 
201  double tol = 1e-10; //error computation zero tolerance
202 
203  if(automatic_size)
204  {
205  int k = -1;
206  while(1)
207  {
208  k++;
209  //DBGMSG("k = %d\n",k);
210  compute_values(); //computes function (and possibly derivate) values at nodes
211 
213  compute_error(tol, f_vec_half, df_vec_half);
214  else
215  compute_error(tol, p, norm_type);
216 
217  DBGMSG("error: %E\n", error_);
218 
219  //error comparation
220  if(user_tol < error_)
221  {
222  DBGMSG("Interpolating: %d size: %d \t error: %E\n",k, size_, error_);
223  result = 1; //tolerance has not been satisfied
224  }
225  else
226  {
227  xprintf(Msg,"Interpolation: Size of the table set automaticaly to: %d after %d cycles.\n", size_,k);
228  //DBGMSG("Interpolation error estimate is: %f\n", error_);
229  result = 0; //interpolation OK
230  break;
231  }
232 
233  //size comparation
234  if(size_ < max_size/2)
235  {
236  if(norm_type == ErrorNorm::max) // if we compute the maximum norm, we can use the computed values
237  swap_middle_values(f_vec_half, df_vec_half);
238  else //else resize and compute new nodes
239  {
240  size_ *= 2;
241  compute_values(); //computes function (and possibly derivate) values at nodes
242  }
243  }
244  else
245  {
246  xprintf(Warn,"Interpolation: User defined tolerance %E has not been satisfied with size of interpolation table %d.\n",user_tol,size_);
247  break;
248  }
249  }
250  }
251  else
252  {
253  compute_values(); //computes function (and possibly derivate) values at nodes
254 
256  compute_error(tol, f_vec_half, df_vec_half);
257  else
258  compute_error(tol, p, norm_type);
259 
260  result = 0; //interpolation OK
261  }
262  xprintf(Msg,"Interpolation: Interpolation error estimate is: %E.\n", error_);
263  reset_stat();
264  return result;
265 }
266 
267 /*
268  // CONSTANT INTERPOLATION
269  void Interpolant::interpolate_p0()
270  {
271  create_nodes();
272 
273  Functor<double>* norm = new NormW21(this);
274  compute_error(norm); //sets error_
275  delete norm;
276  }
277 
278  // LINEAR INTERPOLATION WITH SAVED COEFICIENTS
279  void Interpolant::interpolate_p1()
280  {
281  p1_vec.resize(size_); //linear coeficients
282 
283  if(interpolate_derivative)
284  {
285  double delta = 0;
286  p1d_vec.resize(size_); //linear coeficients for derivative
287  for(unsigned int i = 0; i != p1_vec.size(); i++)
288  {
289  delta = x_vec[i+1] - x_vec[i];
290  p1_vec[i] = (f_vec[i+1] - f_vec[i]) / delta;
291  p1d_vec[i] = (df_vec[i+1] - df_vec[i]) / delta;
292  }
293  }
294  else
295  {
296  for(unsigned int i = 0; i != p1_vec.size(); i++)
297  {
298  p1_vec[i] = (f_vec[i+1] - f_vec[i]) / (x_vec[i+1] - x_vec[i]);
299  }
300  }
301 
302  //Writes the interpolation table.
303 
304  unsigned int p = 10,
305  pp = 5;
306  for(unsigned int i=0; i != size_-1; i++)
307  {
308  std::cout << "x: " << setw(p) << x_vec[i] << setw(pp) << "f:" << setw(p) << f_vec[i] << setw(pp) << "p1:" << setw(p) << p1_vec[i];
309  if(interpolate_derivative)
310  std::cout << setw(pp) << "df:" << setw(p) << df_vec[i] << setw(pp) << "p1d:" << setw(p) << p1d_vec[i] << std::endl;
311  else
312  std::cout << std::endl;
313  }
314  std::cout << "x: " << setw(p) << x_vec[x_vec.size()-1] << setw(pp) << "f:" << setw(p) << f_vec[f_vec.size()-1] << setw(pp) << "p1:" << setw(p) << "-";
315  if(interpolate_derivative)
316  std::cout << setw(pp) << "df:" << setw(p) << df_vec[df_vec.size()-1] << setw(pp) << "p1d:" << setw(p) << "-" << std::endl;
317  else
318  std::cout << std::endl;
319  }
320 //*/
321 
323 {
324  //setting the step - length of piecewise interpolation intervals
327  n_nodes = size_ + 1; //setting the number of nodes
328 
329  f_vec.resize(n_nodes); //function values in the nodes
330 
331  double temp_x = bound_a_;
333  {
334  df_vec.resize(n_nodes); //function derivates values in the nodes
335  //filling the vector x and f
336  DiffValue value;
337  for(unsigned int i = 0; i < size_; i++)
338  {
339  //DBGMSG("size: %d \tfill vectors: %d\n",size_,i);
340  temp_x = bound_a_ + step*i;
341  value = f_diff(temp_x);
342  f_vec[i] = value.first;
343  df_vec[i] = value.second;
344  }
345  //finish the interval
346  value = f_diff(bound_b_);
347  f_vec[size_] = value.first;
348  df_vec[size_] = value.second;
349  }
350  else
351  {
352  //filling the vector x and f
353  for(unsigned int i = 0; i < size_; i++)
354  {
355  temp_x = bound_a_ + step*i;
356  f_vec[i] = f_val(temp_x);
357  }
358  //finish the interval
360  }
361 }
362 
364 {
365  double new_size = 2*size_;
366  n_nodes = new_size+1;
367  step = (bound_b_-bound_a_)/new_size; //which should be equal also step/2
369 
370  //we will use now the middle points computed in "compute_error" to construct vector of nodes
371  std::vector<double> swap_f_vec;
372  std::vector<double> swap_df_vec;
373  swap_f_vec.reserve(n_nodes);
374 
375  for(unsigned int i=0; i!=size_; i++)
376  {
377  swap_f_vec.push_back(f_vec[i]);
378  swap_f_vec.push_back(f[i]);
379  }
380  swap_f_vec.push_back(f_vec.back());
381  f_vec = swap_f_vec;
382 
384  {
385  swap_df_vec.reserve(n_nodes);
386  for(unsigned int i=0; i!=size_; i++)
387  {
388  swap_df_vec.push_back(df_vec[i]);
389  swap_df_vec.push_back(df[i]);
390  }
391  swap_df_vec.push_back(df_vec.back());
392  df_vec = swap_df_vec;
393  }
394  size_ = new_size;
395 }
396 
397 
399 {
400  double tot_err = 0;
401 
402  f.clear();
403  f.reserve(size_); //function values in the middle nodes
404 
405  double temp_a = bound_a_ + step/2;
406  double temp_x = temp_a;
408  {
409  df.clear();
410  df.reserve(size_); //function derivates values in the middle nodes
411  //filling the vector x and f
412  DiffValue value;
413  DiffValue int_value;
414  for(unsigned int i = 0; i != size_; i++)
415  {
416  //DBGMSG("size: %d \tfill vectors: %d\n",size_,i);
417  temp_x = temp_a + step*i;
418  value = f_diff(temp_x);
419  f.push_back(value.first);
420  df.push_back(value.second);
421 
422  int_value = diff_p1(temp_x); //we can call directly the interpolant evaluation, because we know we are in the interval
423  //double t = std::abs(value.second - int_value.second) / (std::abs(value.second) + tol);
424  tot_err = std::max( tot_err,
425  std::abs(value.first - int_value.first) / (std::abs(value.first) + tol)
426  + std::abs(value.second - int_value.second) / (std::abs(value.second) + tol)
427  );
428  //DBGMSG("x,f,if: \t%f: %f: %f\n",temp_x, value.first, int_value.first);
429  //DBGMSG("temporary tot_error: %f: %f: %f\n",temp_x,tot_err,t);
430  }
431  }
432  else
433  {
434  //filling the vector x and f
435  for(unsigned int i = 0; i != size_; i++)
436  {
437  temp_x = temp_a + step*i;
438  f.push_back(f_val(temp_x));
439  tot_err = std::max( tot_err,
440  std::abs(f.back() - val_p1(temp_x)) / (std::abs(f.back()) + tol)
441  );
442  }
443  }
444 
445  error_ = tot_err;
446 
447  /* PRIORITY QUEUE FOR ADAPTIVE INTERVAL DIVIDING
448  for(unsigned long i = 0; i < g->get_count(); i++ )
449  {
450  LP_Norm norm(f,g->get_polynomial(i),2);
451  p_err.i = i;
452 
453  //absolute polynomial error
454  p_err.err = sqrt(Interpolation::AdaptiveSimpson::AdaptSimpson( norm,
455  g->get_polynomial(i)->get_a(),
456  g->get_polynomial(i)->get_b(),
457  SIMPSON_TOLERANCE) );
458 
459  //increase the absolute total error
460  tot_err += p_err.err;
461 
462  //writes absolute error on a single polynomial
463  if(DEB) std::cout << "\t abs. p_err=" << p_err.err;
464 
465  //p_err convertion absolute -> relative (p_err/(xi+1 - xi))
466  p_err.err /= (g->get_polynomial(i)->get_b()-g->get_polynomial(i)->get_a());
467 
468  //writes relative error on a single polynomial
469  if(DEB) std::cout << "\t rel. p_err=" << p_err.err << std::endl;
470 
471  pq.push(p_err); //puts in priority queue
472  }
473 
474  // writes relative and absolute total error
475  //std::cout << "\trelative err = "
476  // << tot_err/(g->GetA()-g->GetB())
477  // << "\tabsolute err = " << tot_err << std::endl;
478  //*/
479 }
480 
481 void Interpolant::compute_error(double tol, double p, ErrorNorm::Type norm_type)
482 {
483  double exponent = 2; //default exponent
484  FunctorBase<double>* norm;
485 
486  switch(norm_type)
487  {
488  case ErrorNorm::w21:
489  norm = new FuncError_wp1(this, 2, tol);
490  break;
491  case ErrorNorm::wp1:
492  norm = new FuncError_wp1(this, p, tol);
493  exponent = p;
494  break;
495  case ErrorNorm::lp:
496  norm = new FuncError_lp(this, p, tol);
497  exponent = p;
498  break;
499  case ErrorNorm::l2:
500  default:
501  norm = new FuncError_lp(this, 2, tol);
502  }
503 
504 
505  double tot_err = 0, // total absolute error on <a,b>
506  p_err = 0; // absolute error on x[i]-x[i+1]
507  double x_node;
508 
509  for(unsigned long i = 0; i < size_; i++ )
510  {
511  x_node = bound_a_ + i*step;
512  p_err = std::abs( AdaptiveSimpson::AdaptSimpson(*norm,
513  x_node,
514  x_node+step,
516 
517  //DBGMSG("error on interval<%f,%f>: %f\n",x_vec[i],x_vec[i+1],p_err);
518  tot_err += p_err;
519  }
520  //DBGMSG("tot_err = %f\n",tot_err);
521  tot_err /= (bound_b_ - bound_a_); //relative to the interval length
522  tot_err = std::pow(tot_err, 1.0/exponent); //p-th root
523  error_ = tot_err;
524 }
525 
526 
527 
528 /********************************** InterpolantImplicit ********************************/
529 
531  : InterpolantBase(),
532  func_u(NULL),
533  func(NULL),
534  func_diff(NULL),
535  func_diffn(NULL),
536  interpolate_derivative(false),
537  explicit_interpolant(NULL),
538  fix_(IFixVariable::no_fix)
539  {
540  }
541 
543 {
545  if(func_diff) delete func_diff;
546  if(func_diffn) delete func_diffn;
547  if(func_u) delete func_u;
548 }
549 
551 {
552  fix_ = fix;
553  fix_val = val;
555 }
556 
558 {
559  return func_u->operator()(u);
560 }
561 
562 
564 {
565  //BUG: FuncExplicit cannot be copied in interpolant constructor with its members !!!
566  /*
567  ASSERT(fix_ != IFixVariable::no_fix,"Cannot do interpolation. No varible was fixed.");
568  check_all();
569  DBGMSG("seg %f\n",func_u);
570  explicit_interpolant = new Interpolant(func_u, interpolate_derivative);
571  //explicit_interpolant->set_functor(func_u, interpolate_derivative);
572  DBGMSG("seg\n");
573  explicit_interpolant->set_interval(bound_a_,bound_b_);
574  DBGMSG("seg\n");
575  if(automatic_size)
576  {
577  explicit_interpolant->set_size_automatic(user_tol, size_, max_size);
578  }
579  else
580  {
581  explicit_interpolant->set_size(size_);
582  }
583 
584  DBGMSG("seg\n");
585  explicit_interpolant->interpolate();
586  DBGMSG("seg\n");
587  error_ = explicit_interpolant->error();
588  */
589  return 0;
590 }
591 
593 {
594  if(func_u != NULL)
595  delete func_u;
596 
598 }
599 
600 
FunctorBase< B< double > > * func_diff
Pointer to original functor with FADBAD B type.
Definition: interpolant.hh:361
bool automatic_size
Is true if step/size should be chosen automatically.
Definition: interpolant.hh:155
ErrorNorm::Type norm_type
Type of norm used to compute error of the interpolation.
Definition: interpolant.hh:156
#define DBGMSG(...)
Definition: global_defs.h:196
double bound_b() const
Returns right boundary of the interval.
void compute_values()
Creates table of nodes and function values.
Definition: interpolant.cc:322
double a_div_step
bound_ divided by step - precomputed value for evaluation
Definition: interpolant.hh:145
Lp norm.
Definition: interpolant.hh:31
double f_diffn(double x, unsigned int n)
Definition: interpolant.cc:158
static const double simpson_tolerance
Tolerance in Adaptive Simpson intergration.
Definition: interpolant.hh:169
Definition: system.hh:72
unsigned int n_nodes
Number of nodes in the interval .
Definition: interpolant.hh:150
static const unsigned int default_max_size
Default maximal size of the interpolation table.
Definition: interpolant.hh:168
unsigned int interval_miss_b
counts right misses of the interval
Definition: interpolant.hh:123
InterpolantImplicit()
constructor
Definition: interpolant.cc:530
void check_stats_and_reinterpolate(double percentage=0.3)
Can be called to check automatically the evaluation statistics and possibly reinterpolate.
Definition: interpolant.cc:97
void set_interval(double bound_a, double bound_b)
Sets the interpolation interval boundaries.
Definition: interpolant.cc:34
virtual ~InterpolantBase()
Destructor.
Definition: interpolant.cc:30
void fix_variable(IFixVariable::Type fix, double value)
Definition: interpolant.cc:550
unsigned int total_calls
counts total calls of evaluation
Definition: interpolant.hh:123
double user_tol
User set tolerance which is used during automatic step choice.
Definition: interpolant.hh:153
InterpolantBase()
Default constructor.
Definition: interpolant.cc:16
std::vector< double > df_vec
Vector of function derivatives values at nodes.
Definition: interpolant.hh:368
FunctorBase< T< double > > * func_diffn
Pointer to original functor with FADBAD T type.
Definition: interpolant.hh:362
std::pair< double, double > DiffValue
Definition: interpolant.hh:13
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
void compute_error(double tol, std::vector< double > &f, std::vector< double > &df)
Creates piecewise linear interpolation.
Definition: interpolant.cc:398
double f_val(double x)
Returns value of the original functor.
Base class for interpolation.
Definition: interpolant.hh:56
std::vector< double > f_vec
Vector of function values at nodes.
Definition: interpolant.hh:367
double error_
Error of the interpolation.
Definition: interpolant.hh:159
virtual int interpolate()=0
Creates piecewise polynomial interpolation.
unsigned int size() const
Returns the size of the interpolation table.
IFunctorBase< B< double > > * func_diff
Definition: interpolant.hh:504
Interpolant * explicit_interpolant
Definition: interpolant.hh:509
double max
maximal x for which the evaluation was called outside the interval ((initially is equal the right bou...
Definition: interpolant.hh:127
virtual ~InterpolantImplicit(void)
destructor
Definition: interpolant.cc:542
DiffValue diff_p1(double x)
Finds interval on which x lies.
Wp1 norm.
Definition: interpolant.hh:33
long fact(long x)
Recursive factorial function (used in Taylor row expansion in n-th derivative computation).
Definition: interpolant.cc:132
void set_size_automatic(double user_tol, unsigned int init_size, unsigned int max_size=default_max_size)
Sets automatic choice of the size of the table.
Definition: interpolant.cc:67
double val_p1(double x)
Do NOT use, unless you are 100% sure.
#define ASSERT(...)
Definition: global_defs.h:121
Definition: system.hh:72
unsigned int max_size
Maximal size of the interpolation table.
Definition: interpolant.hh:154
W21 norm.
Definition: interpolant.hh:32
#define xprintf(...)
Definition: system.hh:100
double step
Chosen interpolation step.
Definition: interpolant.hh:145
IFixVariable::Type fix_
Definition: interpolant.hh:511
void set_size(unsigned int size)
Sets size of the interpolation table. It is also equal to the number of intervals.
Definition: interpolant.cc:51
void set_norm(ErrorNorm::Type norm_type=ErrorNorm::max, double p=2)
Sets the type of norm used for computing estimate of the error of the interpolation.
Definition: interpolant.cc:60
double f_val(double x, double y)
Returns interpolated value of the derivation.
std::vector< bool > checks
Vector of boolean values telling us which parameters are set or not.
Definition: interpolant.hh:184
EvalStatistics stats
Structure which keeps evaluation statistics. See InterpolantBase::eval_statistics.
Definition: interpolant.hh:192
Extrapolation::Type extrapolation
Definition: interpolant.hh:164
void interpolate_p1()
Creates piecewise linear interpolation.
Definition: interpolant.cc:592
void set_extrapolation(Extrapolation::Type extrapolation)
Sets the type of extrapolation. Functor type is default.
Definition: interpolant.cc:79
IFunctorBase< T< double > > * func_diffn
Definition: interpolant.hh:505
virtual int interpolate()
Creates piecewise interpolation with polynomials of selected degree.
Definition: interpolant.cc:563
static double AdaptSimpson(FunctorBase< double > &func, const double &a, const double &b, const double &tol)
main method that starts the evaluation and calls the recursion
virtual int interpolate()
Creates piecewise interpolation with polynomials of selected degree.
Definition: interpolant.cc:176
double bound_a() const
Returns left boundary of the interval.
L2 norm.
Definition: interpolant.hh:30
IFunctorBase< double > * func
Definition: interpolant.hh:503
double bound_a_
Left interval boundary.
Definition: interpolant.hh:145
unsigned int interval_miss_a
counts left misses of the interval
Definition: interpolant.hh:123
double val(double u)
Returns interpolated value.
FuncExplicit< double > * func_u
Definition: interpolant.hh:500
bool interpolate_derivative
Is true if we want to interpolate the derivative too.
Definition: interpolant.hh:364
DiffValue f_diff(double x)
Returns 1st derivative of original functor using FADBAD.
double bound_b_
Right interval boundary.
Definition: interpolant.hh:145
void check_all()
Checks that the parameters are set before interpolation.
Definition: interpolant.cc:123
static const unsigned int n_derivatives
Defines how many derivatives we allow to be returned from Taylor&#39;s coeficients.
Definition: interpolant.hh:167
Interpolant()
Default constructor.
Definition: interpolant.cc:142
double p
Exponent used in norms and when computing error.
Definition: interpolant.hh:157
double min
minimal x for which the evaluation was called outside the interval (initially is equal the left bound...
Definition: interpolant.hh:127
virtual ~Interpolant(void)
Destructor.
Definition: interpolant.cc:151
void swap_middle_values(std::vector< double > &f, std::vector< double > &df)
Definition: interpolant.cc:363
void reset_stat()
Resets all measured statistics.
Definition: interpolant.cc:84
Maximum norm.
Definition: interpolant.hh:34
unsigned int size_
Number of dividing intervals.
Definition: interpolant.hh:150