Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::records Namespace Reference

Classes

class  DrawStream
 A deterministic, fully-specified random stream (SHA-256 counter mode). More...
class  OutputDirectory
 One structured output directory: definitions/ + history/ + derived views. More...

Functions

std::string CanonicalName (tracking::Predictor p)
 The fixed canonical name of a predictor choice (never its numeric value).
std::string CanonicalName (algorithm::classic::AlgoChoice a)
 The fixed canonical name of an algorithm (track-type) choice.
std::string CanonicalName (algorithm::classic::EndgameChoice e)
 The fixed canonical name of an endgame choice.
std::string CanonicalEncoding (tracking::SteppingConfig const &c)
 Canonical encoding of stepping settings.
std::string CanonicalEncoding (tracking::NewtonConfig const &c)
 Canonical encoding of Newton-corrector settings.
std::string CanonicalEncoding (tracking::FixedPrecisionConfig const &c)
 Canonical encoding of fixed-precision settings.
std::string CanonicalEncoding (tracking::AdaptiveMultiplePrecisionConfig const &c)
 Canonical encoding of adaptive-multiple-precision settings.
std::string CanonicalEncoding (tracking::Predictor p)
 Canonical encoding of a predictor choice (as a one-field pseudo-config).
std::string CanonicalEncoding (tracking::TrackerConfig const &c)
 Canonical encoding of the tracker's own settings (predictor and its two thresholds).
std::string CanonicalEncoding (endgame::SecurityConfig const &c)
 Canonical encoding of endgame security (divergence-bailout) settings.
std::string CanonicalEncoding (endgame::EndgameConfig const &c)
 Canonical encoding of common endgame settings.
std::string CanonicalEncoding (endgame::PowerSeriesConfig const &c)
 Canonical encoding of power-series-endgame settings.
std::string CanonicalEncoding (endgame::CauchyConfig const &c)
 Canonical encoding of Cauchy-endgame settings.
std::string CanonicalEncoding (endgame::TrackBackConfig const &c)
 Canonical encoding of track-back endgame settings.
std::string CanonicalEncoding (algorithm::TolerancesConfig const &c)
 Canonical encoding of Newton/path tolerances.
std::string CanonicalEncoding (algorithm::MidPathConfig const &c)
 Canonical encoding of midpath (path-crossing check) settings.
std::string CanonicalEncoding (algorithm::AutoRetrackConfig const &c)
 Canonical encoding of crossed-path auto-retrack settings.
std::string CanonicalEncoding (algorithm::SharpeningConfig const &c)
 Canonical encoding of solution-sharpening settings.
std::string CanonicalEncoding (algorithm::RegenerationConfig const &c)
 Canonical encoding of regeneration settings.
std::string CanonicalEncoding (algorithm::PostProcessingConfig const &c)
 Canonical encoding of post-processing (classification) settings.
std::string CanonicalEncoding (algorithm::ZeroDimConfig const &c)
 Canonical encoding of top-level zero-dim solve settings.
std::string CanonicalEncoding (algorithm::MetaConfig const &c)
 Canonical encoding of the algorithm (track-type) selection.
std::string CanonicalEncoding (algorithm::classic::EndgameChoiceConfig const &c)
 Canonical encoding of the endgame selection.
template<typename ConfigT>
detail::Digest256 ConfigDigest (ConfigT const &config)
 The persistent digest of one configuration: SHA-256 over its versioned canonical encoding.
template<typename... ConfigTs>
detail::Digest256 SettingsDigest (ConfigTs const &... configs)
 One digest for a solver's FULL settings: the versioned concatenation of several configs' canonical encodings, in the order given.
std::string ConfigTextAsJson (std::string const &canonical_text, std::string const &digest_hex)
 Render one or more canonical config encodings as pretty JSON, for archiving in a structured output directory.
DrawStream & ThreadDrawStream ()
 This thread's pinned draw stream — the source of every identity-relevant random draw in bertini2.
double DrawUnitDouble ()
 A draw from this thread's pinned stream, uniform on [0,1) (exactly 53 bits).
double DrawSymmetricDouble ()
 A draw from this thread's pinned stream, uniform on [-1,1].
std::string EncodingOfSystemDefinition (std::string const &definition_json)
 The canonical encoding text inside an archived system definition document.
std::shared_ptr< const System > LoadSystem (OutputDirectory const &directory, std::string const &digest_hex)
 Load the system archived under digest_hex in directory.
std::string SystemEncodingAsJson (std::string const &encoding_text, std::string const &digest_hex, boost::json::object const &parts)
 The archived form of a system definition: a machine-parseable JSON document {"schema", "digest", "system", "encoding"} – one json.load away, like the config definitions.
std::string TimeStampNow ()
 The record timestamp, now: YYYY-MM-DD HH:MM local time – the one clock format every record kind uses (run headers, declarations, recall events).
std::optional< std::string > AmbientRecordsPath ()
 Resolve the ambient records directory from the environment – the ONE place the BERTINI_RECORDS_DIR semantics live (the CLI and every solver's ambient attach use it).
std::string ProducerVersion ()
 This build's package version (e.g. "3.0.0.dev7", from the VERSION file).
std::string ProducerCommit ()
 The git commit this build came from ("<sha>", "<sha>-dirty", or "unknown" for builds outside a git checkout, e.g.
boost::json::object ProducerInfo ()
 The producer object recorded in every run header.
std::string ExactDoubleText (double v)
 A double as full-round-trip decimal text (%.17g: bit-exact per IEEE-754).
double DoubleFromText (std::string const &s)
 Parse a double written by ExactDoubleText (bit-exact round trip).
std::string EncodeRealScalar (double v)
 Encode one real scalar as text: doubles via %.17g; real_mp at full stored precision.
std::string EncodeRealScalar (real_mp const &v)
 Encode one multiprecision real scalar as full-precision decimal text.
boost::json::array EncodeComplexScalar (complex_dbl const &z)
 Encode one complex value as ["re", "im", precision] (precision in digits).
boost::json::array EncodeComplexScalar (complex_mp const &z)
 Encode one multiprecision complex value as ["re", "im", precision].
template<typename ComplexT>
ComplexT DecodeComplexScalar (boost::json::array const &triple)
 Decode a complex value written by EncodeComplexScalar, at its recorded precision.
template<>
complex_dbl DecodeComplexScalar< complex_dbl > (boost::json::array const &triple)
 Decode a double-precision complex value.
template<>
complex_mp DecodeComplexScalar< complex_mp > (boost::json::array const &triple)
 Decode a multiprecision complex value at its recorded precision.
template<typename ComplexT>
boost::json::array EncodePoint (Vec< ComplexT > const &point)
 Encode a point (vector of complex coordinates) as an array of scalar triples.
template<typename ComplexT>
Vec< ComplexT > DecodePoint (boost::json::array const &coords)
 Decode a point written by EncodePoint.
std::string CanonicalName (SuccessCode code)
 The fixed canonical name of a tracker/endgame SuccessCode, for the records.
std::string CoarsePathStatus (SuccessCode code)
 The coarse outcome of a path, from its endgame verdict: "success", "diverged" (the path went to infinity – a clean GoingToInfinity verdict, or the security check TRUNCATING it near infinity), or "failed" (the tracker gave up).
template<typename ComplexT>
boost::json::object EncodeFullPathResult (parallel::FullPathResult< ComplexT > const &r)
 Serialize one whole-path result as a b2rec/1 track record body.
template<typename ComplexT>
parallel::FullPathResult< ComplexT > DecodeFullPathResult (boost::json::object const &rec, std::size_t path_index)
 Reconstruct a whole-path result from a track record (the recall half).

Variables

constexpr char ConfigEncodingVersion [] = "b2cfgenc/4"
 The version tag baked into every config digest; bump on any encoding change.
constexpr char RandomDerivationVersion [] = "b2rand/1"
 The version tag of the draw-derivation scheme; bump on any algorithm change.
constexpr char RecordSchemaVersion [] = "b2rec/1"
 The record-format version tag written on run headers; see docs/records/b2rec-1.md.

Function Documentation

◆ AmbientRecordsPath()

std::optional< std::string > bertini::records::AmbientRecordsPath ( )

Resolve the ambient records directory from the environment – the ONE place the BERTINI_RECORDS_DIR semantics live (the CLI and every solver's ambient attach use it).

Records are ON BY DEFAULT for every face of bertini2 (ADR-0047): when the variable is unset, the resolution is bertini_output. A non-empty value chooses the directory. The OFF switch is the value none – or the empty string, which only exists on POSIX (Windows cannot represent an empty environment value: assigning one deletes the variable, which would silently flip "off" back to the default).

Returns
The directory to record to, or nullopt when records are explicitly off.

◆ CanonicalEncoding() [1/20]

std::string bertini::records::CanonicalEncoding ( algorithm::AutoRetrackConfig const & c)

Canonical encoding of crossed-path auto-retrack settings.

◆ CanonicalEncoding() [2/20]

std::string bertini::records::CanonicalEncoding ( algorithm::classic::EndgameChoiceConfig const & c)

Canonical encoding of the endgame selection.

◆ CanonicalEncoding() [3/20]

std::string bertini::records::CanonicalEncoding ( algorithm::MetaConfig const & c)

Canonical encoding of the algorithm (track-type) selection.

◆ CanonicalEncoding() [4/20]

std::string bertini::records::CanonicalEncoding ( algorithm::MidPathConfig const & c)

Canonical encoding of midpath (path-crossing check) settings.

◆ CanonicalEncoding() [5/20]

std::string bertini::records::CanonicalEncoding ( algorithm::PostProcessingConfig const & c)

Canonical encoding of post-processing (classification) settings.

◆ CanonicalEncoding() [6/20]

std::string bertini::records::CanonicalEncoding ( algorithm::RegenerationConfig const & c)

Canonical encoding of regeneration settings.

◆ CanonicalEncoding() [7/20]

std::string bertini::records::CanonicalEncoding ( algorithm::SharpeningConfig const & c)

Canonical encoding of solution-sharpening settings.

◆ CanonicalEncoding() [8/20]

std::string bertini::records::CanonicalEncoding ( algorithm::TolerancesConfig const & c)

Canonical encoding of Newton/path tolerances.

◆ CanonicalEncoding() [9/20]

std::string bertini::records::CanonicalEncoding ( algorithm::ZeroDimConfig const & c)

Canonical encoding of top-level zero-dim solve settings.

Excludes num_threads and recall (transient: they must not change identity).

◆ CanonicalEncoding() [10/20]

std::string bertini::records::CanonicalEncoding ( endgame::CauchyConfig const & c)

Canonical encoding of Cauchy-endgame settings.

◆ CanonicalEncoding() [11/20]

std::string bertini::records::CanonicalEncoding ( endgame::EndgameConfig const & c)

Canonical encoding of common endgame settings.

◆ CanonicalEncoding() [12/20]

std::string bertini::records::CanonicalEncoding ( endgame::PowerSeriesConfig const & c)

Canonical encoding of power-series-endgame settings.

◆ CanonicalEncoding() [13/20]

std::string bertini::records::CanonicalEncoding ( endgame::SecurityConfig const & c)

Canonical encoding of endgame security (divergence-bailout) settings.

◆ CanonicalEncoding() [14/20]

std::string bertini::records::CanonicalEncoding ( endgame::TrackBackConfig const & c)

Canonical encoding of track-back endgame settings.

◆ CanonicalEncoding() [15/20]

std::string bertini::records::CanonicalEncoding ( tracking::AdaptiveMultiplePrecisionConfig const & c)

Canonical encoding of adaptive-multiple-precision settings.

◆ CanonicalEncoding() [16/20]

std::string bertini::records::CanonicalEncoding ( tracking::FixedPrecisionConfig const & c)

Canonical encoding of fixed-precision settings.

◆ CanonicalEncoding() [17/20]

std::string bertini::records::CanonicalEncoding ( tracking::NewtonConfig const & c)

Canonical encoding of Newton-corrector settings.

◆ CanonicalEncoding() [18/20]

std::string bertini::records::CanonicalEncoding ( tracking::Predictor p)

Canonical encoding of a predictor choice (as a one-field pseudo-config).

◆ CanonicalEncoding() [19/20]

std::string bertini::records::CanonicalEncoding ( tracking::SteppingConfig const & c)

Canonical encoding of stepping settings.

◆ CanonicalEncoding() [20/20]

std::string bertini::records::CanonicalEncoding ( tracking::TrackerConfig const & c)

Canonical encoding of the tracker's own settings (predictor and its two thresholds).

Parameters
cThe config to encode.
Returns
The canonical text.

◆ CanonicalName() [1/4]

std::string bertini::records::CanonicalName ( algorithm::classic::AlgoChoice a)

The fixed canonical name of an algorithm (track-type) choice.

◆ CanonicalName() [2/4]

std::string bertini::records::CanonicalName ( algorithm::classic::EndgameChoice e)

The fixed canonical name of an endgame choice.

◆ CanonicalName() [3/4]

std::string bertini::records::CanonicalName ( SuccessCode code)
inline

The fixed canonical name of a tracker/endgame SuccessCode, for the records.

Integer enum values could renumber across versions; the NAME is the durable, read-without-bertini rendering, recorded beside the integer in every track record.

Parameters
codeThe success code to name.
Returns
Its fixed string name (never the numeric value).

◆ CanonicalName() [4/4]

std::string bertini::records::CanonicalName ( tracking::Predictor p)

The fixed canonical name of a predictor choice (never its numeric value).

◆ CoarsePathStatus()

std::string bertini::records::CoarsePathStatus ( SuccessCode code)
inline

The coarse outcome of a path, from its endgame verdict: "success", "diverged" (the path went to infinity – a clean GoingToInfinity verdict, or the security check TRUNCATING it near infinity), or "failed" (the tracker gave up).

A diverged path is an ANSWER, not a failure: the solver classified it, deliberately. Audits of a run should see success / diverged / failed as three distinct populations (the same bucketing SummarizeSolve uses).

Parameters
codeThe endgame success code of the path.
Returns
The coarse status string.

◆ ConfigDigest()

template<typename ConfigT>
detail::Digest256 bertini::records::ConfigDigest ( ConfigT const & config)

The persistent digest of one configuration: SHA-256 over its versioned canonical encoding.

Template Parameters
ConfigTAny type with a CanonicalEncoding overload above.
Parameters
configThe configuration to digest.
Returns
The 256-bit digest (stable cross-session; the config half of an ask identity).

◆ ConfigTextAsJson()

std::string bertini::records::ConfigTextAsJson ( std::string const & canonical_text,
std::string const & digest_hex )

Render one or more canonical config encodings as pretty JSON, for archiving in a structured output directory.

The DIGEST contract stays on the canonical text (b2cfgenc/<n>); this JSON view is derived from it mechanically – exact values preserved as strings – because JSON is the format humans and tools in the directory already speak.

Parameters
canonical_textNewline-separated canonical encodings, first line the version tag.
digest_hexThe settings digest these encodings produce (recorded alongside).
Returns
A pretty-printed JSON document: {"schema", "digest", "configs": {Name: {k: v}}}.

◆ DecodeComplexScalar()

template<typename ComplexT>
ComplexT bertini::records::DecodeComplexScalar ( boost::json::array const & triple)

Decode a complex value written by EncodeComplexScalar, at its recorded precision.

◆ DecodeComplexScalar< complex_dbl >()

template<>
complex_dbl bertini::records::DecodeComplexScalar< complex_dbl > ( boost::json::array const & triple)
inline

Decode a double-precision complex value.

◆ DecodeComplexScalar< complex_mp >()

template<>
complex_mp bertini::records::DecodeComplexScalar< complex_mp > ( boost::json::array const & triple)
inline

Decode a multiprecision complex value at its recorded precision.

◆ DecodeFullPathResult()

template<typename ComplexT>
parallel::FullPathResult< ComplexT > bertini::records::DecodeFullPathResult ( boost::json::object const & rec,
std::size_t path_index )

Reconstruct a whole-path result from a track record (the recall half).

◆ DecodePoint()

template<typename ComplexT>
Vec< ComplexT > bertini::records::DecodePoint ( boost::json::array const & coords)

Decode a point written by EncodePoint.

◆ DoubleFromText()

double bertini::records::DoubleFromText ( std::string const & s)
inline

Parse a double written by ExactDoubleText (bit-exact round trip).

◆ DrawSymmetricDouble()

double bertini::records::DrawSymmetricDouble ( )

A draw from this thread's pinned stream, uniform on [-1,1].

◆ DrawUnitDouble()

double bertini::records::DrawUnitDouble ( )

A draw from this thread's pinned stream, uniform on [0,1) (exactly 53 bits).

◆ EncodeComplexScalar() [1/2]

boost::json::array bertini::records::EncodeComplexScalar ( complex_dbl const & z)
inline

Encode one complex value as ["re", "im", precision] (precision in digits).

◆ EncodeComplexScalar() [2/2]

boost::json::array bertini::records::EncodeComplexScalar ( complex_mp const & z)
inline

Encode one multiprecision complex value as ["re", "im", precision].

◆ EncodeFullPathResult()

template<typename ComplexT>
boost::json::object bertini::records::EncodeFullPathResult ( parallel::FullPathResult< ComplexT > const & r)

Serialize one whole-path result as a b2rec/1 track record body.

Field names mirror parallel::FullPathResult. SuccessCodes are recorded as integers (their values are part of the b2rec contract) AND by canonical name (the durable, read-without-bertini rendering). The caller adds "kind"/"run"/"index"/"status"/"start".

◆ EncodePoint()

template<typename ComplexT>
boost::json::array bertini::records::EncodePoint ( Vec< ComplexT > const & point)

Encode a point (vector of complex coordinates) as an array of scalar triples.

◆ EncodeRealScalar() [1/2]

std::string bertini::records::EncodeRealScalar ( double v)
inline

Encode one real scalar as text: doubles via %.17g; real_mp at full stored precision.

◆ EncodeRealScalar() [2/2]

std::string bertini::records::EncodeRealScalar ( real_mp const & v)
inline

Encode one multiprecision real scalar as full-precision decimal text.

◆ EncodingOfSystemDefinition()

std::string bertini::records::EncodingOfSystemDefinition ( std::string const & definition_json)

The canonical encoding text inside an archived system definition document.

Parameters
definition_jsonThe document as PutDefinition stored it (the output of SystemEncodingAsJson): a JSON object with an encoding string member.
Returns
The encoding text, exactly as archived.

Throws std::runtime_error if the document is not JSON or has no encoding string.

◆ ExactDoubleText()

std::string bertini::records::ExactDoubleText ( double v)
inline

A double as full-round-trip decimal text (%.17g: bit-exact per IEEE-754).

◆ LoadSystem()

std::shared_ptr< const System > bertini::records::LoadSystem ( OutputDirectory const & directory,
std::string const & digest_hex )

Load the system archived under digest_hex in directory.

Parameters
directoryThe records directory holding the systems/ definition.
digest_hexThe system's content digest, as the run header and the definition filename carry it (64 lowercase hex characters).
Returns
The interned representative of the rebuilt system: if an equal system is already alive in this process, THAT one comes back.

Throws std::runtime_error if no definition has that id, if the encoding cannot be read (a version this build does not read, other canonicalization settings, damage), or if the rebuilt system's digest differs from digest_hex – the document was altered, or the encoding no longer means what it meant when it was written.

◆ ProducerCommit()

std::string bertini::records::ProducerCommit ( )

The git commit this build came from ("<sha>", "<sha>-dirty", or "unknown" for builds outside a git checkout, e.g.

from a source tarball).

◆ ProducerInfo()

boost::json::object bertini::records::ProducerInfo ( )

The producer object recorded in every run header.

Returns
{"name": "bertini2", "version": <version>, "commit": <sha or "unknown">}.

◆ ProducerVersion()

std::string bertini::records::ProducerVersion ( )

This build's package version (e.g. "3.0.0.dev7", from the VERSION file).

◆ SettingsDigest()

template<typename... ConfigTs>
detail::Digest256 bertini::records::SettingsDigest ( ConfigTs const &... configs)

One digest for a solver's FULL settings: the versioned concatenation of several configs' canonical encodings, in the order given.

Order matters and is part of the contract: a given solver kind should always compose its settings digest in one fixed order (document it at the call site).

Template Parameters
ConfigTsTypes each having a CanonicalEncoding overload.
Parameters
configsThe configurations, in the solver's fixed order.
Returns
The 256-bit digest of the combined settings.

◆ SystemEncodingAsJson()

std::string bertini::records::SystemEncodingAsJson ( std::string const & encoding_text,
std::string const & digest_hex,
boost::json::object const & parts )

The archived form of a system definition: a machine-parseable JSON document {"schema", "digest", "system", "encoding"} – one json.load away, like the config definitions.

The system value is the structured parts view (variable groups, path variable, functions, patches – see io::SystemPartsJson); the encoding value is the EXACT canonical encoding text (b2sysenc/<n>, the digest preimage, block structure preserved). Classic (Bertini 1) syntax appears nowhere: it is an input/compatibility format, not an output format. Verification of a wandering file: extract the encoding and hash it, e.g. jq -r .encoding <file> | sha256sum reproduces digest.

Parameters
encoding_textThe system's canonical encoding (System::CanonicalEncodingText()).
digest_hexThe system's content digest (64 lowercase hex characters).
partsThe structured parts view of the same system (presentation only).
Returns
The pretty-printed JSON document.

◆ ThreadDrawStream()

DrawStream & bertini::records::ThreadDrawStream ( )

This thread's pinned draw stream — the source of every identity-relevant random draw in bertini2.

Reseeded alongside the legacy engine by SetGlobalSeed / ReseedThisThread (random.hpp), preserving the setup / per-path / worker stream separation.

◆ TimeStampNow()

std::string bertini::records::TimeStampNow ( )

The record timestamp, now: YYYY-MM-DD HH:MM local time – the one clock format every record kind uses (run headers, declarations, recall events).

Variable Documentation

◆ ConfigEncodingVersion

char bertini::records::ConfigEncodingVersion[] = "b2cfgenc/4"
constexpr

The version tag baked into every config digest; bump on any encoding change.

◆ RandomDerivationVersion

char bertini::records::RandomDerivationVersion[] = "b2rand/1"
constexpr

The version tag of the draw-derivation scheme; bump on any algorithm change.

◆ RecordSchemaVersion

char bertini::records::RecordSchemaVersion[] = "b2rec/1"
constexpr

The record-format version tag written on run headers; see docs/records/b2rec-1.md.

Bump on any change to record shapes or conventions.