All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
inte_qawo_gsl.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, Jerry Gagelman
5  and Andrew W. Steiner
6 
7  This file is part of O2scl.
8 
9  O2scl is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13 
14  O2scl is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
21 
22  -------------------------------------------------------------------
23 */
24 #ifndef O2SCL_GSL_INTE_QAWO_H
25 #define O2SCL_GSL_INTE_QAWO_H
26 
27 /** \file inte_qawo_gsl.h
28  \brief File defining \ref o2scl::inte_qawo_gsl_sin and
29  \ref o2scl::inte_qawo_gsl_cos
30 */
31 
32 #include <o2scl/inte.h>
33 #include <o2scl/inte_qawc_gsl.h>
34 
35 #ifndef DOXYGEN_NO_O2NS
36 namespace o2scl {
37 #endif
38 
39  /** \brief Adaptive integration for oscillatory integrals (GSL)
40 
41  The integral
42  \f[
43  \int_a^b f(x) \sin (\omega x)~dx
44  \f]
45  is computed for some frequency parameter \f$ \omega \f$,
46  stored in \ref inte_qawo_gsl_sin::omega .
47 
48  An adaptive algorithm together with an series-acceleration
49  method like that of \ref inte_qags_gsl is used. Those
50  subintervals with "large" widths \f$ d \equiv b-a \f$ where \f$
51  d\omega > 4 \f$ are computed using a 25-point Clenshaw-Curtis
52  integration rule to handle the oscillatory behavior. In order to
53  work efficiently, the Chebyshev moments for the particular
54  weight function \f$ W \f$ are computed in advance.
55 
56  See \ref gslinte_subsect in the User's guide for general
57  information about the GSL integration classes.
58  */
59  template<class func_t> class inte_qawo_gsl_sin :
60  public inte_cheb_gsl<func_t> {
61 
62  public:
63 
65  n_levels=10;
66  omega=1.0;
67  }
68 
69  virtual ~inte_qawo_gsl_sin() {}
70 
71  /// The user-specified frequency (default 1.0)
72  double omega;
73 
74  /// The number of bisection levels (default 10)
75  size_t n_levels;
76 
77  /** \brief Integrate function \c func from \c a to \c b and place
78  the result in \c res and the error in \c err
79  */
80  virtual int integ_err(func_t &func, double a, double b,
81  double &res, double &err) {
82 
83  otable=gsl_integration_qawo_table_alloc
84  (omega,b-a,GSL_INTEG_SINE,n_levels);
85 
86  int status=qawo(func,a,this->tol_abs,this->tol_rel,
87  this->w,this->otable,&res,&err);
88 
89  gsl_integration_qawo_table_free(otable);
90 
91  return status;
92  }
93 
94 #ifndef DOXYGEN_INTERNAL
95 
96  protected:
97 
98  /// The integration workspace
99  gsl_integration_qawo_table *otable;
100 
101  /** \brief The full GSL integration routine called by integ_err()
102 
103  \future Remove goto statements.
104  */
105  int qawo(func_t &func, const double a, const double epsabs,
106  const double epsrel, inte_workspace_gsl *loc_w,
107  gsl_integration_qawo_table *wf, double *result, double *abserr) {
108 
109  double area, errsum;
110  double res_ext, err_ext;
111  double result0=0.0, abserr0=0.0, resabs0=0.0, resasc0=0.0;
112  double tolerance;
113 
114  double ertest = 0;
115  double error_over_large_intervals = 0;
116  double reseps = 0, abseps = 0, correc = 0;
117  size_t ktmin = 0;
118  int roundoff_type1 = 0, roundoff_type2 = 0, roundoff_type3 = 0;
119  int error_type = 0, error_type2 = 0;
120 
121  size_t iteration = 0;
122 
123  int positive_integrand = 0;
124  int extrapolate = 0;
125  int extall = 0;
126  int disallow_extrapolation = 0;
127 
129 
130  double b = a + wf->L ;
131  double abs_omega = fabs (wf->omega) ;
132 
133  /* Initialize results */
134 
135  loc_w->initialise(a,b);
136 
137  *result = 0;
138  *abserr = 0;
139 
140  size_t limit=this->w->limit;
141 
142  /* Test on accuracy */
143 
144  double dbl_eps=std::numeric_limits<double>::epsilon();
145 
146  if (epsabs <= 0 && (epsrel < 50 * dbl_eps || epsrel < 0.5e-28)) {
147  this->last_iter=0;
148  std::string estr="Tolerance cannot be achieved with given ";
149  estr+="value of tol_abs, "+dtos(epsabs)+", and tol_rel, "+
150  dtos(epsrel)+", in inte_qawo_gsl_sin::qawo().";
151  O2SCL_ERR(estr.c_str(),exc_ebadtol);
152  }
153 
154  /* Perform the first integration */
155 
156  this->qc25f(func, a, b, wf, 0,
157  &result0, &abserr0, &resabs0, &resasc0);
158 
159  loc_w->set_initial_result (result0, abserr0);
160 
161  tolerance = GSL_MAX_DBL (epsabs, epsrel * fabs (result0));
162 
163  if (this->verbose>0) {
164  std::cout << "inte_qawo_gsl Iter: " << 1;
165  std::cout.setf(std::ios::showpos);
166  std::cout << " Res: " << result0;
167  std::cout.unsetf(std::ios::showpos);
168  std::cout << " Err: " << abserr0
169  << " Tol: " << tolerance << std::endl;
170  if (this->verbose>1) {
171  char ch;
172  std::cout << "Press a key and type enter to continue. " ;
173  std::cin >> ch;
174  }
175  }
176 
177  if (abserr0 <= 100 * GSL_DBL_EPSILON * resabs0 &&
178  abserr0 > tolerance) {
179  *result = result0;
180  *abserr = abserr0;
181 
182  this->last_iter=1;
183  std::string estr="Cannot reach tolerance because of roundoff error ";
184  estr+="on first attempt in inte_qawo_gsl_sin::qawo().";
185  O2SCL_CONV_RET(estr.c_str(),exc_eround,this->err_nonconv);
186  } else if ((abserr0 <= tolerance && abserr0 != resasc0) ||
187  abserr0 == 0.0) {
188  *result = result0;
189  *abserr = abserr0;
190 
191  this->last_iter=1;
192  return success;
193  } else if (limit == 1) {
194  *result = result0;
195  *abserr = abserr0;
196 
197  this->last_iter=1;
198  std::string estr="A maximum of 1 iteration was insufficient ";
199  estr+="in inte_qawo_gsl_sin::qawo().";
200  O2SCL_CONV_RET(estr.c_str(),exc_emaxiter,this->err_nonconv);
201  }
202 
203  /* Initialization */
204 
205  this->initialise_table(&table);
206 
207  if (0.5 * abs_omega * fabs(b - a) <= 2) {
208  this->append_table (&table, result0);
209  extall = 1;
210  }
211 
212  area = result0;
213  errsum = abserr0;
214 
215  res_ext = result0;
216  err_ext = GSL_DBL_MAX;
217 
218  positive_integrand = this->test_positivity (result0, resabs0);
219 
220  iteration = 1;
221 
222  do {
223 
224  size_t current_level;
225  double a1, b1, a2, b2;
226  double a_i, b_i, r_i, e_i;
227  double area1 = 0, area2 = 0, area12 = 0;
228  double error1 = 0, error2 = 0, error12 = 0;
229  double resasc1=0.0, resasc2=0.0;
230  double resabs1=0.0, resabs2=0.0;
231  double last_e_i;
232 
233  /* Bisect the subinterval with the largest error estimate */
234 
235  loc_w->retrieve (&a_i, &b_i, &r_i, &e_i);
236 
237  current_level = loc_w->level[loc_w->i] + 1;
238 
239  if (current_level >= wf->n) {
240  error_type = -1 ; /* exceeded limit of table */
241  break ;
242  }
243 
244  a1 = a_i;
245  b1 = 0.5 * (a_i + b_i);
246  a2 = b1;
247  b2 = b_i;
248 
249  iteration++;
250 
251  qc25f(func, a1, b1, wf, current_level,
252  &area1, &error1, &resabs1, &resasc1);
253  qc25f(func, a2, b2, wf, current_level,
254  &area2, &error2, &resabs2, &resasc2);
255 
256  area12 = area1 + area2;
257  error12 = error1 + error2;
258  last_e_i = e_i;
259 
260  /* Improve previous approximations to the integral and test for
261  accuracy.
262 
263  We write these expressions in the same way as the original
264  QUADPACK code so that the rounding errors are the same, which
265  makes testing easier. */
266 
267  errsum = errsum + error12 - e_i;
268  area = area + area12 - r_i;
269 
270  tolerance = GSL_MAX_DBL (epsabs, epsrel * fabs (area));
271 
272  if (this->verbose>0) {
273  std::cout << "inte_qawo_gsl Iter: " << iteration;
274  std::cout.setf(std::ios::showpos);
275  std::cout << " Res: " << area;
276  std::cout.unsetf(std::ios::showpos);
277  std::cout << " Err: " << errsum
278  << " Tol: " << tolerance << std::endl;
279  if (this->verbose>1) {
280  char ch;
281  std::cout << "Press a key and type enter to continue. " ;
282  std::cin >> ch;
283  }
284  }
285 
286  if (resasc1 != error1 && resasc2 != error2) {
287 
288  double delta = r_i - area12;
289 
290  if (fabs (delta) <= 1.0e-5 * fabs (area12) &&
291  error12 >= 0.99 * e_i) {
292 
293  if (!extrapolate) {
294  roundoff_type1++;
295  } else {
296  roundoff_type2++;
297  }
298  }
299 
300  if (iteration > 10 && error12 > e_i) {
301  roundoff_type3++;
302  }
303  }
304 
305  /* Test for roundoff and eventually set error flag */
306 
307  if (roundoff_type1 + roundoff_type2 >= 10 || roundoff_type3 >= 20) {
308  error_type = 2; /* round off error */
309  }
310 
311  if (roundoff_type2 >= 5) {
312  error_type2 = 1;
313  }
314 
315  /* set error flag in the case of bad integrand behaviour at
316  a point of the integration range */
317 
318  if (loc_w->subinterval_too_small (a1, a2, b2)) {
319  error_type = 4;
320  }
321 
322  /* append the newly-created intervals to the list */
323 
324  loc_w->update (a1, b1, area1, error1, a2, b2, area2, error2);
325 
326  if (errsum <= tolerance) {
327  goto compute_result;
328  }
329 
330  if (error_type) {
331  break;
332  }
333 
334  if (iteration >= limit - 1) {
335  error_type = 1;
336  break;
337  }
338 
339  /* set up variables on first iteration */
340 
341  if (iteration == 2 && extall) {
342  error_over_large_intervals = errsum;
343  ertest = tolerance;
344  this->append_table (&table, area);
345  continue;
346  }
347 
348  if (disallow_extrapolation) {
349  continue;
350  }
351 
352  if (extall) {
353  error_over_large_intervals += -last_e_i;
354 
355  if (current_level < loc_w->maximum_level)
356  {
357  error_over_large_intervals += error12;
358  }
359 
360  if (extrapolate) {
361  goto label70;
362  }
363  }
364 
365  if (this->large_interval(loc_w)) {
366  continue;
367  }
368 
369  if (extall) {
370  extrapolate = 1;
371  loc_w->nrmax = 1;
372  } else {
373  /* test whether the interval to be bisected next is the
374  smallest interval. */
375  size_t i = loc_w->i;
376  double width = loc_w->blist[i] - loc_w->alist[i];
377 
378  if (0.25 * fabs(width) * abs_omega > 2) {
379  continue;
380  }
381 
382  extall = 1;
383  error_over_large_intervals = errsum;
384  ertest = tolerance;
385  continue;
386  }
387 
388  label70:
389 
390  if (!error_type2 && error_over_large_intervals > ertest) {
391  if (this->increase_nrmax (loc_w)) {
392  continue;
393  }
394  }
395 
396  /* Perform extrapolation */
397 
398  this->append_table (&table, area);
399 
400  if (table.n < 3) {
401  this->reset_nrmax(loc_w);
402  extrapolate = 0;
403  error_over_large_intervals = errsum;
404  continue;
405  }
406 
407  this->qelg (&table, &reseps, &abseps);
408 
409  ktmin++;
410 
411  if (ktmin > 5 && err_ext < 0.001 * errsum) {
412  error_type = 5;
413  }
414 
415  if (abseps < err_ext) {
416  ktmin = 0;
417  err_ext = abseps;
418  res_ext = reseps;
419  correc = error_over_large_intervals;
420  ertest = GSL_MAX_DBL (epsabs, epsrel * fabs (reseps));
421  if (err_ext <= ertest) {
422  break;
423  }
424  }
425 
426  /* Prepare bisection of the smallest interval. */
427 
428  if (table.n == 1) {
429  disallow_extrapolation = 1;
430  }
431 
432  if (error_type == 5) {
433  break;
434  }
435 
436  /* work on interval with largest error */
437 
438  this->reset_nrmax (loc_w);
439  extrapolate = 0;
440  error_over_large_intervals = errsum;
441 
442  } while (iteration < limit);
443 
444  *result = res_ext;
445  *abserr = err_ext;
446 
447  if (err_ext == GSL_DBL_MAX)
448  goto compute_result;
449 
450  if (error_type || error_type2) {
451 
452  if (error_type2) {
453  err_ext += correc;
454  }
455 
456  if (error_type == 0)
457  error_type = 3;
458 
459  if (result != 0 && area != 0) {
460  if (err_ext / fabs (res_ext) > errsum / fabs (area)) {
461  goto compute_result;
462  }
463  } else if (err_ext > errsum) {
464  goto compute_result;
465  } else if (area == 0.0) {
466  goto return_error;
467  }
468  }
469 
470  /* Test on divergence. */
471 
472  {
473  double max_area = GSL_MAX_DBL (fabs (res_ext), fabs (area));
474 
475  if (!positive_integrand && max_area < 0.01 * resabs0) {
476  goto return_error;
477  }
478  }
479 
480  {
481  double ratio = res_ext / area;
482 
483  if (ratio < 0.01 || ratio > 100 || errsum > fabs (area)) {
484  error_type = 6;
485  }
486  }
487 
488  goto return_error;
489 
490  compute_result:
491 
492  *result = loc_w->sum_results();
493  *abserr = errsum;
494 
495  return_error:
496 
497  if (error_type > 2) {
498  error_type--;
499  }
500 
501  this->last_iter=iteration;
502 
503  if (error_type == 0) {
504  return success;
505  } else if (error_type == 1) {
506  std::string estr="Number of iterations was insufficient ";
507  estr+=" in inte_qawo_gsl_sin::qawo().";
508  O2SCL_CONV_RET(estr.c_str(),exc_emaxiter,this->err_nonconv);
509  } else if (error_type == 2) {
510  std::string estr="Roundoff error prevents tolerance ";
511  estr+="from being achieved in inte_qawo_gsl_sin::qawo().";
512  O2SCL_CONV_RET(estr.c_str(),exc_eround,this->err_nonconv);
513  } else if (error_type == 3) {
514  std::string estr="Bad integrand behavior ";
515  estr+=" in inte_qawo_gsl_sin::qawo().";
516  O2SCL_CONV_RET(estr.c_str(),exc_esing,this->err_nonconv);
517  } else if (error_type == 4) {
518  std::string estr="Roundoff error detected in extrapolation table ";
519  estr+="in inte_qawo_gsl_sin::qawo().";
520  O2SCL_CONV_RET(estr.c_str(),exc_eround,this->err_nonconv);
521  } else if (error_type == 5) {
522  std::string estr="Integral is divergent or slowly convergent ";
523  estr+="in inte_qawo_gsl_sin::qawo().";
524  O2SCL_CONV_RET(estr.c_str(),exc_ediverge,this->err_nonconv);
525  } else if (error_type == -1) {
526  std::string estr="Exceeded limit of trigonometric table ";
527  estr+="inte_qawo_gsl_sin::qawo()";
528  O2SCL_ERR(estr.c_str(),exc_etable);
529  } else {
530  std::string estr="Could not integrate function in inte_qawo_gsl";
531  estr+="::qawo() (it may have returned a non-finite result).";
532  O2SCL_ERR(estr.c_str(),exc_efailed);
533  }
534 
535  }
536 
537  /// 25-point quadrature for oscillating functions
538  void qc25f(func_t &func, double a, double b,
539  gsl_integration_qawo_table *wf, size_t level,
540  double *result, double *abserr, double *resabs,
541  double *resasc) {
542 
543  const double center = 0.5 * (a + b);
544  const double half_length = 0.5 * (b - a);
545 
546  const double par = omega * half_length;
547 
548  if (fabs (par) < 2) {
549 
550  this->gauss_kronrod(func,a,b,result,abserr,resabs,resasc);
551 
552  return;
553 
554  } else {
555 
556  double *moment;
557  double cheb12[13], cheb24[25];
558  double result_abs, res12_cos, res12_sin, res24_cos, res24_sin;
559  double est_cos, est_sin;
560  double c, s;
561  size_t i;
562 
563  this->inte_cheb_series(func, a, b, cheb12, cheb24);
564 
565  if (level >= wf->n) {
566  /* table overflow should not happen, check before calling */
567  O2SCL_ERR("Table overflow in inte_qawo_gsl::qc25f().",
568  exc_esanity);
569  return;
570  }
571 
572  /* obtain moments from the table */
573 
574  moment = wf->chebmo + 25 * level;
575 
576  res12_cos = cheb12[12] * moment[12];
577  res12_sin = 0 ;
578 
579  for (i = 0; i < 6; i++) {
580  size_t k = 10 - 2 * i;
581  res12_cos += cheb12[k] * moment[k];
582  res12_sin += cheb12[k + 1] * moment[k + 1];
583  }
584 
585  res24_cos = cheb24[24] * moment[24];
586  res24_sin = 0 ;
587 
588  result_abs = fabs(cheb24[24]) ;
589 
590  for (i = 0; i < 12; i++) {
591  size_t k = 22 - 2 * i;
592  res24_cos += cheb24[k] * moment[k];
593  res24_sin += cheb24[k + 1] * moment[k + 1];
594  result_abs += fabs(cheb24[k]) + fabs(cheb24[k+1]);
595  }
596 
597  est_cos = fabs(res24_cos - res12_cos);
598  est_sin = fabs(res24_sin - res12_sin);
599 
600  c = half_length * cos(center * omega);
601  s = half_length * sin(center * omega);
602 
603  if (wf->sine == GSL_INTEG_SINE) {
604  *result = c * res24_sin + s * res24_cos;
605  *abserr = fabs(c * est_sin) + fabs(s * est_cos);
606  } else {
607  *result = c * res24_cos - s * res24_sin;
608  *abserr = fabs(c * est_cos) + fabs(s * est_sin);
609  }
610 
611  *resabs = result_abs * half_length;
612  *resasc = GSL_DBL_MAX;
613 
614  return;
615  }
616  }
617 
618  /// Add the oscillating part to the integrand
619  virtual double transform(double t, func_t &func) {
620  return func(t)*sin(this->omega*t);
621  }
622 
623 #endif
624 
625  /// Return string denoting type ("inte_qawo_gsl_sin")
626  const char *type() { return "inte_qawo_gsl_sin"; }
627 
628  };
629 
630  /** \brief Adaptive integration a function with finite limits of
631  integration (GSL)
632 
633  The integral
634  \f[
635  \int_a^b f(x) \cos (\omega x)~dx
636  \f]
637  is computed for some frequency parameter \f$ \omega \f$ .
638 
639  This class is exactly analogous to \ref inte_qawo_gsl_sin .
640  See that class documentation for more details.
641  */
642  template<class func_t> class inte_qawo_gsl_cos :
643  public inte_qawo_gsl_sin<func_t> {
644 
645  public:
646 
648  }
649 
650  virtual ~inte_qawo_gsl_cos() {}
651 
652  /** \brief Integrate function \c func from \c a to \c b and place
653  the result in \c res and the error in \c err
654  */
655  virtual int integ_err(func_t &func, double a, double b,
656  double &res, double &err) {
657 
658  this->otable=gsl_integration_qawo_table_alloc
659  (this->omega,b-a,GSL_INTEG_COSINE,this->n_levels);
660 
661  int status=this->qawo(func,a,this->tol_abs,this->tol_rel,
662  this->w,this->otable,&res,&err);
663 
664  gsl_integration_qawo_table_free(this->otable);
665 
666  return status;
667  }
668 
669 #ifndef DOXYGEN_INTERNAL
670 
671  protected:
672 
673  /// Add the oscillating part to the integrand
674  virtual double transform(double t, func_t &func) {
675  return func(t)*cos(this->omega*t);
676  }
677 
678 #endif
679 
680  /// Return string denoting type ("inte_qawo_gsl_cos")
681  const char *type() { return "inte_qawo_gsl_cos"; }
682 
683  };
684 
685 #ifndef DOXYGEN_NO_O2NS
686 }
687 #endif
688 
689 #endif
const char * type()
Return string denoting type ("inte_qawo_gsl_cos")
virtual int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate function func from a to b and place the result in res and the error in err.
Definition: inte_qawo_gsl.h:80
Integration workspace for the GSL integrators.
int qawo(func_t &func, const double a, const double epsabs, const double epsrel, inte_workspace_gsl *loc_w, gsl_integration_qawo_table *wf, double *result, double *abserr)
The full GSL integration routine called by integ_err()
void initialise_table(struct extrapolation_table *table)
Initialize the table.
#define O2SCL_CONV_RET(d, n, b)
Set a "convergence" error and return the error value.
Definition: err_hnd.h:292
double * alist
Left endpoints of subintervals.
void inte_cheb_series(func2_t &f, double a, double b, double *cheb12, double *cheb24)
Compute Chebyshev series expansion using a FFT method.
double * blist
Right endpoints of subintervals.
Data table table class.
Definition: table.h:47
double omega
The user-specified frequency (default 1.0)
Definition: inte_qawo_gsl.h:72
sanity check failed - shouldn't happen
Definition: err_hnd.h:65
size_t * level
Numbers of subdivisions made.
void append_table(struct extrapolation_table *table, double y)
Append a result to the table.
apparent singularity detected
Definition: err_hnd.h:93
exceeded max number of iterations
Definition: err_hnd.h:73
int large_interval(inte_workspace_gsl *workspace)
Determine if an interval is large.
size_t last_iter
The most recent number of iterations taken.
Definition: inte.h:63
bool err_nonconv
If true, call the error handler if the routine does not converge or reach the desired tolerance (defa...
Definition: inte.h:81
table table limit exceeded
Definition: err_hnd.h:103
int update(double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
Determine which new subinterval to add to the workspace stack and perform update. ...
size_t n_levels
The number of bisection levels (default 10)
Definition: inte_qawo_gsl.h:75
size_t i
Index of current subinterval.
virtual int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate function func from a to b and place the result in res and the error in err.
generic failure
Definition: err_hnd.h:61
Chebyshev integration base class (GSL)
Definition: inte_qawc_gsl.h:46
int subinterval_too_small(double a1, double a2, double b2)
Test whether the proposed subdivision falls before floating-point precision.
double tol_abs
The maximum absolute uncertainty in the value of the integral (default )
Definition: inte.h:73
virtual void gauss_kronrod(func_t &func, double a, double b, double *result, double *abserr, double *resabs, double *resasc)
Integration wrapper for internal transformed function type.
int test_positivity(double result, double resabs)
Test if the integrand satisfies .
int initialise(double a, double b)
Initialize the workspace for an integration with limits a and b.
int set_initial_result(double result, double error)
Update the workspace with the result and error from the first integration.
const char * type()
Return string denoting type ("inte_qawo_gsl_sin")
std::string dtos(double x, int prec=6, bool auto_prec=false)
Convert a double to a string.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
Definition: err_hnd.h:273
virtual double transform(double t, func_t &func)
Add the oscillating part to the integrand.
int retrieve(double *a, double *b, double *r, double *e) const
Retrieve the ith result from the workspace stack.
size_t nrmax
Counter for extrapolation routine.
void qelg(struct extrapolation_table *table, double *result, double *abserr)
Determines the limit of a given sequence of approximations.
inte_workspace_gsl * w
The integration workspace.
double sum_results()
Add up all of the contributions to construct the final result.
double tol_rel
The maximum relative uncertainty in the value of the integral (default )
Definition: inte.h:68
virtual double transform(double t, func_t &func)
Add the oscillating part to the integrand.
void reset_nrmax(inte_workspace_gsl *workspace)
Reset workspace to work on the interval with the largest error.
int increase_nrmax(inte_workspace_gsl *workspace)
Increase workspace.
A structure for extrapolation for inte_qags_gsl.
size_t n
Index of new element in the first column.
Adaptive integration a function with finite limits of integration (GSL)
size_t limit
Maximum number of subintervals allocated.
user specified an invalid tolerance
Definition: err_hnd.h:77
Success.
Definition: err_hnd.h:47
Adaptive integration for oscillatory integrals (GSL)
Definition: inte_qawo_gsl.h:59
void qc25f(func_t &func, double a, double b, gsl_integration_qawo_table *wf, size_t level, double *result, double *abserr, double *resabs, double *resasc)
25-point quadrature for oscillating functions
gsl_integration_qawo_table * otable
The integration workspace.
Definition: inte_qawo_gsl.h:99
int verbose
Verbosity.
Definition: inte.h:60
failed because of roundoff error
Definition: err_hnd.h:87
integral or series is divergent
Definition: err_hnd.h:95

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..