Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::endgame::EndgameBase< FlavorT, PrecT > Class Template Reference

Base endgame class for all endgames offered in Bertini2. More...

#include <base_endgame.hpp>

Inheritance diagram for bertini::endgame::EndgameBase< FlavorT, PrecT >:
[legend]
Collaboration diagram for bertini::endgame::EndgameBase< FlavorT, PrecT >:
[legend]

Public Types

using TrackerType = typename PrecT::TrackerType
 The path-tracker type.
using BaseComplexT = typename tracking::TrackerTraits<TrackerType>::BaseComplexT
 The complex number type.
using BaseRealT = typename tracking::TrackerTraits<TrackerType>::BaseRealT
 The real number type.
using EmitterType = FlavorT
 The event-emitter type.
using Config = detail::Configured< typename AlgoTraits<FlavorT>::NeededConfigs >
 The configuration bundle this endgame reads, public so that generic machinery which works in terms of an object's configs – the Python bindings' ConfiguredVisitor, which needs Config::UsedConfigs – can serve an endgame the same way it serves a tracker or a solver.
using UsedConfigs
 The list of configuration types this object holds.

Public Member Functions

template<typename ComplexT>
auto ComputeCOverK (SampCont< ComplexT > const &samples) const -> typename Eigen::NumTraits< ComplexT >::Real
 An estimate of c/k from the three most recent geometric samples.
template<typename T>
bool CheckForCOverKStabilization (std::deque< T > const &c_over_k_array) const
 Have the last few c/k estimates settled to within the user's threshold?
void SetBoundaryTime (BCT const &t)
 Set the endgame boundary (start) time.
void SetTargetTime (BCT const &t)
 Set the final target time.
BCT const & BoundaryTime () const
BCT const & TargetTime () const
SuccessCode Run (Vec< BCT > const &start_point)
 Run the endgame from the stored boundary time to the stored target time.
template<typename ComplexT>
void EmitComputedSample (Vec< ComplexT > const &sample, ComplexT const &time)
 Announce a completed sample point on the path, as a ComputedSamplePoint.
template<typename ComplexT>
SuccessCode RefineAllSamples (SampCont< ComplexT > &samples, TimeCont< ComplexT > &times)
 Refine every sample point to the endgame's refinement tolerance.
template<typename ComplexT>
SuccessCode RefineSample (Vec< ComplexT > &result, Vec< ComplexT > const &current_sample, ComplexT const &current_time, NumErrorT tol, unsigned max_iterations) const
 A function passed off to the precision-specific endgame part.
template<typename ComplexT>
SuccessCode EndgameTrackPath (Vec< ComplexT > &result, ComplexT const &start_time, ComplexT const &end_time, Vec< ComplexT > const &start_point) const
 Track through the tracker, adapting at the numeric-type boundary.
template<typename Dummy = void>
SuccessCode EscalateAndMigrate (unsigned guard)
 Raise the endgame to the next precision and migrate the containers' complex_dbl slot up to complex_mp when the tracker's authority escalates.
const auto & EndgameSettings () const
 This function is inferior to the templated Get<ConfigT> function provided.
const auto & SecuritySettings () const
template<typename RealT>
bool BeyondSecurityMaxNorm (RealT const &norm) const
 EndgameBase (TrackerType const &tr, const ConfigsAsTuple &settings)
 Construct the endgame for a tracker, with its configuration as a tuple.
template<typename... Ts>
 EndgameBase (TrackerType const &tr, const Ts &... ts)
 Construct the endgame for a tracker, with configs given in any order.
unsigned CycleNumber () const
void CycleNumber (unsigned c)
 Set the cycle number.
void IncrementCycleNumber (unsigned inc)
 Increase the cycle number by the given increment.
const auto & FinalTolerance () const
 Get the final tolerance to which we are tracking the solution.
void SetFinalTolerance (NumErrorT const &ft)
 Setter for the final tolerance.
template<typename ComplexT>
const Vec< ComplexT > & FinalApproximation () const
 Get the most-recent approximation.
template<typename ComplexT>
const Vec< ComplexT > & PreviousApproximation () const
 Get the second-most-recent approximation.
NumErrorT ApproximateError () const
 Get the most recent accuracy estimate.
const BCT & LatestTime () const
 Get the latest time at which a point on the path was computed.
template<typename ComplexT>
SuccessCode ComputeInitialSamples (const ComplexT &start_time, const ComplexT &target_time, const Vec< ComplexT > &x_endgame_start, TimeCont< ComplexT > &times, SampCont< ComplexT > &samples)
 Get the system being tracked on, which is referred to by the tracker.
virtual ~EndgameBase ()=default
const T & Get () const
 Get the held configuration object of type T.
void Set (T const &t)
 Set the held configuration object of type T.
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.

Public Attributes

std::tuple< Ts... > configuration_
 The held configuration objects, one per config type.

Protected Types

using BCT = BaseComplexT
 The complex number type.
using BRT = BaseRealT
 The real number type.
using Configured = detail::Configured< typename AlgoTraits<FlavorT>::NeededConfigs >
 The Configured base type.
using Configs = typename AlgoTraits<FlavorT>::NeededConfigs
 The configuration bundle (Configured base).
using ConfigsAsTuple = typename Configs::ToTuple
 The configuration structs as a tuple.
using NeededTypes = typename tracking::TrackerTraits<TrackerType>::NeededTypes
 Arithmetic types this endgame may compute in (sourced from the tracker).
using TupOfVec = typename NeededTypes::ToTupleOfVec
 A tuple of vector containers, one per numeric type.
using TupOfReal = typename NeededTypes::ToTupleOfReal
 A tuple of real values, one per numeric type.
using TupleOfTimes = typename NeededTypes::template ToTupleOfCont<TimeCont>
 A tuple of time containers, one per numeric type.
using TupleOfSamps = typename NeededTypes::template ToTupleOfCont<SampCont>
 A tuple of sample containers, one per numeric type.

Protected Member Functions

void RefreshCOverKProbe (unsigned size) const
 Draw the c/k probe direction for a run.
template<typename ComplexT>
Vec< ComplexT > const & GetCOverKProbe (unsigned size, unsigned prec) const
 The fixed random direction the c/k estimate is projected along.
const FlavorT & AsFlavor () const
 convert the base endgame into the derived type.
FlavorT & AsFlavor ()
 Non-const version of AsFlavor.
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).

Protected Attributes

Vec< BCT > final_approximation_
 The latest computed approximation of the endpoint.
Vec< BCT > previous_approximation_
 The previous approximation of the endpoint.
unsigned int cycle_number_ = 0
 The current estimate of the cycle number.
NumErrorT approximate_error_ = std::numeric_limits<NumErrorT>::infinity()
 The error estimate between successive approximations.
BCT start_time_ {}
 The endgame boundary time; set via SetBoundaryTime().
BCT target_time_ {}
 The final target time (default 0); set via SetTargetTime().
Vec< complex_dbl > c_over_k_probe_as_drawn_
 The random direction the c/k estimate is projected along, as drawn: in double precision, so that it is exact in every lane and at every multiple precision.
TupOfVec c_over_k_probe_
 The c/k probe in each numeric type the endgame computes in: exact conversions of c_over_k_probe_as_drawn_, re-derived when their size or precision is wrong, never rounded.

Detailed Description

template<class FlavorT, class PrecT>
class bertini::endgame::EndgameBase< FlavorT, PrecT >

Base endgame class for all endgames offered in Bertini2.

See also
PowerSeriesEndgame
CauchyEndgame

Using an endgame

Endgames in Bertini2 are the engine for finishing homotopy continuation where we may encounter singular solutions. The path is implicitly described by the system being tracked.

Purpose

Since the Bertini Endgames have common functionality, and we want to be able to call arbitrary algorithms using and tracker type, we use inheritance. That is, there is common functionality in all endgames, such as

ComputeInitialSamples

Also, there are settings that will be kept at this level to not duplicate code.

Creating a new endgame type

To create a new endgame type, inherit from this class.

Member Typedef Documentation

◆ BaseComplexT

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::BaseComplexT = typename tracking::TrackerTraits<TrackerType>::BaseComplexT

The complex number type.

◆ BaseRealT

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::BaseRealT = typename tracking::TrackerTraits<TrackerType>::BaseRealT

The real number type.

◆ BCT

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::BCT = BaseComplexT
protected

The complex number type.

◆ BRT

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::BRT = BaseRealT
protected

The real number type.

◆ Config

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::Config = detail::Configured< typename AlgoTraits<FlavorT>::NeededConfigs >

The configuration bundle this endgame reads, public so that generic machinery which works in terms of an object's configs – the Python bindings' ConfiguredVisitor, which needs Config::UsedConfigs – can serve an endgame the same way it serves a tracker or a solver.

The same type as the protected Configured alias below.

◆ Configs

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::Configs = typename AlgoTraits<FlavorT>::NeededConfigs
protected

The configuration bundle (Configured base).

◆ ConfigsAsTuple

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::ConfigsAsTuple = typename Configs::ToTuple
protected

The configuration structs as a tuple.

◆ Configured

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::Configured = detail::Configured< typename AlgoTraits<FlavorT>::NeededConfigs >
protected

The Configured base type.

◆ EmitterType

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::EmitterType = FlavorT

The event-emitter type.

◆ NeededTypes

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::NeededTypes = typename tracking::TrackerTraits<TrackerType>::NeededTypes
protected

Arithmetic types this endgame may compute in (sourced from the tracker).

◆ TrackerType

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::TrackerType = typename PrecT::TrackerType

The path-tracker type.

◆ TupleOfSamps

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::TupleOfSamps = typename NeededTypes::template ToTupleOfCont<SampCont>
protected

A tuple of sample containers, one per numeric type.

◆ TupleOfTimes

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::TupleOfTimes = typename NeededTypes::template ToTupleOfCont<TimeCont>
protected

A tuple of time containers, one per numeric type.

◆ TupOfReal

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::TupOfReal = typename NeededTypes::ToTupleOfReal
protected

A tuple of real values, one per numeric type.

◆ TupOfVec

template<class FlavorT, class PrecT>
using bertini::endgame::EndgameBase< FlavorT, PrecT >::TupOfVec = typename NeededTypes::ToTupleOfVec
protected

A tuple of vector containers, one per numeric type.

◆ UsedConfigs

using bertini::detail::Configured< Ts >::UsedConfigs
inherited

The list of configuration types this object holds.

Constructor & Destructor Documentation

◆ EndgameBase() [1/2]

template<class FlavorT, class PrecT>
bertini::endgame::EndgameBase< FlavorT, PrecT >::EndgameBase ( TrackerType const & tr,
const ConfigsAsTuple & settings )
inlineexplicit

Construct the endgame for a tracker, with its configuration as a tuple.

◆ EndgameBase() [2/2]

template<class FlavorT, class PrecT>
template<typename... Ts>
bertini::endgame::EndgameBase< FlavorT, PrecT >::EndgameBase ( TrackerType const & tr,
const Ts &... ts )
inlineexplicit

Construct the endgame for a tracker, with configs given in any order.

◆ ~EndgameBase()

template<class FlavorT, class PrecT>
virtual bertini::endgame::EndgameBase< FlavorT, PrecT >::~EndgameBase ( )
virtualdefault

Member Function Documentation

◆ AddObserver() [1/2]

void bertini::Observable::AddObserver ( AnyObserver & new_observer) const
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.

Exceptions
IncompatibleObserverif the observer's ObservedKind() is not one this observable can be observed as.

◆ AddObserver() [2/2]

void bertini::Observable::AddObserver ( std::shared_ptr< AnyObserver > const & new_observer) const
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.)

Exceptions
IncompatibleObserverif incompatible (see the reference overload).

◆ ApproximateError()

template<class FlavorT, class PrecT>
NumErrorT bertini::endgame::EndgameBase< FlavorT, PrecT >::ApproximateError ( ) const
inline

Get the most recent accuracy estimate.

◆ AsFlavor() [1/2]

template<class FlavorT, class PrecT>
FlavorT & bertini::endgame::EndgameBase< FlavorT, PrecT >::AsFlavor ( )
inlineprotected

Non-const version of AsFlavor.

◆ AsFlavor() [2/2]

template<class FlavorT, class PrecT>
const FlavorT & bertini::endgame::EndgameBase< FlavorT, PrecT >::AsFlavor ( ) const
inlineprotected

convert the base endgame into the derived type.

This enables the CRPT as used by the endgames

◆ BeyondSecurityMaxNorm()

template<class FlavorT, class PrecT>
template<typename RealT>
bool bertini::endgame::EndgameBase< FlavorT, PrecT >::BeyondSecurityMaxNorm ( RealT const & norm) const
inline
Returns
True when a dehomogenized norm calls for security truncation: above max_norm, or NaN. NaN must count as beyond – every IEEE comparison against NaN is false, so a plain norm > max_norm valve is BLIND to exactly the paths most likely to be diverging (a NaN dehom norm means the homogenizing coordinate vanished: the path is at infinity).

◆ BoundaryTime()

template<class FlavorT, class PrecT>
BCT const & bertini::endgame::EndgameBase< FlavorT, PrecT >::BoundaryTime ( ) const
inline
Returns
The endgame boundary (start) time.

◆ CheckForCOverKStabilization()

template<class FlavorT, class PrecT>
template<typename T>
bool bertini::endgame::EndgameBase< FlavorT, PrecT >::CheckForCOverKStabilization ( std::deque< T > const & c_over_k_array) const
inline

Have the last few c/k estimates settled to within the user's threshold?

The operating-zone test: consecutive estimates agreeing to within minimum_for_c_over_k_stabilization, for num_needed_for_stabilization of them, is taken as the cycle-number estimate having settled. Both endgames use this and mean the same thing by it (b2#402).

Template Parameters
TThe element type of the estimate window; real or complex, since only its magnitude is read (the Cauchy endgame keeps reals, the power series endgame keeps its numeric type).
Parameters
c_over_k_arrayThe estimates so far, oldest first.
Returns
Whether they have settled.

◆ ComputeCOverK()

template<class FlavorT, class PrecT>
template<typename ComplexT>
auto bertini::endgame::EndgameBase< FlavorT, PrecT >::ComputeCOverK ( SampCont< ComplexT > const & samples) const->typenameEigen::NumTraits< ComplexT >::Real
inline

An estimate of c/k from the three most recent geometric samples.

Assumes the path is in the endgame operating zone, where the Puiseux asymptotics dominate; as the cycle-number estimate settles, successive values of this estimate settle with it, which is what CheckForCOverKStabilization watches for.

It reads only the geometrically-spaced approach samples and the fixed probe, which every endgame flavor maintains – the power series endgame's samples_ and the Cauchy endgame's pseg_samples_ are the same window under two names – so it belongs here rather than to either flavor (b2#402). Consult page 53 of [4] for the heuristic.

Template Parameters
ComplexTThe complex number type.
Parameters
samplesThe geometric approach samples; the first three are used.
Returns
The estimate, never below 1.

◆ ComputeInitialSamples()

template<class FlavorT, class PrecT>
template<typename ComplexT>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::ComputeInitialSamples ( const ComplexT & start_time,
const ComplexT & target_time,
const Vec< ComplexT > & x_endgame_start,
TimeCont< ComplexT > & times,
SampCont< ComplexT > & samples )
inline

Get the system being tracked on, which is referred to by the tracker.

Populates time and space samples so that we are ready to start the endgame.

Input

    start_time: is the time when we start the endgame process usually this is .1
    x_endgame_start: is the space value at start_time
    times: a deque of time values. These values will be templated to be ComplexT
    samples: a deque of sample values that are in correspondence with the values in times. These values will be vectors with entries of ComplexT.

Output

SuccessCode indicating whether tracking to all samples was successful.

Details

The first sample will be (x_endgame_start) and the first time is start_time.
From there we do a geometric progression using the sample factor (which by default is 1/2).
Hence, next_time = start_time * sample_factor.
We track then to the next_time and construct the next_sample.
Parameters
start_timeThe time value at which we start the endgame.
target_timeThe time value that we are trying to find a solution to.
x_endgame_startThe current space point at start_time.
timesA deque that will hold all the time values of the samples we are going to use to start the endgame.
samplesa deque that will hold all the samples corresponding to the time values in times.
Template Parameters
ComplexTThe complex number type.

◆ CycleNumber() [1/2]

template<class FlavorT, class PrecT>
unsigned bertini::endgame::EndgameBase< FlavorT, PrecT >::CycleNumber ( ) const
inline
Returns
The current cycle number.

◆ CycleNumber() [2/2]

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::CycleNumber ( unsigned c)
inline

Set the cycle number.

◆ EmitComputedSample()

template<class FlavorT, class PrecT>
template<typename ComplexT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::EmitComputedSample ( Vec< ComplexT > const & sample,
ComplexT const & time )
inline

Announce a completed sample point on the path, as a ComputedSamplePoint.

The payload rides at BaseComplexT, so the adaptive endgame's hardware-double fast lane must convert – and only pays for that when something is actually observing. Shared by the initial window here and by each flavor's time advance, so the conversion rule lives in one place.

Parameters
sampleThe newly completed sample point on the path.
timeThe time value at which it was computed.
Template Parameters
ComplexTThe complex number type the endgame is currently working in.

◆ EndgameSettings()

template<class FlavorT, class PrecT>
const auto & bertini::endgame::EndgameBase< FlavorT, PrecT >::EndgameSettings ( ) const
inline

This function is inferior to the templated Get<ConfigT> function provided.

◆ EndgameTrackPath()

template<class FlavorT, class PrecT>
template<typename ComplexT>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::EndgameTrackPath ( Vec< ComplexT > & result,
ComplexT const & start_time,
ComplexT const & end_time,
Vec< ComplexT > const & start_point ) const
inline

Track through the tracker, adapting at the numeric-type boundary.

The tracker's TrackPath I/O is fixed to BaseComplexT (its TrackerLoopInitialization / CopySolution are non-templatable virtuals). When the adaptive-numeric-type endgame is computing in the hardware complex_dbl fast lane (ComplexT != BCT, i.e. the AMP case), we convert at the boundary: hand the tracker mpfr points at DoublePrecision – so the AMP tracker uses its hardware-double slot internally – then downcast the result back to complex_dbl. If the tracker escalated internally (GetCurrentPrecision() > DoublePrecision()), the caller's escalation hook discards this result and migrates the endgame to mpfr, so the truncating downcast is harmless.

When ComplexT == BCT (every fixed-precision tracker, and the AMP endgame's mpfr lane) this is a direct, zero-overhead call to the tracker – byte-identical to calling TrackPath itself.

MICRO-OPT (future): a native complex_dbl TrackPath overload on the AMP tracker would remove the boundary conversion churn (~1-2% of a track). Deferred – see the sprint notes.

◆ EscalateAndMigrate()

template<class FlavorT, class PrecT>
template<typename Dummy = void>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::EscalateAndMigrate ( unsigned guard)
inline

Raise the endgame to the next precision and migrate the containers' complex_dbl slot up to complex_mp when the tracker's authority escalates.

◆ FinalApproximation()

template<class FlavorT, class PrecT>
template<typename ComplexT>
const Vec< ComplexT > & bertini::endgame::EndgameBase< FlavorT, PrecT >::FinalApproximation ( ) const
inline

Get the most-recent approximation.

◆ FinalTolerance()

template<class FlavorT, class PrecT>
const auto & bertini::endgame::EndgameBase< FlavorT, PrecT >::FinalTolerance ( ) const
inline

Get the final tolerance to which we are tracking the solution.

◆ Get()

const T & bertini::detail::Configured< Ts >::Get ( ) const
inlineinherited

Get the held configuration object of type T.

◆ GetCOverKProbe()

template<class FlavorT, class PrecT>
template<typename ComplexT>
Vec< ComplexT > const & bertini::endgame::EndgameBase< FlavorT, PrecT >::GetCOverKProbe ( unsigned size,
unsigned prec ) const
inlineprotected

The fixed random direction the c/k estimate is projected along.

An exact conversion of the direction as drawn, at the requested precision. Converted, not rounded in place: the drawn values are doubles, which every multiple precision holds exactly, so the direction is the same in both lanes and survives any change of precision.

Template Parameters
ComplexTThe complex number type.
Parameters
sizeThe number of coordinates the probe must have.
precThe working precision to supply it at.
Returns
The probe, by const reference.

◆ HasObservers()

bool bertini::Observable::HasObservers ( ) const
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.

◆ IncrementCycleNumber()

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::IncrementCycleNumber ( unsigned inc)
inline

Increase the cycle number by the given increment.

◆ LatestTime()

template<class FlavorT, class PrecT>
const BCT & bertini::endgame::EndgameBase< FlavorT, PrecT >::LatestTime ( ) const
inline

Get the latest time at which a point on the path was computed.

◆ NotifyObservers() [1/2]

void bertini::Observable::NotifyObservers ( AnyEvent & e) const
inlineprotectedinherited

Notify all observers of a (mutable) event.

◆ NotifyObservers() [2/2]

void bertini::Observable::NotifyObservers ( AnyEvent const & e) const
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.

◆ ObservableIsA()

virtual bool bertini::Observable::ObservableIsA ( std::type_index t) const
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 >.

◆ PreviousApproximation()

template<class FlavorT, class PrecT>
template<typename ComplexT>
const Vec< ComplexT > & bertini::endgame::EndgameBase< FlavorT, PrecT >::PreviousApproximation ( ) const
inline

Get the second-most-recent approximation.

◆ RefineAllSamples()

template<class FlavorT, class PrecT>
template<typename ComplexT>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::RefineAllSamples ( SampCont< ComplexT > & samples,
TimeCont< ComplexT > & times )
inline

Refine every sample point to the endgame's refinement tolerance.

◆ RefineSample()

template<class FlavorT, class PrecT>
template<typename ComplexT>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::RefineSample ( Vec< ComplexT > & result,
Vec< ComplexT > const & current_sample,
ComplexT const & current_time,
NumErrorT tol,
unsigned max_iterations ) const
inline

A function passed off to the precision-specific endgame part.

Templated on ComplexT so the adaptive-numeric-type endgame can refine in the hardware-complex_dbl fast lane as well as in complex_mp. The precision policy (FixedPrecEndgame / AMPEndgame) provides the matching RefineSampleImpl overload(s). Fixed precision only ever instantiates this at BCT.

◆ RefreshCOverKProbe()

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::RefreshCOverKProbe ( unsigned size) const
inlineprotected

Draw the c/k probe direction for a run.

Called at the start of every run, after whatever reseed the caller does for the path, so the direction is a function of the random-number stream at that point and nothing else.

Parameters
sizeThe number of coordinates the probe must have.

◆ RemoveObserver()

void bertini::Observable::RemoveObserver ( AnyObserver & observer) const
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.

◆ Run()

template<class FlavorT, class PrecT>
SuccessCode bertini::endgame::EndgameBase< FlavorT, PrecT >::Run ( Vec< BCT > const & start_point)
inline

Run the endgame from the stored boundary time to the stored target time.

Re-precisions the stored times to match start_point before dispatching to RunImpl, so the caller never needs to worry about precision alignment.

Call SetBoundaryTime() before invoking Run().

◆ SecuritySettings()

template<class FlavorT, class PrecT>
const auto & bertini::endgame::EndgameBase< FlavorT, PrecT >::SecuritySettings ( ) const
inline
Returns
The security (divergence-bailout) settings.

◆ Set()

void bertini::detail::Configured< Ts >::Set ( T const & t)
inlineinherited

Set the held configuration object of type T.

◆ SetBoundaryTime()

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::SetBoundaryTime ( BCT const & t)
inline

Set the endgame boundary (start) time.

◆ SetFinalTolerance()

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::SetFinalTolerance ( NumErrorT const & ft)
inline

Setter for the final tolerance.

◆ SetTargetTime()

template<class FlavorT, class PrecT>
void bertini::endgame::EndgameBase< FlavorT, PrecT >::SetTargetTime ( BCT const & t)
inline

Set the final target time.

◆ TargetTime()

template<class FlavorT, class PrecT>
BCT const & bertini::endgame::EndgameBase< FlavorT, PrecT >::TargetTime ( ) const
inline
Returns
The final target time.

Member Data Documentation

◆ approximate_error_

template<class FlavorT, class PrecT>
NumErrorT bertini::endgame::EndgameBase< FlavorT, PrecT >::approximate_error_ = std::numeric_limits<NumErrorT>::infinity()
mutableprotected

The error estimate between successive approximations.

Initialized to infinity, not left indeterminate: ApproximateError() is a public accessor, so a caller may read it before any endgame has run. Infinity is also the only safe sentinel here – every convergence gate in the flavors has the shape approximate_error_ < FinalTolerance(), and an indeterminate value that happened to be small would be a false convergence.

◆ c_over_k_probe_

template<class FlavorT, class PrecT>
TupOfVec bertini::endgame::EndgameBase< FlavorT, PrecT >::c_over_k_probe_
mutableprotected

The c/k probe in each numeric type the endgame computes in: exact conversions of c_over_k_probe_as_drawn_, re-derived when their size or precision is wrong, never rounded.

◆ c_over_k_probe_as_drawn_

template<class FlavorT, class PrecT>
Vec<complex_dbl> bertini::endgame::EndgameBase< FlavorT, PrecT >::c_over_k_probe_as_drawn_
mutableprotected

The random direction the c/k estimate is projected along, as drawn: in double precision, so that it is exact in every lane and at every multiple precision.

Drawn at the start of every run (RefreshCOverKProbe) and fixed for the run, so consecutive estimates differ only because the samples differ. A fresh random probe every call made the stabilization test noisy – it could certify the operating zone spuriously – and churned mpfr allocations. See z_notes/20260629.

◆ configuration_

std::tuple<Ts...> bertini::detail::Configured< Ts >::configuration_
inherited

The held configuration objects, one per config type.

◆ cycle_number_

template<class FlavorT, class PrecT>
unsigned int bertini::endgame::EndgameBase< FlavorT, PrecT >::cycle_number_ = 0
mutableprotected

The current estimate of the cycle number.

◆ final_approximation_

template<class FlavorT, class PrecT>
Vec<BCT> bertini::endgame::EndgameBase< FlavorT, PrecT >::final_approximation_
mutableprotected

The latest computed approximation of the endpoint.

◆ previous_approximation_

template<class FlavorT, class PrecT>
Vec<BCT> bertini::endgame::EndgameBase< FlavorT, PrecT >::previous_approximation_
mutableprotected

The previous approximation of the endpoint.

◆ start_time_

template<class FlavorT, class PrecT>
BCT bertini::endgame::EndgameBase< FlavorT, PrecT >::start_time_ {}
protected

The endgame boundary time; set via SetBoundaryTime().

◆ target_time_

template<class FlavorT, class PrecT>
BCT bertini::endgame::EndgameBase< FlavorT, PrecT >::target_time_ {}
protected

The final target time (default 0); set via SetTargetTime().