Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
GaussianMarginal.h
Go to the documentation of this file.
1#ifndef STANDARD_NORMAL_H
2#define STANDARD_NORMAL_H
3
4#include <random>
5
7#include "AbstractConfig.h"
8#include "Math.h"
9
26using gsl_rng_sptr = std::unique_ptr<gsl_rng, decltype(&gsl_rng_free)>;
27
33 double mu {0.};
34 double sigma {1.};
35
38
44 GaussianMarginalCfg(double mu, double sigma) : mu(mu), sigma(sigma) {}
45};
46
65class GaussianMarginal final : public IMarginalDistribution {
66public:
74 explicit GaussianMarginal(double mu, double sigma, unsigned int seed = std::random_device{}());
75
77 std::vector<double> rvs(std::size_t n) override;
78
80 double logpdf(double x) override;
81
82 PDFDiff f_df_ddf(double x) override;
83
85 double cdf(double x) override;
86
88 double ppf(double p) override;
89
91 double mean() override;
92
94 double std() override;
95
96private:
97 double mu, sigma;
98 const gsl_rng_type* rng_tp {gsl_rng_mt19937};
99 gsl_rng_sptr eng_{gsl_rng_alloc(rng_tp), &gsl_rng_free};
100};
101
102#endif
Base type for lightweight configuration structures.
std::unique_ptr< gsl_rng, decltype(&gsl_rng_free)> gsl_rng_sptr
Interface for one-dimensional marginal probability distributions.
One-dimensional Gaussian marginal distribution.
PDFDiff f_df_ddf(double x) override
double std() override
Returns the mean of the distribution.
double cdf(double x) override
Evaluates the cumulative distribution function at x.
double ppf(double p) override
Evaluates the quantile function (inverse CDF).
std::vector< double > rvs(std::size_t n) override
Draws random samples from the marginal distribution.
double logpdf(double x) override
Evaluates the logarithm of the probability density at x.
double mean() override
Returns the mean of the distribution.
Polymorphic base class for configuration types.
Configuration object for GaussianMarginal.
GaussianMarginalCfg(double mu, double sigma)
Constructs a Gaussian configuration.
double sigma
Mean of the Gaussian distribution.
GaussianMarginalCfg()=default
Standard deviation of the Gaussian distribution.
Abstract interface for scalar marginal distributions.