npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
SmoothCDGOFTest1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_SMOOTHCDGOFTEST1D_HH_
2 #define NPSTAT_SMOOTHCDGOFTEST1D_HH_
3 
4 /*!
5 // \file SmoothCDGOFTest1D.hh
6 //
7 // \brief Smooth test for goodness-of-fit based on the Legendre polynomial
8 // expansion of the empirical comparison density
9 //
10 // Author: I. Volobouev
11 //
12 // October 2022
13 */
14 
17 
18 namespace npstat {
20  {
21  public:
22  // The mask, if provided, should contain "maxdeg" elements.
23  // Put some number in the mask in order to discard the
24  // corresponding eigenvector and put 0 there to keep it.
25  // mask[0] specifies whether to use polynomial of degree 1, etc.
26  inline SmoothCDGOFTest1D(const AbsDistribution1D& distro,
27  const unsigned maxdeg,
28  const unsigned char* mask=0,
29  const unsigned lenMask=0)
30  : AbsSmoothGOFTest1D(distro, maxdeg, mask, lenMask) {}
31 
32  inline SmoothCDGOFTest1D(const AbsDistribution1D& distro,
33  const std::vector<int>& mask)
34  : AbsSmoothGOFTest1D(distro, mask) {}
35 
36  inline virtual ~SmoothCDGOFTest1D() {}
37 
38  inline virtual std::string shortName() const
39  {return testNameWithMask("SCD");}
40 
41  virtual unsigned normalizedDeviations(
42  const double* data, unsigned long sz,
43  bool isDataSorted,
44  double* deviations, unsigned lenDeviations) const;
45 
46  virtual unsigned normalizedDeviations(
47  const float* data, unsigned long sz,
48  bool isDataSorted,
49  double* deviations, unsigned lenDeviations) const;
50 
51  private:
52  template<typename Numeric>
53  unsigned normalizedDeviationsHelper(
54  const Numeric* data, unsigned long lenData,
55  double* deviations) const;
56 
58  };
59 }
60 
61 #include "npstat/stat/SmoothCDGOFTest1D.icc"
62 
63 #endif // NPSTAT_SMOOTHCDGOFTEST1D_HH_
Base class for smooth tests for goodness-of-fit.
Orthonormal versions of some classical orthogonal polynomials.
Definition: AbsSmoothGOFTest1D.hh:20
Definition: ClassicalOrthoPolys1D.hh:121
Definition: SmoothCDGOFTest1D.hh:20
virtual unsigned normalizedDeviations(const double *data, unsigned long sz, bool isDataSorted, double *deviations, unsigned lenDeviations) const
Definition: AbsArrayProjector.hh:14
Definition: AbsDistribution1D.hh:31