npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
LogTransform1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_LOGTRANSFORM1D_HH_
2 #define NPSTAT_LOGTRANSFORM1D_HH_
3 
4 /*!
5 // \file LogTransform1D.hh
6 //
7 // \brief Transform y = log(1 + x). Useful for long-tailed distributions
8 // supported on x >= 0.
9 //
10 // Author: I. Volobouev
11 //
12 // April 2015
13 */
14 
15 #include <cmath>
17 
18 namespace npstat {
20  {
21  public:
23  inline virtual ~LogTransform1D() {}
24 
25  inline virtual LogTransform1D* clone() const
26  {return new LogTransform1D(*this);}
27 
28  inline double transformForward(const double x, double* dydx) const
29  {if (dydx) *dydx = 1.0/(1.0 + x); return log(1.0 + x);}
30  inline double transformBack(const double y) const {return exp(y)-1.0;}
31  inline bool isIncreasing() const {return true;}
32 
33  //@{
34  /** Prototype needed for I/O */
35  inline virtual gs::ClassId classId() const {return gs::ClassId(*this);}
36  inline virtual bool write(std::ostream&) const {return true;}
37  //@}
38 
39  static inline const char* classname()
40  {return "npstat::LogTransform1D";}
41  static inline unsigned version() {return 1;}
42  static LogTransform1D* read(const gs::ClassId& id, std::istream&);
43 
44  protected:
45  inline bool isEqual(const AbsDistributionTransform1D&) const
46  {return true;}
47 
48  private:
49  inline void setParameterChecked(unsigned, double) {}
50  inline void setAllParametersChecked(const double*) {}
51  inline double getParameterChecked(unsigned) const {return 0.0;}
52  };
53 }
54 
55 #endif // NPSTAT_LOGTRANSFORM1D_HH_
Interface definition for 1-d coordinate transformations used to build statistical distributions.
Definition: AbsDistributionTransform1D.hh:29
Definition: LogTransform1D.hh:20
virtual gs::ClassId classId() const
Definition: LogTransform1D.hh:35
double transformForward(const double x, double *dydx) const
Definition: LogTransform1D.hh:28
bool isEqual(const AbsDistributionTransform1D &) const
Definition: LogTransform1D.hh:45
virtual LogTransform1D * clone() const
Definition: LogTransform1D.hh:25
bool isIncreasing() const
Definition: LogTransform1D.hh:31
Definition: AbsArrayProjector.hh:14