npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
BernsteinFilter1DBuilder.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_BERNSTEINFILTER1DBUILDER_HH_
2 #define NPSTAT_BERNSTEINFILTER1DBUILDER_HH_
3 
4 /*!
5 // \file BernsteinFilter1DBuilder.hh
6 //
7 // \brief Builder of Bernstein polynomial filters in one dimension
8 //
9 // The filters are intended for use with the "LocalPolyFilter1D" class.
10 //
11 // Author: I. Volobouev
12 //
13 // June 2013
14 */
15 
18 
19 namespace npstat {
20  /**
21  // This class will construct Bernstein polynomial filters
22  // for the given length of data discretization grid (number
23  // of bins). These filters are positive doubly stochastic and,
24  // therefore, useful for sequential copula filtering. They
25  // are designed to be used with the "convolve" method of
26  // LocalPolyFilter1D class.
27  */
29  {
30  public:
31  /**
32  // The constructor arguments are as follows:
33  //
34  // polyDegree -- Degree of Bernstein polynomials. Its inverse
35  // plays the role of bandwidth.
36  //
37  // dataLen -- Length of data arrays to be filtered by
38  // the filters built with this object. Must be
39  // larger than polyDegree.
40  //
41  // useClosestPoly -- Determines how data bins are mapped into
42  // integer polynomial degrees. If this argument
43  // is "true", normally the "closest" polynomial
44  // is used. If "false", each bin will use
45  // a combination of two or three closest
46  // polynomials.
47  //
48  // In order to use the smallest possible number of bins with the
49  // given poly degree, set dataLen to polyDegree + 1. Also, set
50  // "useClosestPoly" parameters to "true".
51  */
52  BernsteinFilter1DBuilder(unsigned polyDegree, unsigned dataLen,
53  bool useClosestPoly);
54 
55  inline virtual ~BernsteinFilter1DBuilder() {}
56 
57  /** This method is pure virtual in the base, so it must be implemented */
58  inline unsigned centralWeightLength() const {return dataLen_;}
59 
60  /** Internal filters are all different */
61  inline bool keepAllFilters() const {return true;}
62 
63  //@{
64  /** Simple inspector of object properties */
65  inline unsigned polyDegree() const {return polyDegree_;}
66  inline bool usingClosestPoly() const {return useClosestPoly_;}
67  //@}
68 
69  /** The "taper" and "lenTaper" arguments will be ignored */
70  virtual PolyFilter1D* makeFilter(const double* taper, unsigned lenTaper,
71  unsigned binnum, unsigned datalen) const;
72  private:
74 
75  void fillClosestPoly(unsigned binnum, long double* f) const;
76  void fillWeighted(unsigned binnum, long double* f) const;
77 
78  DiscreteBernsteinPoly1D polySet_;
79  unsigned polyDegree_;
80  unsigned dataLen_;
81  bool useClosestPoly_;
82  };
83 }
84 
85 #endif // NPSTAT_BERNSTEINFILTER1DBUILDER_HH_
Abstract interface for building local polynomial filter weights in 1-d.
Discrete Bernstein polynomials in one dimension.
Definition: BernsteinFilter1DBuilder.hh:29
bool keepAllFilters() const
Definition: BernsteinFilter1DBuilder.hh:61
unsigned polyDegree() const
Definition: BernsteinFilter1DBuilder.hh:65
virtual PolyFilter1D * makeFilter(const double *taper, unsigned lenTaper, unsigned binnum, unsigned datalen) const
BernsteinFilter1DBuilder(unsigned polyDegree, unsigned dataLen, bool useClosestPoly)
unsigned centralWeightLength() const
Definition: BernsteinFilter1DBuilder.hh:58
Definition: DiscreteBernsteinPoly1D.hh:20
Definition: AbsFilter1DBuilder.hh:34
Definition: AbsArrayProjector.hh:14
Definition: AbsFilter1DBuilder.hh:71