.. index:: pair: namespace; gpr::numerics .. _doxid-namespacegpr_1_1numerics: namespace gpr::numerics ======================= .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block namespace numerics { // global functions double :ref:`posteriorIndeterminateBand`(double scale); bool :ref:`exceedsThreshold`(double value, double threshold); bool :ref:`withinThreshold`(double value, double threshold); bool :ref:`clearlyGreater`(double candidate, double incumbent); double :ref:`quantizeToPosteriorBand`(double value); void :ref:`perturbPosterior`(double& energy, Eigen::VectorXd& gradient); double :target:`exp`(double x); double :target:`log`(double x); double :target:`lgamma`(double x); double :target:`erf`(double x); double :target:`erfc`(double x); } // namespace numerics .. _details-namespacegpr_1_1numerics: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Functions ---------------- .. index:: pair: function; posteriorIndeterminateBand .. _doxid-namespacegpr_1_1numerics_1ab38c683d92eb12c2849e0e28d17bbce5: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: function; exceedsThreshold .. _doxid-namespacegpr_1_1numerics_1a14e7cf4ccef54668cb4f9425c2cda726: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: function; withinThreshold .. _doxid-namespacegpr_1_1numerics_1ad923272eb7b2c74439c62b95c5daf13f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool withinThreshold(double value, double threshold) Complement of ``:ref:`exceedsThreshold ``` for finite inputs: inside the threshold, including the band on its far side. .. index:: pair: function; clearlyGreater .. _doxid-namespacegpr_1_1numerics_1a950e7de090557520a41554843b0f8f45: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: function; quantizeToPosteriorBand .. _doxid-namespacegpr_1_1numerics_1a4b906dad5e054cddfe3d697957fbee02: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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. .. index:: pair: function; perturbPosterior .. _doxid-namespacegpr_1_1numerics_1a2f439e2b5217b938b2a3496701cb0035: .. ref-code-block:: cpp :class: doxyrest-title-code-block 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.