ScalingRootFinder Class Reference#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
Bracketed root find accelerated by the critical scaling of the observable. More...
#include <root_finding.hh>
Classes | |
| struct | Counts |
Public Types | |
| enum class | Acceptance { AtTarget , BelowTarget } |
| What counts as an answer. More... | |
Public Member Functions | |
| ScalingRootFinder (FUN f, const double target, const double rel_tol=1e-3, const uint max_iter=40) | |
| ScalingRootFinder (FUN_NO_RESIDUAL f, const double target, const double rel_tol=1e-3, const uint max_iter=40) | |
| double | search () |
Bracket | |
The bounds are hypotheses by default: if they turn out not to straddle, the search widens them geometrically instead of throwing, which is what makes one set of bounds usable across models whose critical points differ by orders of magnitude. | |
| void | set_bounds (const double x_lo, const double x_hi) |
| void | set_bounds_are_hypotheses (const bool v) |
| void | set_expansion_factor (const double rho) |
| void | set_expansion_max_iter (const uint n) |
Stopping | |
| void | set_rel_tol (const double v) |
| void | set_one_sided (const bool v) |
| void | set_acceptance (const Acceptance a) |
| void | set_aim_fraction (const double v) |
| void | set_x_rel_floor (const double v) |
| Bracket width, relative to the magnitude of the bounds, below which the search gives up. | |
| void | set_max_iter (const uint v) |
Model trust windows | |
The power law is asymptotic. Fitting points from outside its window does not degrade gracefully – it returns a confident, badly wrong critical point that sits inside the bracket, where the containment safeguard cannot catch it. These windows are load-bearing. | |
| void | set_obs_window (const double v) |
| Fit only points with obs <= window * target. Ignored when target == 0. | |
| void | set_residual_window (const double v) |
| void | set_exponent_bounds (const double lo, const double hi) |
| void | set_theta_bounds (const double lo, const double hi) |
| void | set_endpoint_standoff (const double v) |
| Fraction of the bracket width kept clear of either endpoint when clamping a proposal. | |
| void | set_approach_factor (const double v) |
| Fraction of the remaining distance to the critical point kept per approach step. | |
| void | seed_exponent (const double beta) |
Results | |
| double | get_obs () const |
| double | get_x_critical () const |
| double | get_exponent () const |
| double | get_theta () const |
| bool | have_model () const |
| double | get_x_extrapolated () const |
| Model extrapolation of the target point. NaN when no model was ever trusted. | |
| bool | converged () const |
| uint | get_iter () const |
| double | bracket_width () const |
| Live bracket width; infinite until both sides are known. | |
| const std::vector< std::pair< double, double > > & | successes () const |
| const std::vector< std::pair< double, double > > & | failures () const |
| Counts | get_counts () const |
Protected Types | |
| using | FUN = std::function<bool(const double, double &, double &)> |
| using | FUN_NO_RESIDUAL = std::function<bool(const double, double &)> |
| Compatibility shape matching BisectionRootFinderTarget. Disables the divergent-branch model. | |
Protected Member Functions | |
| double | effective_target () const |
| double | extrapolate (const double x_c) const |
| x at which the model predicts obs == effective_target(), given a critical point. | |
| void | refit () |
| void | fit_convergent () |
| Refit from the three convergent points closest to criticality (smallest obs). | |
| void | fit_divergent () |
| Refit from the three divergent points closest to criticality (largest residual). | |
| double | propose () |
| Propose the next x. | |
| void | record (double x, bool ok, double obs, double residual) |
| Record a probe outcome and update the bracket. | |
Static Protected Member Functions | |
| static std::array< std::size_t, 3 > | select_triple (const std::size_t) |
| The three candidates closest to criticality, out of n sorted by distance to it. | |
Protected Attributes | |
| FUN | f |
| double | target |
| double | rel_tol |
| uint | max_iter |
| double | x_lo_init = NAN |
| double | x_hi_init = NAN |
| bool | bounds_are_hypotheses = true |
| double | expansion_factor = 2. |
| uint | expansion_max_iter = 24 |
| bool | one_sided = true |
| Acceptance | acceptance = Acceptance::AtTarget |
| double | aim_fraction = 0.5 |
| bool | answer_found = false |
| double | x_rel_floor = 1e-13 |
| double | obs_window = 20. |
| double | residual_window = 0. |
| double | beta_min = 0.02 |
| double | beta_max = 5. |
| double | theta_min = 0.5 |
| double | theta_max = 8. |
| double | endpoint_standoff = 0.02 |
| double | approach_factor = 0.1 |
| double | seeded_exponent = NAN |
| double | x_lo_soft = -std::numeric_limits<double>::infinity() |
| double | x_lo_hard = -std::numeric_limits<double>::infinity() |
| double | x_hi = std::numeric_limits<double>::infinity() |
| std::vector< std::pair< double, double > > | S |
| (x, obs) for every finite evaluation | |
| std::vector< std::pair< double, double > > | F |
| (x, residual) for every informative failure | |
| bool | model_valid = false |
| double | model_x_c = NAN |
| double | model_beta = NAN |
| double | model_log_C = NAN |
| double | model_theta = NAN |
| double | model_x_c_prev = NAN |
| bool | divergent_valid = false |
| double | divergent_x_c = NAN |
| double | divergent_shift = NAN |
| double | best_x = NAN |
| double | best_obs = NAN |
| bool | have_success = false |
| bool | m_converged = false |
| uint | iter = 0 |
| Counts | counts |
| double | w_prev = std::numeric_limits<double>::infinity() |
| double | w_prevprev = std::numeric_limits<double>::infinity() |
| bool | probed_hi_init = false |
| bool | probed_lo_init = false |
| uint | expansions = 0 |
| double | w_init = NAN |
Detailed Description
Bracketed root find accelerated by the critical scaling of the observable.
Solves obs(x) == target where obs is smooth and monotone on the convergent side of a critical point x_c < x, obeying obs = C (x - x_c)^beta, and where probes below x_c fail but expose a residual that grows as x_c is approached, r(x) = a - ln(x_c - x)/theta. Neither exponent is assumed; both are fitted from three points, and the same solve serves both branches (the divergent one via x -> -x, y -> exp(-r), which is why only the residual differences ever enter and no exponentials are formed).
Every model-based proposal is bracket-safeguarded Brent-style, so a wrong model costs at most a factor two over plain bisection and can never move the answer.
The callback reports three outcomes, not two:
- returns true and writes a finite
obs:a usable evaluation. Whether it lies above or below the target is the finder's business, not the callback's. - returns false and writes a finite
residual:the evaluation ran away; the residual says how far it got. - returns false and writes nothing: it failed some other way and carries no information beyond its own x. Both
obsandresidualare NaN-initialised before every call, so "wrote nothing" needs no separate signal.
Member Typedef Documentation
◆ FUN
|
protected |
◆ FUN_NO_RESIDUAL
|
protected |
Compatibility shape matching BisectionRootFinderTarget. Disables the divergent-branch model.
Member Enumeration Documentation
◆ Acceptance
|
strong |
What counts as an answer.
AtTarget converges obs onto the target to within rel_tol. BelowTarget accepts the first evaluation that lands anywhere strictly between the critical point and the target crossing, which is a far easier thing to hit: on a cold Yang-Mills tune that interval is ~600x wider in the search variable than the AtTarget window, i.e. about nine bisections cheaper, and it lets a merely decent fit succeed on its first attempt instead of being refined until it is accurate to rel_tol.
| Enumerator | |
|---|---|
| AtTarget | |
| BelowTarget | |
Constructor & Destructor Documentation
◆ ScalingRootFinder() [1/2]
|
inline |
◆ ScalingRootFinder() [2/2]
|
inline |
Member Function Documentation
◆ bracket_width()
|
inline |
Live bracket width; infinite until both sides are known.
◆ converged()
|
inline |
◆ effective_target()
|
inlineprotected |
The value actually aimed at. With one-sided acceptance the admissible window is [target, target(1+rel_tol)]; aiming at its centre rather than its lower edge keeps rounding in the extrapolation from landing just below and costing an extra evaluation.
◆ extrapolate()
|
inlineprotected |
x at which the model predicts obs == effective_target(), given a critical point.
◆ failures()
|
inline |
◆ fit_convergent()
|
inlineprotected |
Refit from the three convergent points closest to criticality (smallest obs).
◆ fit_divergent()
|
inlineprotected |
Refit from the three divergent points closest to criticality (largest residual).
◆ get_counts()
|
inline |
◆ get_exponent()
|
inline |
◆ get_iter()
|
inline |
◆ get_obs()
|
inline |
◆ get_theta()
|
inline |
◆ get_x_critical()
|
inline |
Best available critical point: the convergent fit when it is trusted, otherwise the divergent one, which is usable much further from criticality.
◆ get_x_extrapolated()
|
inline |
Model extrapolation of the target point. NaN when no model was ever trusted.
◆ have_model()
|
inline |
◆ propose()
|
inlineprotected |
Propose the next x.
◆ record()
|
inlineprotected |
Record a probe outcome and update the bracket.
◆ refit()
|
inlineprotected |
Refit both branches. Called exactly once per evaluation, so that the consecutive-fit agreement test sees successive iterations rather than successive calls.
◆ search()
|
inline |
◆ seed_exponent()
|
inline |
Seed the exponent from a nearby earlier search (another simplex step, a coarser fidelity). Exponents are far more portable than amplitudes; do not seed the latter.
◆ select_triple()
|
inlinestaticprotected |
The three candidates closest to criticality, out of n sorted by distance to it.
Spreading the triple across the whole admissible range is better conditioned in principle – a bisecting search leaves the closest points tightly clustered – but measures worse: the far points are not asymptotic enough, the fit is rejected outright more often, and a cold SP tune stopped converging inside its budget. Both laws are asymptotic, so the fit stays in the asymptote.
◆ set_acceptance()
|
inline |
◆ set_aim_fraction()
|
inline |
Where inside (0, target) to aim in BelowTarget mode, as a fraction of the target. Aiming at the midpoint rather than just under the crossing leaves room for the fit to be wrong in either direction without either overshooting into the divergent region or missing.
◆ set_approach_factor()
|
inline |
Fraction of the remaining distance to the critical point kept per approach step.
◆ set_bounds()
|
inline |
◆ set_bounds_are_hypotheses()
|
inline |
◆ set_endpoint_standoff()
|
inline |
Fraction of the bracket width kept clear of either endpoint when clamping a proposal.
◆ set_expansion_factor()
|
inline |
◆ set_expansion_max_iter()
|
inline |
◆ set_exponent_bounds()
|
inline |
◆ set_max_iter()
|
inline |
◆ set_obs_window()
|
inline |
Fit only points with obs <= window * target. Ignored when target == 0.
◆ set_one_sided()
|
inline |
Accept only probes at or above the target. Keeps the answer on the safe side of the critical point at a cost of at most one extra evaluation. AtTarget mode only.
◆ set_rel_tol()
|
inline |
◆ set_residual_window()
|
inline |
Fit only failures whose residual is at least this large. Defaults to 0 (fit any three), because only the caller knows the residual's scale.
◆ set_theta_bounds()
|
inline |
Bounds on the divergent-branch exponent. theta is an inverse unstable RG eigenvalue and sits near the tuned parameter's mass dimension – 2 for a mass squared, measured 1.92 on a cold Yang-Mills tune – so it is far more tightly constrained a priori than beta.
◆ set_x_rel_floor()
|
inline |
Bracket width, relative to the magnitude of the bounds, below which the search gives up.
◆ successes()
|
inline |
Member Data Documentation
◆ acceptance
|
protected |
◆ aim_fraction
|
protected |
◆ answer_found
|
protected |
◆ approach_factor
|
protected |
◆ best_obs
|
protected |
◆ best_x
|
protected |
◆ beta_max
|
protected |
◆ beta_min
|
protected |
◆ bounds_are_hypotheses
|
protected |
◆ counts
|
protected |
◆ divergent_shift
|
protected |
◆ divergent_valid
|
protected |
◆ divergent_x_c
|
protected |
◆ endpoint_standoff
|
protected |
◆ expansion_factor
|
protected |
◆ expansion_max_iter
|
protected |
◆ expansions
|
protected |
◆ F
|
protected |
(x, residual) for every informative failure
◆ f
|
protected |
◆ have_success
|
protected |
◆ iter
|
protected |
◆ m_converged
|
protected |
◆ max_iter
|
protected |
◆ model_beta
|
protected |
◆ model_log_C
|
protected |
◆ model_theta
|
protected |
◆ model_valid
|
protected |
◆ model_x_c
|
protected |
◆ model_x_c_prev
|
protected |
◆ obs_window
|
protected |
◆ one_sided
|
protected |
◆ probed_hi_init
|
protected |
◆ probed_lo_init
|
protected |
◆ rel_tol
|
protected |
◆ residual_window
|
protected |
◆ S
|
protected |
(x, obs) for every finite evaluation
◆ seeded_exponent
|
protected |
◆ target
|
protected |
◆ theta_max
|
protected |
◆ theta_min
|
protected |
◆ w_init
|
protected |
◆ w_prev
|
protected |
◆ w_prevprev
|
protected |
◆ x_hi
|
protected |
◆ x_hi_init
|
protected |
◆ x_lo_hard
|
protected |
◆ x_lo_init
|
protected |
◆ x_lo_soft
|
protected |
◆ x_rel_floor
|
protected |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/root_finding.hh
Generated by