ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql::BaseDistribution Class Reference

Base holding the two parameters; subclasses add closed forms. More...

#include "DistributionCommon.h"

Inheritance diagram for provsql::BaseDistribution:
Collaboration diagram for provsql::BaseDistribution:

Public Member Functions

 BaseDistribution (double p1, double p2)
double p1 () const override
double p2 () const override
Public Member Functions inherited from provsql::Distribution
virtual ~Distribution ()=default
virtual bool meanIsAffine () const
 Whether mean() is an affine function of the raw parameters (p1, p2) – i.e.
virtual bool isDiscrete () const
 Whether the family is discrete (integer-valued), so a point event X = c carries positive mass.
virtual DistSupport support () const =0
 Natural support interval of X.
virtual bool integrationRange (double &lo, double &hi) const =0
 Finite window [lo, hi] covering essentially all of X's mass, for numerical quadrature.
virtual std::pair< double, double > plotRange (double trunc_lo, double trunc_hi) const =0
 Plot x-window given optional truncation bounds (±infinity means "unbounded on that side"); used by the SVG curve renderer.
virtual double sample (std::mt19937_64 &rng) const =0
 Draw one sample using the shared MC generator.
virtual std::optional< double > quantile (double p) const
 Inverse CDF \(Q(p) = F^{-1}(p)\) for \(p \in (0, 1)\).
virtual std::optional< double > truncatedRawMoment (double lo, double hi, unsigned k) const
 Closed-form raw moment \(E[X^k \mid lo < X < hi]\) of the distribution truncated to [lo, hi] (±infinity for a semi-infinite side).
virtual std::optional< std::vector< double > > sampleTruncated (std::mt19937_64 &rng, double lo, double hi, unsigned n) const
 Draw n rejection-free samples of X conditioned on lo < X < hi (±infinity for a semi-infinite side).
virtual std::optional< double > iidOrderStatMean (std::size_t n, bool isMax) const
 Closed-form mean of the max / min of n i.i.d.
virtual std::unique_ptr< Distributionaffine (double a, double b) const =0
 Closed-form location-scale transform a·X + b within the family.
std::unique_ptr< Distributionscale (double c) const
 Closed-form c·X (affine with no offset).
std::unique_ptr< Distributionnegate () const
 Closed-form -X (affine with coefficient -1).
virtual std::string serialise () const =0
 The on-disk gate_rv extra text encoding (e.g.
virtual std::optional< double > asDirac () const
 The point-mass value when the parameters make the distribution degenerate (a Dirac), std::nullopt for a proper distribution.
virtual const DistributionFamilyfamily () const =0
 The family's interned registry descriptor.
virtual double mean () const =0
 E[X].
virtual double variance () const =0
 Var(X).
virtual double rawMoment (unsigned k) const =0
 E[X^k].
virtual double pdf (double x) const =0
 f(x); NaN if the family declines
virtual double cdf (double x) const =0
 F(x); NaN if the family declines.

Protected Attributes

double p1_
double p2_

Detailed Description

Base holding the two parameters; subclasses add closed forms.

Definition at line 163 of file DistributionCommon.h.

Constructor & Destructor Documentation

◆ BaseDistribution()

provsql::BaseDistribution::BaseDistribution ( double p1,
double p2 )
inline

Definition at line 165 of file DistributionCommon.h.

Here is the call graph for this function:

Member Function Documentation

◆ p1()

double provsql::BaseDistribution::p1 ( ) const
inlineoverridevirtual

Implements provsql::Distribution.

Definition at line 166 of file DistributionCommon.h.

Here is the caller graph for this function:

◆ p2()

double provsql::BaseDistribution::p2 ( ) const
inlineoverridevirtual

Implements provsql::Distribution.

Definition at line 167 of file DistributionCommon.h.

Here is the caller graph for this function:

Member Data Documentation

◆ p1_

double provsql::BaseDistribution::p1_
protected

Definition at line 169 of file DistributionCommon.h.

◆ p2_

double provsql::BaseDistribution::p2_
protected

Definition at line 169 of file DistributionCommon.h.


The documentation for this class was generated from the following file: