queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::GaussianHermite1DQuadrature Class Reference

Class for Hermite-Gauss quadrature rule for one-dimensional functions. More...

#include <1DQuadrature.h>

Inheritance diagram for QUESO::GaussianHermite1DQuadrature:
QUESO::Base1DQuadrature QUESO::BaseQuadrature

Public Member Functions

Constructor/Destructor methods
 GaussianHermite1DQuadrature (double mean, double stddev, unsigned int order)
 Default constructor. More...
 
 ~GaussianHermite1DQuadrature ()
 Destructor. More...
 
- Public Member Functions inherited from QUESO::Base1DQuadrature
 Base1DQuadrature (double minDomainValue, double maxDomainValue, unsigned int order)
 Default constructor. More...
 
virtual ~Base1DQuadrature ()=0
 Pure virtual destructor, forcing this to be an abstract object. More...
 
double minDomainValue () const
 Returns the minimum value of the domain of the (one-dimensional) function. More...
 
double maxDomainValue () const
 Returns the maximum value of the domain of the (one-dimensional) function. More...
 
unsigned int order () const
 Returns the order of the quadrature rule. More...
 
const std::vector< double > & positions () const
 Array of the positions for the numerical integration. More...
 
- Public Member Functions inherited from QUESO::BaseQuadrature
 BaseQuadrature ()
 
virtual ~BaseQuadrature ()=0
 Pure virtual destructor, forcing this to be an abstract object. More...
 
const std::vector< double > & weights () const
 Array of the weights used in the numerical integration. More...
 

Protected Attributes

double m_mean
 
double m_stddev
 
- Protected Attributes inherited from QUESO::Base1DQuadrature
double m_minDomainValue
 
double m_maxDomainValue
 
unsigned int m_order
 
std::vector< double > m_positions
 
- Protected Attributes inherited from QUESO::BaseQuadrature
std::vector< double > m_weights
 

Detailed Description

Class for Hermite-Gauss quadrature rule for one-dimensional functions.

Hermite-Gauss quadrature, also called Hermite quadrature, is a Gaussian quadrature over the interval \((-\infty,\infty)\) with weighting function \( W(x)=e^{-x^2}\).
The abscissas for quadrature order \( n \) are given by the roots \( x_i \) of the Hermite polynomials \( H_n(x)\), which occur symmetrically about 0.
The abscissas and weights can be computed analytically for small \( n \):

\( n \)\( x_i \)\( w_i \)
2 \(\pm \frac{1}{2}\sqrt{2} \) \( \frac{1}{2}\sqrt{\pi} \)
3 \( 0 \) \( \frac{2}{3}\sqrt{\pi} \)
\(\pm \frac{1}{2}\sqrt{6} \) \( \frac{1}{6}\sqrt{\pi} \)
4 \(\pm \sqrt{\frac{3-\sqrt{6}}{2}} \) \( \frac{\sqrt{\pi}}{4(3-\sqrt{6})} \)
\(\pm \sqrt{\frac{3-\sqrt{6}}{2}} \) \( \frac{\sqrt{\pi}}{4(3+\sqrt{6})} \)
See Also
Weisstein, Eric W. "Hermite-Gauss Quadrature." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/Hermite-GaussQuadrature.html.

Definition at line 194 of file 1DQuadrature.h.

Constructor & Destructor Documentation

QUESO::GaussianHermite1DQuadrature::GaussianHermite1DQuadrature ( double  mean,
double  stddev,
unsigned int  order 
)

Default constructor.

Constructs a Gaussian-Hermite quadrature of order order. Valid values for the order of the quadrature rule are: 1-9, 19.

Todo:
: Prepare the code to include both parameters mean and stddev.

Definition at line 402 of file 1DQuadrature.C.

References QUESO::Base1DQuadrature::m_order, QUESO::Base1DQuadrature::m_positions, and QUESO::BaseQuadrature::m_weights.

406  :
407  Base1DQuadrature(-INFINITY,INFINITY,order),
408  m_mean (mean),
409  m_stddev(stddev)
410 {
411  // FIX ME: prepare code for mean != 0 and stddev != 1
412  m_positions.resize(m_order+1,0.); // Yes, '+1'
413  m_weights.resize (m_order+1,0.); // Yes, '+1'
414 
415  // http://www.efunda.com/math/num_integration/findgausshermite.cfm
416  switch (m_order) { // eep2011
417  case 1:
418  m_weights [0] = sqrt(M_PI)/2.;
419  m_weights [1] = sqrt(M_PI)/2.;
420 
421  m_positions[0] = -1./sqrt(2.);
422  m_positions[1] = 1./sqrt(2.);
423  break;
424 
425  case 2:
426  m_weights [0] = sqrt(M_PI)/6.;
427  m_weights [1] = 2.*sqrt(M_PI)/3.;
428  m_weights [2] = sqrt(M_PI)/6.;
429 
430  m_positions[0] = -sqrt(1.5);
431  m_positions[1] = 0.;
432  m_positions[2] = sqrt(1.5);
433  break;
434 
435  case 3:
436  m_weights [0] = sqrt(M_PI)/4./(3.+sqrt(6.));
437  m_weights [1] = sqrt(M_PI)/4./(3.-sqrt(6.));
438  m_weights [2] = sqrt(M_PI)/4./(3.-sqrt(6.));
439  m_weights [3] = sqrt(M_PI)/4./(3.+sqrt(6.));
440 
441  m_positions[0] = -sqrt(1.5+sqrt(1.5));
442  m_positions[1] = -sqrt(1.5-sqrt(1.5));
443  m_positions[2] = sqrt(1.5-sqrt(1.5));
444  m_positions[3] = sqrt(1.5+sqrt(1.5));
445  break;
446 
447  case 4:
448  m_weights [0] = 0.019953242049;
449  m_weights [1] = 0.393619323152;
450  m_weights [2] = 0.945308720483;
451  m_weights [3] = 0.393619323152;
452  m_weights [4] = 0.019953242059;
453 
454  m_positions[0] = -sqrt(2.5+sqrt(2.5));
455  m_positions[1] = -sqrt(2.5-sqrt(2.5));
456  m_positions[2] = 0.;
457  m_positions[3] = sqrt(2.5-sqrt(2.5));
458  m_positions[4] = sqrt(2.5+sqrt(2.5));
459  break;
460 
461  case 5:
462  m_weights [0] = 0.00453000990551;
463  m_weights [1] = 0.157067320323;
464  m_weights [2] = 0.724629595224;
465  m_weights [3] = 0.724629595224;
466  m_weights [4] = 0.157067320323;
467  m_weights [5] = 0.00453000990551;
468 
469  m_positions [0] = -2.35060497367;
470  m_positions [1] = -1.33584907401;
471  m_positions [2] = -0.436077411928;
472  m_positions [3] = 0.436077411928;
473  m_positions [4] = 1.33584907401;
474  m_positions [5] = 2.35060497367;
475  break;
476 
477  case 6:
478  m_weights [0] = 0.0009717812451;
479  m_weights [1] = 0.0545155828191;
480  m_weights [2] = 0.42560725261;
481  m_weights [3] = 0.810264617557;
482  m_weights [4] = 0.42560725261;
483  m_weights [5] = 0.0545155828191;
484  m_weights [6] = 0.0009717812451;
485 
486  m_positions [0] = -2.65196135684;
487  m_positions [1] = -1.67355162877;
488  m_positions [2] = -0.816287882859;
489  m_positions [3] = 0.;
490  m_positions [4] = 0.816287882859;
491  m_positions [5] = 1.67355162877;
492  m_positions [6] = 2.65196135684;
493  break;
494 
495  case 7:
496  m_weights [0] = 0.000199604072211;
497  m_weights [1] = 0.0170779830074;
498  m_weights [2] = 0.207802325815;
499  m_weights [3] = 0.661147012558;
500  m_weights [4] = 0.661147012558;
501  m_weights [5] = 0.207802325815;
502  m_weights [6] = 0.0170779830074;
503  m_weights [7] = 0.000199604072211;
504 
505  m_positions [0] = -2.93063742026;
506  m_positions [1] = -1.9816567567;
507  m_positions [2] = -1.15719371245;
508  m_positions [3] = -0.381186990207;
509  m_positions [4] = 0.381186990207;
510  m_positions [5] = 1.15719371245;
511  m_positions [6] = 1.9816567567;
512  m_positions [7] = 2.93063742026;
513  break;
514 
515  case 8:
516  m_weights [0] = 3.96069772633e-5;
517  m_weights [1] = 0.00494362427554;
518  m_weights [2] = 0.0884745273944;
519  m_weights [3] = 0.432651559003;
520  m_weights [4] = 0.720235215606;
521  m_weights [5] = 0.432651559003;
522  m_weights [6] = 0.0884745273944;
523  m_weights [7] = 0.00494362427554;
524  m_weights [8] = 3.96069772633e-5;
525 
526  m_positions [0] = -3.19099320178;
527  m_positions [1] = -2.26658058453;
528  m_positions [2] = -1.46855328922;
529  m_positions [3] = -0.723551018753;
530  m_positions [4] = 0.;
531  m_positions [5] = 0.723551018753;
532  m_positions [6] = 1.46855328922;
533  m_positions [7] = 2.26658058453;
534  m_positions [8] = 3.19099320178;
535  break;
536 
537  case 9:
538  m_weights [0] = 7.64043285523e-6;
539  m_weights [1] = 0.00134364574678;
540  m_weights [2] = 0.0338743944555;
541  m_weights [3] = 0.240138611082;
542  m_weights [4] = 0.610862633735;
543  m_weights [5] = 0.610862633735;
544  m_weights [6] = 0.240138611082;
545  m_weights [7] = 0.0338743944555;
546  m_weights [8] = 0.00134364574678;
547  m_weights [9] = 7.64043285523e-6;
548 
549  m_positions [0] = -3.43615911884;
550  m_positions [1] = -2.53273167423;
551  m_positions [2] = -1.7566836493;
552  m_positions [3] = -1.03661082979;
553  m_positions [4] = -0.342901327224;
554  m_positions [5] = 0.342901327224;
555  m_positions [6] = 1.03661082979;
556  m_positions [7] = 1.7566836493;
557  m_positions [8] = 2.53273167423;
558  m_positions [9] = 3.43615911884;
559  break;
560 
561  case 19:
562  m_weights [0] = 2.22939364554e-13;
563  m_weights [1] = 4.39934099226e-10;
564  m_weights [2] = 1.08606937077e-7;
565  m_weights [3] = 7.8025564785e-6;
566  m_weights [4] = 0.000228338636017;
567  m_weights [5] = 0.00324377334224;
568  m_weights [6] = 0.0248105208875;
569  m_weights [7] = 0.10901720602;
570  m_weights [8] = 0.286675505363;
571  m_weights [9] = 0.462243669601;
572  m_weights [10] = 0.462243669601;
573  m_weights [11] = 0.286675505363;
574  m_weights [12] = 0.10901720602;
575  m_weights [13] = 0.0248105208875;
576  m_weights [14] = 0.00324377334224;
577  m_weights [15] = 0.000228338636017;
578  m_weights [16] = 7.8025564785e-6;
579  m_weights [17] = 1.08606937077e-7;
580  m_weights [18] = 4.39934099226e-10;
581  m_weights [19] = 2.22939364554e-13;
582 
583  m_positions [0] = -5.38748089001;
584  m_positions [1] = -4.60368244955;
585  m_positions [2] = -3.94476404012;
586  m_positions [3] = -3.34785456738;
587  m_positions [4] = -2.78880605843;
588  m_positions [5] = -2.25497400209;
589  m_positions [6] = -1.73853771212;
590  m_positions [7] = -1.2340762154;
591  m_positions [8] = -0.737473728545;
592  m_positions [9] = -0.245340708301;
593  m_positions[10] = 0.245340708301;
594  m_positions[11] = 0.737473728545;
595  m_positions[12] = 1.2340762154;
596  m_positions[13] = 1.73853771212;
597  m_positions[14] = 2.25497400209;
598  m_positions[15] = 2.78880605843;
599  m_positions[16] = 3.34785456738;
600  m_positions[17] = 3.94476404012;
601  m_positions[18] = 4.60368244955;
602  m_positions[19] = 5.38748089001;
603  break;
604 
605  default:
606  std::stringstream ss;
607  ss << "In GaussianHermite1DQuadrature::constructor()"
608  << ": m_order = " << m_order
609  << std::endl;
610  queso_error_msg(ss.str());
611  break;
612  }
613 }
Base1DQuadrature(double minDomainValue, double maxDomainValue, unsigned int order)
Default constructor.
Definition: 1DQuadrature.C:34
std::vector< double > m_weights
std::vector< double > m_positions
Definition: 1DQuadrature.h:83
unsigned int order() const
Returns the order of the quadrature rule.
Definition: 1DQuadrature.C:67
QUESO::GaussianHermite1DQuadrature::~GaussianHermite1DQuadrature ( )

Destructor.

Definition at line 615 of file 1DQuadrature.C.

616 {
617 }

Member Data Documentation

double QUESO::GaussianHermite1DQuadrature::m_mean
protected

Definition at line 211 of file 1DQuadrature.h.

double QUESO::GaussianHermite1DQuadrature::m_stddev
protected

Definition at line 212 of file 1DQuadrature.h.


The documentation for this class was generated from the following files:

Generated on Tue Jun 5 2018 19:49:19 for queso-0.57.1 by  doxygen 1.8.5