Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::endgame::SampleSequenceCollector< EndgameT > Struct Template Reference

Collects an endgame's approach to the root as a time-indexed sequence, for callers that need to watch a quantity BEHAVE as the point improves rather than judge it at a single point. More...

#include <observers.hpp>

Inheritance diagram for bertini::endgame::SampleSequenceCollector< EndgameT >:
[legend]
Collaboration diagram for bertini::endgame::SampleSequenceCollector< EndgameT >:
[legend]

Public Types

using EmitterT = EndgameT
 The endgame type emitting the observed events.
using BCT = typename EndgameT::BaseComplexT
 The boundary complex type of the observed endgame.

Public Member Functions

void Clear ()
 Forget everything collected so far, so one collector can be reused across paths.
size_t NumRuns () const
size_t NumSamples () const
virtual ObserveResult Observe (AnyEvent const &e) override
 Observe the observable object being observed.
std::type_index ObservedKind () const override
 The type this observer expects to observe.
virtual std::vector< std::type_index > SubscribedEventTypes () const
 Declares which event types this observer wants to receive.
virtual std::vector< std::type_index > SubscribedEventTypes () const
 Declares which event types this observer wants to receive.

Public Attributes

std::vector< Vec< BCT > > path_samples
 Points on the path, from ComputedSamplePoint – the sequence.
std::vector< BCT > path_times
 The time at which each path sample was computed.
std::vector< Vec< BCT > > circle_samples
 Circle-track points, from CircleAdvanced (Cauchy only).
std::vector< BCT > circle_times
 The time of each circle sample.
std::vector< Vec< BCT > > approximations
 Root approximations, from ApproximatedRoot.
std::vector< BCT > approximation_times
 The endgame's latest time at each approximation.
std::vector< NumErrorT > approximation_errors
 The endgame's reported error at each approximation.
std::vector< unsigned > cycle_numbers
 The endgame's cycle number at each approximation.
std::vector< BCT > advance_times
 Times at which TimeAdvanced fired (that event carries no payload).
std::vector< size_t > run_path_starts
 Index into path_samples where each run's samples begin.
std::vector< size_t > run_circle_starts
 Index into circle_samples where each run's circle points begin.
std::vector< size_t > run_approx_starts
 Index into approximations where each run's approximations begin.
size_t num_precision_increases = 0
 How many times the endgame raised its working precision (PrecisionChanged), over every run observed. When that happens before the first approximation the sample window is recomputed at the new precision and the superseded samples are dropped from the sequence (SamplesRecomputedAtHigherPrecision).

Detailed Description

template<typename EndgameT>
struct bertini::endgame::SampleSequenceCollector< EndgameT >

Collects an endgame's approach to the root as a time-indexed sequence, for callers that need to watch a quantity BEHAVE as the point improves rather than judge it at a single point.

A single spectrum cannot separate a genuinely tiny singular value from a perturbation artifact – the two are numerically identical at one point. What separates them is the trend: a truly-zero value is bounded by the point's own error, so it tracks the distance to the root down, while a genuinely nonzero one plateaus. Reading that trend needs the approach itself, not just its final answer, which is what this collects.

THREE BUCKETS, kept apart because they are different evidence:

  • path_samples – the samples, from ComputedSamplePoint. Points ON the path at geometrically shrinking times, approaching the root. These are the sequence: distance to the root falls as |t|^(1/c) with c the cycle number, so a quantity that vanishes at the root traces a power law against these times, and one that does not is flat.
  • circle_samples – from CircleAdvanced, Cauchy only. These sit at CONSTANT |t| and do not approach the root, so they are not part of the sequence; their mean is what becomes an approximation. Kept for loop diagnostics, never mixed into the sequence.
  • approximations – from ApproximatedRoot, with the error and cycle number the endgame reported at each. Estimates OF the root rather than points on the path.

advance_times records TimeAdvanced, which carries no payload of its own – it marks that the approach axis moved, and is emitted by the Cauchy endgame only.

Attach one of these per path. It is an ordinary C++ observer, so the observable filters by event type before any virtual call, and a run that emits thousands of events pays only for the handful this asks for.

Member Typedef Documentation

◆ BCT

template<typename EndgameT>
using bertini::endgame::SampleSequenceCollector< EndgameT >::BCT = typename EndgameT::BaseComplexT

The boundary complex type of the observed endgame.

◆ EmitterT

template<typename EndgameT>
using bertini::endgame::SampleSequenceCollector< EndgameT >::EmitterT = EndgameT

The endgame type emitting the observed events.

Member Function Documentation

◆ Clear()

template<typename EndgameT>
void bertini::endgame::SampleSequenceCollector< EndgameT >::Clear ( )
inline

Forget everything collected so far, so one collector can be reused across paths.

◆ NumRuns()

template<typename EndgameT>
size_t bertini::endgame::SampleSequenceCollector< EndgameT >::NumRuns ( ) const
inline
Returns
The number of endgame runs observed – the number of paths, when attached to a solver.

◆ NumSamples()

template<typename EndgameT>
size_t bertini::endgame::SampleSequenceCollector< EndgameT >::NumSamples ( ) const
inline
Returns
The number of samples collected – the length of the sequence.

◆ Observe()

template<typename EndgameT>
virtual ObserveResult bertini::endgame::SampleSequenceCollector< EndgameT >::Observe ( AnyEvent const & e)
inlineoverridevirtual

Observe the observable object being observed.

This is probably in response to NotifyObservers.

This virtual function must be overridden by actual observers, defining how they observe the observable they are observing, probably filtering events and doing something specific for different ones.

Parameters
eThe event which was emitted by the observed object.
Returns
ObserveResult::KeepObserving to keep receiving events, or ObserveResult::Unsubscribe to ask the observable to drop this observer once the current notification finishes.

Implements bertini::AnyObserver.

◆ ObservedKind()

std::type_index bertini::Observer< EndgameT >::ObservedKind ( ) const
inlineoverridevirtualinherited

The type this observer expects to observe.

Used by Observable::AddObserver to reject attaching an observer to an incompatible observable (which would otherwise silently never fire). The default is typeid(void), a wildcard meaning "attach me anywhere"; Observer<ObservedT> reports typeid(ObservedT).

Reimplemented from bertini::AnyObserver.

◆ SubscribedEventTypes() [1/2]

virtual std::vector< std::type_index > bertini::AnyObserver::SubscribedEventTypes ( ) const
inlinevirtualinherited

Declares which event types this observer wants to receive.

Return a non-empty vector to opt into type-indexed dispatch: the observable will only call Observe() for events whose dynamic type exactly matches one of the returned type_index values. Return an empty vector (the default) to receive every event — this is the correct choice for observers that handle many or all event types, and is the automatic behavior for Python-defined observers.

Reimplemented in bertini::TypedObserver< Derived, ObservedT, ConcreteEvents >, bertini::TypedObserver< AMPPathAccumulator< TrackerT, SuccessfulStep >, TrackerT, SuccessfulStep< TrackerTraits< TrackerT >::EventEmitterType > >, bertini::TypedObserver< FirstPrecisionRecorder< TrackerT >, TrackerT, Initializing< TrackerTraits< TrackerT >::EventEmitterType, TrackerTraits< TrackerT >::BaseComplexT >, TrackingStarted< TrackerTraits< TrackerT >::EventEmitterType >, PrecisionChanged< TrackerTraits< TrackerT >::EventEmitterType > >, bertini::TypedObserver< MinMaxPrecisionRecorder< TrackerT >, TrackerT, Initializing< TrackerTraits< TrackerT >::EventEmitterType, TrackerTraits< TrackerT >::BaseComplexT >, TrackingStarted< TrackerTraits< TrackerT >::EventEmitterType >, PrecisionChanged< TrackerTraits< TrackerT >::EventEmitterType > >, bertini::TypedObserver< PathPrecisionRecorder< TrackerT >, TrackerT, TrackingStarted< TrackerTraits< TrackerT >::EventEmitterType >, PrecisionChanged< TrackerTraits< TrackerT >::EventEmitterType > >, bertini::TypedObserver< PathPrecisionRecorder< TrackerType >, TrackerType, TrackingStarted< TrackerTraits< TrackerType >::EventEmitterType >, PrecisionChanged< TrackerTraits< TrackerType >::EventEmitterType > >, and bertini::TypedObserver< StepFailScreenPrinter< TrackerT >, TrackerT, FailedStep< TrackerTraits< TrackerT >::EventEmitterType > >.

◆ SubscribedEventTypes() [2/2]

virtual std::vector< std::type_index > bertini::AnyObserver::SubscribedEventTypes ( ) const
inlinevirtualinherited

Declares which event types this observer wants to receive.

Return a non-empty vector to opt into type-indexed dispatch: the observable will only call Observe() for events whose dynamic type exactly matches one of the returned type_index values. Return an empty vector (the default) to receive every event — this is the correct choice for observers that handle many or all event types, and is the automatic behavior for Python-defined observers.

Member Data Documentation

◆ advance_times

template<typename EndgameT>
std::vector<BCT> bertini::endgame::SampleSequenceCollector< EndgameT >::advance_times

Times at which TimeAdvanced fired (that event carries no payload).

◆ approximation_errors

template<typename EndgameT>
std::vector<NumErrorT> bertini::endgame::SampleSequenceCollector< EndgameT >::approximation_errors

The endgame's reported error at each approximation.

◆ approximation_times

template<typename EndgameT>
std::vector<BCT> bertini::endgame::SampleSequenceCollector< EndgameT >::approximation_times

The endgame's latest time at each approximation.

◆ approximations

template<typename EndgameT>
std::vector<Vec<BCT> > bertini::endgame::SampleSequenceCollector< EndgameT >::approximations

Root approximations, from ApproximatedRoot.

◆ circle_samples

template<typename EndgameT>
std::vector<Vec<BCT> > bertini::endgame::SampleSequenceCollector< EndgameT >::circle_samples

Circle-track points, from CircleAdvanced (Cauchy only).

◆ circle_times

template<typename EndgameT>
std::vector<BCT> bertini::endgame::SampleSequenceCollector< EndgameT >::circle_times

The time of each circle sample.

◆ cycle_numbers

template<typename EndgameT>
std::vector<unsigned> bertini::endgame::SampleSequenceCollector< EndgameT >::cycle_numbers

The endgame's cycle number at each approximation.

◆ num_precision_increases

template<typename EndgameT>
size_t bertini::endgame::SampleSequenceCollector< EndgameT >::num_precision_increases = 0

How many times the endgame raised its working precision (PrecisionChanged), over every run observed. When that happens before the first approximation the sample window is recomputed at the new precision and the superseded samples are dropped from the sequence (SamplesRecomputedAtHigherPrecision).

◆ path_samples

template<typename EndgameT>
std::vector<Vec<BCT> > bertini::endgame::SampleSequenceCollector< EndgameT >::path_samples

Points on the path, from ComputedSamplePoint – the sequence.

◆ path_times

template<typename EndgameT>
std::vector<BCT> bertini::endgame::SampleSequenceCollector< EndgameT >::path_times

The time at which each path sample was computed.

◆ run_approx_starts

template<typename EndgameT>
std::vector<size_t> bertini::endgame::SampleSequenceCollector< EndgameT >::run_approx_starts

Index into approximations where each run's approximations begin.

◆ run_circle_starts

template<typename EndgameT>
std::vector<size_t> bertini::endgame::SampleSequenceCollector< EndgameT >::run_circle_starts

Index into circle_samples where each run's circle points begin.

◆ run_path_starts

template<typename EndgameT>
std::vector<size_t> bertini::endgame::SampleSequenceCollector< EndgameT >::run_path_starts

Index into path_samples where each run's samples begin.