CumulativeDistribution.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 - 2023 by Andrew Jameson and Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __dsp_Signal_Statistics_CumulativeDistribution_h
10 #define __dsp_Signal_Statistics_CumulativeDistribution_h
11 
12 #include "dsp/ProbabilityDensity.h"
13 #include "dsp/Romberg.h"
14 #include "ReferenceTo.h"
15 
16 namespace dsp {
17 
19  class CumulativeDistribution : public Reference::Able
20  {
21 
22  public:
23 
25  CumulativeDistribution(ProbabilityDensity* pdf = 0) { if (pdf) set_pdf(pdf); }
26 
28  void set_pdf (ProbabilityDensity* _pdf) { pdf = _pdf; }
29 
31  double operator() (double x) { return pdf->evaluate(x); }
32 
34  double cf (double x);
35  double log_cf (double x);
36  double dlog_cf (double x);
37 
39  double ccf (double x);
40  double log_ccf (double x);
41  double dlog_ccf (double x);
42 
43  typedef double argument_type;
44  typedef double return_type;
45 
46  protected:
47 
49 
50  // used to integrate the CF and/or CCF
51  Romberg<MidPoint> midpoint;
52  Romberg<> normal;
53  };
54 }
55 
56 #endif
void set_pdf(ProbabilityDensity *_pdf)
Set the probability density function.
Definition: CumulativeDistribution.h:38
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
const ScalarMath log(const ScalarMath &x)
double ccf(double x)
Return complementary cumulative function for.
Definition: CumulativeDistribution.C:18
CumulativeDistribution(ProbabilityDensity *pdf=0)
Construct with optional PDF.
Definition: CumulativeDistribution.h:35
double cf(double x)
Return cumulative function for x.
Definition: CumulativeDistribution.C:10
double operator()(double x)
Return the probability density at x.
Definition: CumulativeDistribution.h:41

Generated using doxygen 1.8.17