|
RandLib 2.0.0
Probability distributions, fitting, and heavy-tail tools for C++20
|
The ProbabilityDistribution class
Abstract class for all probability distributions.
More...
#include <distribution.hpp>

Public Types | |
| using | value_type = T |
Public Member Functions | |
| virtual | ~ProbabilityDistribution ()=default |
| virtual std::string | Name () const =0 |
| virtual T | MinValue () const =0 |
| virtual T | MaxValue () const =0 |
| virtual double | F (const T &x) const =0 |
| void | CumulativeDistributionFunction (std::span< const T > x, std::span< double > y) const |
| virtual double | S (const T &x) const |
| void | SurvivalFunction (std::span< const T > x, std::span< double > y) const |
| template<std::uniform_random_bit_generator G> | |
| T | operator() (G &g) const |
| Draws a variate with the given engine through the virtual interface. | |
| T | Variate () const |
| Uses the engine of this object, so it is not thread-safe for one object; use operator() with one engine per thread instead. | |
| void | Sample (std::span< T > outputData) const |
| Fills the output with variates drawn with the engine of this object. | |
| template<std::uniform_random_bit_generator G> | |
| void | Sample (G &g, std::span< T > outputData) const |
| Fills the output with variates drawn with the given engine. | |
| void | Reseed (std::uint64_t seed) |
Protected Member Functions | |
| std::string | toStringWithPrecision (const double a_value, const int n=6) const |
| ProbabilityDistribution ()=default | |
| DefaultEngine & | engine () const |
| virtual T | variate (detail::EngineRef g) const =0 |
| Every concrete distribution implements this by calling its templated operator() | |
| virtual void | sample (detail::EngineRef g, std::span< T > outputData) const |
| Fills the output with variate(g); distributions with a faster bulk algorithm override it. | |
| fit_error | fitError (FitErrorCode code, const std::string &explanation) const |
Static Protected Attributes | |
| static constexpr size_t | MAX_ITER_REJECTION = detail::MAX_ITER_REJECTION |
| MAX_ITER_REJECTION upper boundary for maximum amount of iterations in rejection methods one thousand should be enough to be sure there is a bug (or rejection method is too slow to be used) | |
| static constexpr char | POSITIVITY_VIOLATION [] = "All elements should be positive" |
| static constexpr char | NON_NEGATIVITY_VIOLATION [] = "All elements should be non-negative" |
| static constexpr char | UPPER_LIMIT_VIOLATION [] = "No element should be greater than " |
| static constexpr char | LOWER_LIMIT_VIOLATION [] = "No element should be smaller than " |
The ProbabilityDistribution class
Abstract class for all probability distributions.
| using randlib::ProbabilityDistribution< T >::value_type = T |
|
protecteddefault |
|
virtualdefault |
| void randlib::ProbabilityDistribution< T >::CumulativeDistributionFunction | ( | std::span< const T > | x, |
| std::span< double > | y | ||
| ) | const |
| x | input vector |
| y | output vector: y = P(X ≤ x) |
|
inlineprotected |
|
pure virtual |
| x |
|
protected |
| code | reason of the failure |
| explanation | details |
|
pure virtual |
Implemented in randlib::BetaDistribution< RealType >, randlib::BetaDistribution< double >, randlib::BetaPrimeRand< RealType >, randlib::CauchyRand< RealType >, randlib::DegenerateRand, randlib::ExponentiallyModifiedGaussianRand< RealType >, randlib::FisherFRand< RealType >, randlib::FrechetRand< RealType >, randlib::GammaDistribution< RealType >, randlib::GammaDistribution< double >, randlib::GammaDistribution< float >, randlib::GeneralizedExtremeValueRand< RealType >, randlib::GeneralizedParetoRand< RealType >, randlib::GeneralGeometricStableDistribution< RealType >, randlib::GumbelRand< RealType >, randlib::InverseGammaRand< RealType >, randlib::InverseGaussianRand< RealType >, randlib::IrwinHallRand< RealType >, randlib::KolmogorovSmirnovRand< RealType >, randlib::LogNormalRand< RealType >, randlib::LogStableRand< RealType >, randlib::LogisticRand< RealType >, randlib::MarchenkoPasturRand< RealType >, randlib::NakagamiDistribution< RealType >, randlib::NoncentralChiSquaredRand< RealType >, randlib::NoncentralTRand< RealType >, randlib::ParetoRand< RealType >, randlib::ParetoRand< double >, randlib::PlanckRand< RealType >, randlib::RaisedCosineDistribution< RealType >, randlib::RiceRand< RealType >, randlib::SechRand< RealType >, randlib::StableDistribution< RealType >, randlib::StableCountRand< RealType >, randlib::StudentTRand< RealType >, randlib::TriangularRand< RealType >, randlib::UniformRand< RealType >, randlib::WeibullRand< RealType >, randlib::WignerSemicircleRand< RealType >, randlib::BivariateDistribution< T1, T2, T >, randlib::BivariateDistribution< BinomialRand< IntType >, BinomialRand< IntType >, IntType >, randlib::BivariateDistribution< NormalRand< RealType >, NormalRand< RealType >, RealType >, randlib::BivariateDistribution< StudentTRand< RealType >, InverseGammaRand< RealType >, RealType >, randlib::BivariateDistribution< T1, T2, IntType >, randlib::BivariateDistribution< T1, T2, RealType >, randlib::CircularDistribution< RealType >, randlib::BetaBinomialRand< IntType >, randlib::BinomialDistribution< IntType >, randlib::BinomialDistribution< int >, randlib::CategoricalRand< IntType >, randlib::HyperGeometricRand< IntType >, randlib::LogarithmicRand< IntType >, randlib::NegativeBinomialDistribution< IntType, T >, randlib::NegativeHyperGeometricRand< IntType >, randlib::PoissonRand< IntType >, randlib::PoissonRand< int >, randlib::RademacherRand, randlib::SkellamRand< IntType >, randlib::UniformDiscreteRand< IntType >, randlib::YuleRand< IntType >, randlib::ZetaRand< IntType >, randlib::ZetaRand< long long int >, randlib::ZipfRand< IntType >, and randlib::CantorRand.
|
pure virtual |
Implemented in randlib::BetaDistribution< RealType >, randlib::BetaDistribution< double >, randlib::BetaPrimeRand< RealType >, randlib::CauchyRand< RealType >, randlib::DegenerateRand, randlib::ExponentiallyModifiedGaussianRand< RealType >, randlib::FisherFRand< RealType >, randlib::FrechetRand< RealType >, randlib::GammaDistribution< RealType >, randlib::GammaDistribution< double >, randlib::GammaDistribution< float >, randlib::GeneralizedExtremeValueRand< RealType >, randlib::GeneralizedParetoRand< RealType >, randlib::GeneralGeometricStableDistribution< RealType >, randlib::GumbelRand< RealType >, randlib::InverseGammaRand< RealType >, randlib::InverseGaussianRand< RealType >, randlib::IrwinHallRand< RealType >, randlib::KolmogorovSmirnovRand< RealType >, randlib::LogNormalRand< RealType >, randlib::LogStableRand< RealType >, randlib::LogisticRand< RealType >, randlib::MarchenkoPasturRand< RealType >, randlib::NakagamiDistribution< RealType >, randlib::NoncentralChiSquaredRand< RealType >, randlib::NoncentralTRand< RealType >, randlib::ParetoRand< RealType >, randlib::ParetoRand< double >, randlib::PlanckRand< RealType >, randlib::RaisedCosineDistribution< RealType >, randlib::RiceRand< RealType >, randlib::SechRand< RealType >, randlib::StableDistribution< RealType >, randlib::StableCountRand< RealType >, randlib::StudentTRand< RealType >, randlib::TriangularRand< RealType >, randlib::UniformRand< RealType >, randlib::WeibullRand< RealType >, randlib::WignerSemicircleRand< RealType >, randlib::BivariateDistribution< T1, T2, T >, randlib::BivariateDistribution< BinomialRand< IntType >, BinomialRand< IntType >, IntType >, randlib::BivariateDistribution< NormalRand< RealType >, NormalRand< RealType >, RealType >, randlib::BivariateDistribution< StudentTRand< RealType >, InverseGammaRand< RealType >, RealType >, randlib::BivariateDistribution< T1, T2, IntType >, randlib::BivariateDistribution< T1, T2, RealType >, randlib::CircularDistribution< RealType >, randlib::BetaBinomialRand< IntType >, randlib::BinomialDistribution< IntType >, randlib::BinomialDistribution< int >, randlib::CategoricalRand< IntType >, randlib::HyperGeometricRand< IntType >, randlib::LogarithmicRand< IntType >, randlib::NegativeBinomialDistribution< IntType, T >, randlib::NegativeHyperGeometricRand< IntType >, randlib::PoissonRand< IntType >, randlib::PoissonRand< int >, randlib::RademacherRand, randlib::SkellamRand< IntType >, randlib::UniformDiscreteRand< IntType >, randlib::YuleRand< IntType >, randlib::ZetaRand< IntType >, randlib::ZetaRand< long long int >, randlib::ZipfRand< IntType >, and randlib::CantorRand.
|
pure virtual |
Implemented in randlib::BivariateNormalRand< RealType >, randlib::NormalInverseGammaRand< RealType >, randlib::TrinomialRand< IntType >, randlib::VonMisesRand< RealType >, randlib::WrappedExponentialRand< RealType >, randlib::BetaRand< RealType >, randlib::BetaRand< double >, randlib::ArcsineRand< RealType >, randlib::BaldingNicholsRand< RealType >, randlib::BetaPrimeRand< RealType >, randlib::CauchyRand< RealType >, randlib::DegenerateRand, randlib::ExponentialRand< RealType >, randlib::ExponentiallyModifiedGaussianRand< RealType >, randlib::FisherFRand< RealType >, randlib::FrechetRand< RealType >, randlib::GammaRand< RealType >, randlib::GammaRand< double >, randlib::GammaRand< float >, randlib::ChiSquaredRand< RealType >, randlib::ErlangRand< RealType >, randlib::GeneralizedExtremeValueRand< RealType >, randlib::GeneralizedParetoRand< RealType >, randlib::GeometricStableRand< RealType >, randlib::GumbelRand< RealType >, randlib::InverseGammaRand< RealType >, randlib::InverseGaussianRand< RealType >, randlib::IrwinHallRand< RealType >, randlib::KolmogorovSmirnovRand< RealType >, randlib::CenteredAsymmetricLaplaceRand< RealType >, randlib::AsymmetricLaplaceRand< RealType >, randlib::LaplaceRand< RealType >, randlib::LevyRand< RealType >, randlib::LogNormalRand< RealType >, randlib::LogStableRand< RealType >, randlib::LogisticRand< RealType >, randlib::MarchenkoPasturRand< RealType >, randlib::NakagamiRand< RealType >, randlib::ChiRand< RealType >, randlib::MaxwellBoltzmannRand< RealType >, randlib::RayleighRand< RealType >, randlib::NoncentralChiSquaredRand< RealType >, randlib::NoncentralTRand< RealType >, randlib::NormalRand< RealType >, randlib::ParetoRand< RealType >, randlib::ParetoRand< double >, randlib::PlanckRand< RealType >, randlib::RaisedCosineRand< RealType >, randlib::RaabGreenRand< RealType >, randlib::RiceRand< RealType >, randlib::SechRand< RealType >, randlib::StableRand< RealType >, randlib::HoltsmarkRand< RealType >, randlib::LandauRand< RealType >, randlib::StableCountRand< RealType >, randlib::StudentTRand< RealType >, randlib::TriangularRand< RealType >, randlib::UniformRand< RealType >, randlib::WeibullRand< RealType >, randlib::WignerSemicircleRand< RealType >, randlib::BernoulliRand, randlib::BetaBinomialRand< IntType >, randlib::BinomialRand< IntType >, randlib::CategoricalRand< IntType >, randlib::GeometricRand< IntType >, randlib::GeometricRand< int >, randlib::HyperGeometricRand< IntType >, randlib::LogarithmicRand< IntType >, randlib::NegativeBinomialRand< IntType, T >, randlib::NegativeHyperGeometricRand< IntType >, randlib::PoissonRand< IntType >, randlib::PoissonRand< int >, randlib::RademacherRand, randlib::SkellamRand< IntType >, randlib::UniformDiscreteRand< IntType >, randlib::YuleRand< IntType >, randlib::ZetaRand< IntType >, randlib::ZetaRand< long long int >, randlib::ZipfRand< IntType >, and randlib::CantorRand.
|
inline |
Draws a variate with the given engine through the virtual interface.
Concrete distribution classes hide it with a fully templated version, which is faster.
| g | any uniform random bit generator, such as std::mt19937 or DefaultEngine |
|
inline |
| seed | seed of the engine of this object |
|
virtual |
| x |
|
inlineprotectedvirtual |
Fills the output with variate(g); distributions with a faster bulk algorithm override it.
| g | engine |
| outputData |
|
inline |
Fills the output with variates drawn with the given engine.
| g | any uniform random bit generator |
| outputData |
|
inline |
Fills the output with variates drawn with the engine of this object.
| outputData |
| void randlib::ProbabilityDistribution< T >::SurvivalFunction | ( | std::span< const T > | x, |
| std::span< double > | y | ||
| ) | const |
| x | input vector |
| y | output vector: y = P(X > x) |
|
protected |
|
inline |
Uses the engine of this object, so it is not thread-safe for one object; use operator() with one engine per thread instead.
|
protectedpure virtual |
Every concrete distribution implements this by calling its templated operator()
| g | engine |
|
staticconstexprprotected |
|
staticconstexprprotected |
MAX_ITER_REJECTION upper boundary for maximum amount of iterations in rejection methods one thousand should be enough to be sure there is a bug (or rejection method is too slow to be used)
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |