npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
Gauss1DQuadrature.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_GAUSS1DQUADRATURE_HH_
2 #define NPSTAT_GAUSS1DQUADRATURE_HH_
3 
4 /*!
5 // \file Gauss1DQuadrature.hh
6 //
7 // \brief Adaptation of Gauss-Hermite quadratures that works with Gauss1D
8 // densities as weights
9 //
10 // Author: I. Volobouev
11 //
12 // November 2020
13 */
14 
16 
17 namespace npstat {
19  {
20  public:
21  enum {interval_quadrature = 0};
22 
23  Gauss1DQuadrature(unsigned npoints, long double mu, long double sigma);
24 
25  inline unsigned npoints() const {return ghq_.npoints();}
26  inline long double mean() const {return mean_;}
27  inline long double sigma() const {return sigma_;}
28 
29  void getAllAbscissae(long double* abscissae, unsigned len) const;
30  void getAllWeights(long double* weights, unsigned len) const;
31 
32  /** Perform the quadrature */
33  template <typename FcnResult, typename FcnArg>
34  inline long double integrate(const Functor1<FcnResult,FcnArg>& fcn) const
35  {return ghq_.integrateProb(mean_, sigma_, fcn);}
36 
37  /** Check if the rule with the given number of points is supported */
38  inline static bool isAllowed(const unsigned npoints)
39  {return GaussHermiteQuadrature::isAllowed(npoints);}
40 
41  /** The complete set of allowed rules, in the increasing order */
42  inline static std::vector<unsigned> allowedNPonts()
44 
45  /**
46  // Minimum number of points, among the supported rules, which
47  // integrates a polynomial with the given degree exactly (with
48  // the appropriate weight). Returns 0 if the degree is out of range.
49  */
50  inline static unsigned minimalExactRule(const unsigned polyDegree)
51  {return GaussHermiteQuadrature::minimalExactRule(polyDegree);}
52 
53  private:
55  long double mean_;
56  long double sigma_;
57  };
58 }
59 
60 #endif // NPSTAT_GAUSS1DQUADRATURE_HH_
Gauss-Hermite quadratures in long double precision.
Definition: Gauss1DQuadrature.hh:19
static std::vector< unsigned > allowedNPonts()
Definition: Gauss1DQuadrature.hh:42
static bool isAllowed(const unsigned npoints)
Definition: Gauss1DQuadrature.hh:38
static unsigned minimalExactRule(const unsigned polyDegree)
Definition: Gauss1DQuadrature.hh:50
long double integrate(const Functor1< FcnResult, FcnArg > &fcn) const
Definition: Gauss1DQuadrature.hh:34
Definition: GaussHermiteQuadrature.hh:26
static unsigned minimalExactRule(unsigned polyDegree)
long double integrateProb(long double mean, long double sigma, const Functor1< FcnResult, FcnArg > &fcn) const
static bool isAllowed(unsigned npoints)
unsigned npoints() const
Definition: GaussHermiteQuadrature.hh:45
static std::vector< unsigned > allowedNPonts()
Definition: AbsArrayProjector.hh:14
Definition: SimpleFunctors.hh:58