namespace gpr::numerics¶
Overview¶
namespace numerics {
// global functions
double posteriorIndeterminateBand(double scale);
bool exceedsThreshold(double value, double threshold);
bool withinThreshold(double value, double threshold);
bool clearlyGreater(double candidate, double incumbent);
double quantizeToPosteriorBand(double value);
void perturbPosterior(double& energy, Eigen::VectorXd& gradient);
double exp(double x);
double log(double x);
double lgamma(double x);
double erf(double x);
double erfc(double x);
} // namespace numerics
Detailed Documentation¶
Global Functions¶
double posteriorIndeterminateBand(double scale)
Half-width of the indeterminate band on a posterior-derived comparison.
sqrt(eps) is the finite-difference step already used to probe the hyperparameter objective. A gap smaller than that fraction of the scale is the rounding of the probe, not a new discrete action. The scale is the threshold (or the larger of the two scores); it is not a tolerance fitted to a reaction.
bool exceedsThreshold(double value, double threshold)
True only when value clears threshold by more than the band. A last-bit overshoot does not open a drift break, a refit, or an acquisition. Non-finite inputs do not.
bool withinThreshold(double value, double threshold)
Complement of exceedsThreshold for finite inputs: inside the threshold, including the band on its far side.
bool clearlyGreater(double candidate, double incumbent)
Strict argmax with a scale-aware tie. The lower index keeps the incumbent unless candidate is larger by more than the band of the larger magnitude. +inf beats a finite incumbent; NaN does not.
double quantizeToPosteriorBand(double value)
Snap a posterior component onto the indeterminate band.
A relative perturbation smaller than sqrt(eps) — the harness uses 1e-12 — cannot leave the bin except exactly on its edge. The search then sees one posterior, not a last-bit family of them.
void perturbPosterior(double& energy, Eigen::VectorXd& gradient)
Multiply a posterior energy and gradient by 1 ± amplitude, then snap both onto the band so the sign draw is invisible to the search.
GPR_POSTERIOR_RELATIVE_NOISE is the amplitude (the harness uses 1e-12). GPR_POSTERIOR_NOISE_SEED selects the sign sequence. Unset amplitude leaves the posterior unchanged. The sequence is deterministic for a seed and resets with the process.