Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState Struct Reference

Restores the ambient session state a solve may perturb: "a solve leaves the session as it found it". More...

#include <zero_dim_solve.hpp>

Collaboration diagram for bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState:
[legend]

Public Member Functions

 ScopedSessionState ()
 Capture the ambient session state.
 ~ScopedSessionState ()
 Restore it, whatever the solve did in between.
 ScopedSessionState (ScopedSessionState const &)=delete
 Non-copyable.
ScopedSessionState & operator= (ScopedSessionState const &)=delete
 Non-assignable.

Public Attributes

unsigned precision_
 The ambient default precision at solve entry.
std::mt19937 engine_
 The calling thread's legacy engine state at entry.
records::DrawStream stream_
 The calling thread's pinned draw stream at entry.

Detailed Description

template<typename TrackerType, typename EndgameType, typename SystemType>
struct bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState

Restores the ambient session state a solve may perturb: "a solve leaves the session as it found it".

Two globals otherwise leak: the mpfr default precision (an adaptive solve historically left it at the tracking precision – e.g. 16 after a double-fast-lane finish), and the calling thread's RNG streams (serial tracking rekeys them to per-path domains via ReseedThisThread). Either leak makes what a LATER solve computes – its config identity, its drawn coefficients – depend on whether THIS solve computed or recalled, which cascades into phantom new asks on rerun. Scoped restoration makes recall and compute indistinguishable to the rest of the session; the records the solve wrote are its only trace.

Constructor & Destructor Documentation

◆ ScopedSessionState() [1/2]

template<typename TrackerType, typename EndgameType, typename SystemType>
bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::ScopedSessionState ( )
inline

Capture the ambient session state.

◆ ~ScopedSessionState()

template<typename TrackerType, typename EndgameType, typename SystemType>
bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::~ScopedSessionState ( )
inline

Restore it, whatever the solve did in between.

◆ ScopedSessionState() [2/2]

template<typename TrackerType, typename EndgameType, typename SystemType>
bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::ScopedSessionState ( ScopedSessionState const & )
delete

Non-copyable.

Member Function Documentation

◆ operator=()

template<typename TrackerType, typename EndgameType, typename SystemType>
ScopedSessionState & bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::operator= ( ScopedSessionState const & )
delete

Non-assignable.

Member Data Documentation

◆ engine_

template<typename TrackerType, typename EndgameType, typename SystemType>
std::mt19937 bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::engine_

The calling thread's legacy engine state at entry.

◆ precision_

template<typename TrackerType, typename EndgameType, typename SystemType>
unsigned bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::precision_

The ambient default precision at solve entry.

◆ stream_

template<typename TrackerType, typename EndgameType, typename SystemType>
records::DrawStream bertini::algorithm::HomotopySolver< TrackerType, EndgameType, SystemType >::ScopedSessionState::stream_

The calling thread's pinned draw stream at entry.