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