npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
DensityOrthoPoly1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_DENSITYORTHOPOLY1D_HH_
2 #define NPSTAT_DENSITYORTHOPOLY1D_HH_
3 
4 /*!
5 // \file DensityOrthoPoly1D.hh
6 //
7 // \brief Continuous orthonormal polynomial series in one dimension
8 // generated for a continuous density used as the weight
9 //
10 // Author: I. Volobouev
11 //
12 // July 2020
13 */
14 
15 #include <vector>
16 
17 #include "geners/CPP11_auto_ptr.hh"
18 
20 #include "npstat/nm/Recurrence.hh"
22 
24 
25 namespace npstat {
26  class FejerQuadrature;
27 
29  {
30  public:
31  /**
32  // "nIntegPoints" parameter is the number of integration points
33  // for the Fejer quadrature. Note that Fejer quadrature with n
34  // points can integrate exactly polynomials of degree n-1 and
35  // that this quadrature will be used for calculating various
36  // inner products in which the density is used as the weight.
37  // Therefore, "nIntegPoints" should be at least
38  // 2*maxDegree + 1 + C, where "C" is the polynomial degree
39  // that can be used to approximate the density reasonably well.
40  //
41  // The support of the weight for the integration purpose will
42  // be set to [distro.quantile(0.0), distro.quantile(1.0)]. If
43  // this interval is very wide, the results may be meaningless
44  // (monomials like x^n can exceed the floating point dynamic
45  // range, etc).
46  */
48  unsigned maxDegree,
49  unsigned nIntegPoints,
50  OrthoPolyMethod m = OPOLY_STIELTJES);
51 
53  DensityOrthoPoly1D& operator=(const DensityOrthoPoly1D&);
54 
55  inline virtual ~DensityOrthoPoly1D() {}
56 
57  inline virtual DensityOrthoPoly1D* clone() const
58  {return new DensityOrthoPoly1D(*this);}
59 
60  inline virtual long double weight(const long double x) const
61  {return distro_->density(x);}
62  inline virtual double xmin() const {return distro_->quantile(0.0);}
63  inline virtual double xmax() const {return distro_->quantile(1.0);}
64  inline virtual unsigned maxDegree() const {return maxdeg_;}
65 
66  virtual std::pair<long double,long double>
67  monicRecurrenceCoeffs(unsigned deg) const;
68 
69  virtual std::pair<long double,long double>
70  recurrenceCoeffs(unsigned deg) const;
71 
72  private:
73  void initialize(const FejerQuadrature& quad, OrthoPolyMethod m);
74 
75  CPP11_auto_ptr<AbsDistribution1D> distro_;
76  std::vector<Private::Recurrence> rCoeffs_;
77  unsigned maxdeg_;
78  };
79 }
80 
81 #endif // NPSTAT_DENSITYORTHOPOLY1D_HH_
Base class for classical continuous orthonormal polynomials.
Interface definition for 1-d continuous statistical distributions.
Enumeration of methods used to create orthogonal polynomials with discrete weights.
Definition: AbsClassicalOrthoPoly1D.hh:32
Definition: DensityOrthoPoly1D.hh:29
virtual double xmin() const
Definition: DensityOrthoPoly1D.hh:62
virtual DensityOrthoPoly1D * clone() const
Definition: DensityOrthoPoly1D.hh:57
virtual long double weight(const long double x) const
Definition: DensityOrthoPoly1D.hh:60
DensityOrthoPoly1D(const AbsDistribution1D &distro, unsigned maxDegree, unsigned nIntegPoints, OrthoPolyMethod m=OPOLY_STIELTJES)
virtual unsigned maxDegree() const
Definition: DensityOrthoPoly1D.hh:64
Definition: FejerQuadrature.hh:28
Definition: AbsArrayProjector.hh:14
OrthoPolyMethod
Definition: OrthoPolyMethod.hh:20
Definition: AbsDistribution1D.hh:31