|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
Specifies some necessaries for AMP style endgame implementations, which differ from the fixed precision ones. More...
#include <amp_endgame.hpp>
Public Types | |
| using | TrackerT = tracking::AMPTracker |
| The path-tracker type. | |
| using | EmitterType = AMPEndgame |
| The event-emitter type. | |
| using | TrackerType |
| The path-tracker type. | |
Public Member Functions | |
| SuccessCode | RefineSampleImpl (Vec< complex_mp > &result, Vec< complex_mp > const ¤t_sample, complex_mp const ¤t_time, NumErrorT tol, unsigned max_iterations) const |
| Refine a single sample point, escalating precision if Newton refinement needs it. | |
| SuccessCode | RefineSampleImpl (Vec< complex_dbl > &result, Vec< complex_dbl > const ¤t_sample, complex_dbl const ¤t_time, NumErrorT tol, unsigned max_iterations) const |
| Hardware-double fast-lane refine for the adaptive-numeric-type (double-first) endgame. | |
| unsigned | NextEscalatedPrecision () const |
| Return the next (higher) precision to escalate to, following the tracker's authority and strictly above the current precision. | |
| template<typename TimesTuple> | |
| void | CrossTimesUp (TimesTuple ×, unsigned newprec) const |
| Widen a times container's complex_dbl slot into the complex_mp slot at the new precision. | |
| template<typename SampsTuple> | |
| void | CrossSampsUp (SampsTuple &samps, unsigned newprec) const |
| Widen a samples container's complex_dbl slot into the complex_mp slot at the new precision. | |
| template<typename VecTuple> | |
| void | CrossVecUp (VecTuple &vec, unsigned newprec) const |
| Widen a vector container's complex_dbl slot into the complex_mp slot at the new precision. | |
| Vec< complex_dbl > | DowncastToDouble (Vec< complex_mp > const &v) const |
| Convert an mp vector down to the hardware complex_dbl fast lane. | |
| complex_mp | AtActivePrecisionScalar (complex_mp const &x) const |
| Copy a complex_mp scalar set to the endgame's active working precision. | |
| Vec< complex_mp > | AtActivePrecisionVec (Vec< complex_mp > const &v) const |
| Copy a complex_mp vector set to the endgame's active working precision. | |
| template<typename ComplexT> | |
| Vec< complex_mp > | ToBCT (Vec< ComplexT > const &v, unsigned prec) const |
| Widen a vector to the boundary complex type (complex_mp) at the given precision. | |
| AMPEndgame (TrackerT const &new_tracker) | |
| Construct the AMP endgame precision policy for a tracker. | |
| virtual | ~AMPEndgame ()=default |
| void | SetTracker (tracking::AMPTracker const &new_tracker) |
| Tell the endgame to use the given tracker. | |
| const tracking::AMPTracker & | GetTracker () const |
| Getter for the tracker used inside an instance of the endgame. | |
| const System & | GetSystem () const |
| Get the system being tracked on, which is referred to by the tracker. | |
| void | ChangePrecision (unsigned p) |
| Change the working precision of the underlying tracker. | |
| void | AddObserver (AnyObserver &new_observer) const |
| Add an observer (non-owning) to observe this observable. | |
| void | AddObserver (std::shared_ptr< AnyObserver > const &new_observer) const |
| Add an observer whose lifetime is co-owned by this observable. | |
| void | RemoveObserver (AnyObserver &observer) const |
| Remove an observer from this observable. | |
| virtual bool | ObservableIsA (std::type_index t) const |
| Whether this observable may be observed as the given type. | |
Static Public Member Functions | |
| template<typename... T> | |
| static unsigned | EnsureAtUniformPrecision (T &...args) |
| Bring a set of values to a common (highest) precision. | |
| static void | EnsureAtPrecision (double &, unsigned prec) |
| No-op precision check for a double (throws if asked for non-double precision). | |
| static void | EnsureAtPrecision (std::complex< double > &, unsigned prec) |
| No-op precision check for a std::complex<double> (throws if asked for non-double precision). | |
| static void | EnsureAtPrecision (real_mp &obj, unsigned prec) |
| Set a multiprecision real to the given precision. | |
| static void | EnsureAtPrecision (complex_mp &obj, unsigned prec) |
| Set a multiprecision complex to the given precision. | |
Public Attributes | |
| unsigned | current_endgame_precision_ = DoublePrecision() |
| The endgame's current working precision (double = fast lane, higher = mpfr slot). | |
| bool | adaptive_numeric_type_active_ = false |
| When true, the double-first adaptive-numeric-type lane is armed. | |
Protected Member Functions | |
| void | NotifyObservers (AnyEvent const &e) const |
| Sends an event to observers that subscribed to its exact dynamic type, then to all catch-all (untyped) observers. | |
| void | NotifyObservers (AnyEvent &e) const |
| Notify all observers of a (mutable) event. | |
| bool | HasObservers () const |
| Whether anyone is currently observing (conservative). | |
Specifies some necessaries for AMP style endgame implementations, which differ from the fixed precision ones.
The event-emitter type.
The path-tracker type.
|
inherited |
The path-tracker type.
|
inlineexplicit |
Construct the AMP endgame precision policy for a tracker.
|
virtualdefault |
|
inlineinherited |
Add an observer (non-owning) to observe this observable.
Stores only a raw reference: the caller is responsible for keeping the observer alive while it is attached. This is the right overload for stack-allocated C++ observers added and removed within a scope. For an observer whose lifetime you would rather have tracked, see the shared_ptr overload.
Observers that override SubscribedEventTypes() with a non-empty list are registered in a type-indexed map so NotifyObservers only calls them for events they declared interest in. Observers returning an empty list (the default) are placed in a catch-all list and receive every event.
Safe to call from inside an observer's Observe() (i.e. during a notification): the add is deferred and applied once the current notification loop finishes. This is what lets a "meta-observer" attach new observers in response to events.
| IncompatibleObserver | if the observer's ObservedKind() is not one this observable can be observed as. |
|
inlineinherited |
Add an observer whose lifetime is co-owned by this observable.
The observable keeps a shared_ptr, so the observer stays alive (and keeps receiving events) for as long as it is attached, even after the caller drops their own reference — "attach it and forget it", with no dangling. It is released when RemoveObserver is called or this observable is destroyed. (Stack-allocated C++ observers can't be shared_ptr-owned; use the reference overload for those.)
| IncompatibleObserver | if incompatible (see the reference overload). |
|
inline |
Copy a complex_mp scalar set to the endgame's active working precision.
|
inline |
Copy a complex_mp vector set to the endgame's active working precision.
|
inlineinherited |
Change the working precision of the underlying tracker.
|
inline |
Widen a samples container's complex_dbl slot into the complex_mp slot at the new precision.
|
inline |
Widen a times container's complex_dbl slot into the complex_mp slot at the new precision.
|
inline |
Widen a vector container's complex_dbl slot into the complex_mp slot at the new precision.
|
inline |
Convert an mp vector down to the hardware complex_dbl fast lane.
|
inlinestatic |
Set a multiprecision complex to the given precision.
|
inlinestatic |
No-op precision check for a double (throws if asked for non-double precision).
|
inlinestatic |
Set a multiprecision real to the given precision.
|
inlinestatic |
No-op precision check for a std::complex<double> (throws if asked for non-double precision).
|
inlinestatic |
Bring a set of values to a common (highest) precision.
|
inlineinherited |
Get the system being tracked on, which is referred to by the tracker.
|
inlineinherited |
Getter for the tracker used inside an instance of the endgame.
|
inlineprotectedinherited |
Whether anyone is currently observing (conservative).
Lets an emitter skip constructing an event – and any work needed to build its payload, such as a numeric-type conversion – when there is no observer to receive it. Conservative: returns true if any watcher list is non-empty (even if a stale, emptied typed bucket lingers), so it never wrongly suppresses a real observer.
|
inline |
Return the next (higher) precision to escalate to, following the tracker's authority and strictly above the current precision.
|
inlineprotectedinherited |
Notify all observers of a (mutable) event.
|
inlineprotectedinherited |
Sends an event to observers that subscribed to its exact dynamic type, then to all catch-all (untyped) observers.
Mutations of the observer lists are deferred for the duration of a notification (see AddObserver/RemoveObserver), so iterating the live lists here is safe even when an observer subscribes/unsubscribes mid-dispatch. An observer that returns ObserveResult::Unsubscribe is dropped once the (possibly nested) notification completes. The depth counter keeps this correct under re-entrant emission.
|
inlinevirtualinherited |
Whether this observable may be observed as the given type.
Drives the compatibility check in AddObserver. The default accepts the wildcard typeid(void) and this observable's own dynamic type. An observable that emits its events templated on a base type (so a single observer type serves many concrete observables) should also accept that base type — e.g. ZeroDim accepts AnyZeroDim.
Reimplemented in bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >, and bertini::algorithm::HomotopySolver< A, B, C >.
|
inline |
Hardware-double fast-lane refine for the adaptive-numeric-type (double-first) endgame.
Pure-(i) escalation: this does NOT raise precision in place. The endgame is computing in the complex_dbl slot, with the tracker and system already at double precision; we refine there. If double cannot reach the tolerance the tracker returns HigherPrecisionNecessary / FailedToConverge, and we hand that code straight back to RunImplAMP, which migrates every container to mpfr and retries in the complex_mp slot (where the in-place mp->higher-mp escalation above takes over).
|
inline |
Refine a single sample point, escalating precision if Newton refinement needs it.
|
inlineinherited |
Remove an observer from this observable.
Like AddObserver, this is safe to call during a notification: the removal is deferred until the current notification loop finishes.
|
inlineinherited |
Tell the endgame to use the given tracker.
Takes a reference.
|
inline |
Widen a vector to the boundary complex type (complex_mp) at the given precision.
|
mutable |
When true, the double-first adaptive-numeric-type lane is armed.
|
mutable |
The endgame's current working precision (double = fast lane, higher = mpfr slot).