npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
MemoizingSymbetaFilterProvider.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_MEMOIZINGSYMBETAFILTERPROVIDER_HH_
2 #define NPSTAT_MEMOIZINGSYMBETAFILTERPROVIDER_HH_
3 
4 /*!
5 // \file MemoizingSymbetaFilterProvider.hh
6 //
7 // \brief Builds symmetric beta LOrPE filters and remembers
8 // these filters when the user sets the corresponding flag
9 //
10 // Author: I. Volobouev
11 //
12 // November 2013
13 */
14 
15 #include <map>
16 #include <vector>
17 #include <string>
18 #include <cassert>
19 
20 #include "geners/ClassId.hh"
21 
24 
25 namespace npstat {
27  {
28  public:
30 
31  inline virtual ~MemoizingSymbetaFilterProvider() {}
32 
33  virtual CPP11_shared_ptr<const LocalPolyFilter1D> provideFilter(
34  int symbetaPower, double bandwidth, double degree,
35  unsigned nbins, double binwidth,
36  const BoundaryHandling& bm,
37  unsigned excludedBin, bool excludeCentralPoint);
38 
39  inline unsigned long nMemoized() const {return filterMap_.size();}
40 
41  void firstMemoizedInfo(int* symbetaPower, double* bandwidth,
42  double* degree, unsigned* nbins,
43  double* binwidth, BoundaryHandling* bm,
44  unsigned* excludedBin,
45  bool* excludeCentralPoint) const;
46 
47  std::vector<double> knownBandwidthValues() const;
48 
49  bool operator==(const MemoizingSymbetaFilterProvider& r) const;
50  inline bool operator!=(const MemoizingSymbetaFilterProvider& r) const
51  {return !(*this == r);}
52 
53  // I/O methods needed for writing
54  inline gs::ClassId classId() const {return gs::ClassId(*this);}
55  bool write(std::ostream& of) const;
56 
57  // I/O methods needed for reading
58  static inline const char* classname()
59  {return "npstat::MemoizingSymbetaFilterProvider";}
60  static inline unsigned version() {return 3;}
61  static void restore(const gs::ClassId& id, std::istream& in,
62  MemoizingSymbetaFilterProvider* ptr);
63  private:
64  typedef CPP11_shared_ptr<const LocalPolyFilter1D> FilterPtr;
65  typedef std::map<AllSymbetaParams1D, FilterPtr> FilterMap;
66 
67  FilterMap filterMap_;
68  };
69 }
70 
71 #endif // NPSTAT_MEMOIZINGSYMBETAFILTERPROVIDER_HH_
Interface definition for classes which build symmetric beta LOrPE filters.
Complete set of parameters for building 1-d filters from the symmetric beta family.
virtual void startMemoizing()
Definition: AbsSymbetaFilterProvider.hh:70
Definition: BoundaryHandling.hh:21
Definition: MemoizingSymbetaFilterProvider.hh:27
virtual CPP11_shared_ptr< const LocalPolyFilter1D > provideFilter(int symbetaPower, double bandwidth, double degree, unsigned nbins, double binwidth, const BoundaryHandling &bm, unsigned excludedBin, bool excludeCentralPoint)
Definition: AbsSymbetaFilterProvider.hh:84
Definition: AbsArrayProjector.hh:14