ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
PivotIntegration.h File Reference

Shared 1-D quadrature core for the pivot-conjunction and order-statistic closed forms. More...

#include <cmath>
#include <limits>
#include <optional>
Include dependency graph for PivotIntegration.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  provsql

Functions

template<typename F>
double provsql::simpsonIntegrate (double lo, double hi, int N, F &&f)
 Composite-Simpson \(\int_{lo}^{hi} f(x)\,dx\) with N panels.
double provsql::binomial (unsigned n, unsigned k)
 Binomial coefficient \(\binom{n}{k}\) as a double (exact for the small orders the moment expansions use).
template<typename Raw>
std::optional< double > provsql::centralFromRaw (unsigned k, Raw &&raw)
 Central moment of order k from a raw-moment closure: \(E[(X-\mu)^k] = \sum_{i=0}^{k} \binom{k}{i} (-\mu)^{k-i} E[X^i]\).

Variables

constexpr int provsql::kSimpsonPanels = 4000
 Panel count shared by every composite-Simpson quadrature over a distribution's integration range: exact for the low-degree polynomial integrands of the Uniform cases, high-accuracy otherwise.

Detailed Description

Shared 1-D quadrature core for the pivot-conjunction and order-statistic closed forms.

The exact evaluators for guard-partition shapes all reduce to the same one-dimensional integral over a pivot RV's support — the layer-cake order-statistic means, the RV-vs-RV conditional moments, the pivot-conjunction moments \(\int x^k f_X \prod_j W_j\,dx\) in src/Expectation.cpp, and the analytic \(2^k\) joint table over a shared-pivot island in src/HybridEvaluator.cpp. This header holds the numeric core they share: the composite-Simpson driver (with the common NaN-aborts-to-NaN convention, so an undefined density/CDF makes the caller decline to Monte Carlo), the panel-count constant, the binomial helper, and the central-moment binomial expansion over a raw-moment closure.

Definition in file PivotIntegration.h.