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

Namespaces

namespace  blackbox
namespace  detail
namespace  policy
namespace  endgame
namespace  node
namespace  classic
namespace  generators
namespace  io
namespace  parsing
namespace  linalg
namespace  logging
namespace  algorithm
namespace  algorithms
namespace  start_system
namespace  nag_datatype
namespace  parallel
namespace  serial
namespace  multiprecision
namespace  records
namespace  settings
namespace  blocks
namespace  system
namespace  tracking

Classes

struct  ParsedArgs
 Parsed results of the command-line arguments. More...
class  ScopedStopRequest
 Clears any stale stop request on the way in, and again on the way out. More...
class  AnyEvent
 Strawman Event type, enabling polymorphism. More...
class  Event
class  Event< ObsT, true >
 For emission of events from observables. More...
class  Event< ObsT, false >
 For emission of events from observables. More...
struct  IncompatibleObserver
 Thrown when an observer is attached to an observable it cannot observe. More...
class  Observable
 An abstract observable type, maintaining a list of observers, who can be notified in case of Events. More...
class  AnyObserver
 Strawman base class for Observer objects. More...
class  Observer
 Actual observer type, which you should derive from to extract custom information from observable types. More...
class  MultiObserver
 A class which can glob together observer types into a new, single observer type. More...
class  TypedObserver
 CRTP base that turns an observer into a set of typed Observe() overloads. More...
class  VisitableBase
 The base class for visitable types. More...
class  VisitorBase
 A strawman class for implementing the visitor pattern. More...
class  Visitor
 The first non-trivial visitor class. More...
struct  scoped_mpfr_precision_options_this_thread
 RAII guard setting the multiprecision variable-precision options for the current thread, restoring on scope exit. More...
struct  scoped_mpfr_precision_options_all_threads
 RAII guard setting the multiprecision variable-precision options for all threads, restoring on scope exit. More...
struct  NumTraits
 Numeric traits for a bertini number type: digit counts, conversions, and companion types. More...
struct  NumTraits< double >
 Numeric traits for the built-in double type. More...
struct  NumTraits< complex_dbl >
 Numeric traits for double-precision complex numbers. More...
struct  NumTraits< real_mp >
 Numeric traits for multiprecision reals (digit counts follow the thread precision). More...
struct  NumTraits< complex_mp >
 Numeric traits for multiprecision complex numbers (digit counts follow the thread precision). More...
struct  NumTraits< mpq_rational >
 Numeric traits for exact rationals (provides decimal-string parsing). More...
class  SystemPool
class  PointPool
class  Patch
 An affine chart on a product of projective spaces. More...
class  Slice
 A linear slice of affine or projective space: a stack of linear forms, M [x ; 1]. More...
struct  SLPOutputLocations
 A struct encapsulating the starting locations of outputs in the SLP's memory layout. More...
struct  SLPInputLocations
 A struct encapsulating the starting locations of inputs in the SLP's memory layout. More...
struct  SLPNumberOf
 A struct encapsulating the numbers of things appearing in the SLP. More...
struct  ConstantRecipe
 An exact, node-independent description of a constant baked into the program: enough to (re)produce the constant's value at any working precision, without evaluating a function-tree node (ADR-0027; node evaluation is being retired). More...
class  SLPMemory
 The per-thread mutable working state of a straight-line program evaluation: the register file (one bank per number type), the working precision, and the freshness / frozen-prologue flags. More...
class  SLPProgram
 The immutable compiled straight-line program (ADR-0027): the instruction tape, the constant recipe (true values of numbers + integer bank), and the memory layout (numbers of / locations of things). More...
class  StraightLineProgram
 An implementation of straight-line programs, implemented with strong inspiration from Bertini1's implementation. More...
class  SLPCompiler
 Compiles a System (or polynomial block) into a StraightLineProgram by visiting its function-tree nodes and emitting tape instructions (with common-subexpression sharing). More...
struct  NodeMatrix
 A matrix of expression-tree nodes (the symbolic Jacobian), stored row-major. More...
class  System
 The fundamental polynomial system class for Bertini2. More...

Typedefs

template<typename T>
using SampCont = std::deque<Vec<T> >
template<typename T>
using TimeCont = std::deque<T>
template<typename ObsT>
using ConstEvent = Event<ObsT,true>
 An event holding a const reference to its observable.
template<typename ObsT>
using MutableEvent = Event<ObsT,false>
 An event holding a mutable reference to its observable.
using real_dbl = double
 The double-precision real number type.
using complex_dbl = std::complex<double>
 The double-precision complex number type.
template<typename NumT>
using Vec = Eigen::Matrix<NumT, Eigen::Dynamic, 1>
 A dynamically-sized column vector of NumT.
template<typename NumT>
using Mat = Eigen::Matrix<NumT, Eigen::Dynamic, Eigen::Dynamic>
 A dynamically-sized matrix of NumT.
using VariableGroup = std::vector< std::shared_ptr<node::Variable> >
 An ordered group of variables (the unit of homogenization / variable grouping).
using SubstitutionMap = std::map< std::string, std::shared_ptr<node::Node> >
 A substitution request for Node::Subs: variable name -> the node to put in its place.
using Path = fs::path
 Shorthand for a filesystem path.
using ifstream = std::ifstream
 Shorthand for an input file stream.
using complex_mp = bmp::number<mpc_complex_backend<0>, bmp::et_on >
 The arbitrary-precision complex number type.
using real_mp = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_on>
 The arbitrary-precision real number type.
using mpz_int = boost::multiprecision::number<boost::multiprecision::backends::gmp_int, boost::multiprecision::et_on>
 The arbitrary-precision integer type.
using mpq_rational = boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on>
 The exact rational number type.
using NumErrorT = double
 The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances, Newton residuals, condition numbers, same-point tolerances.
using Block = std::variant<blocks::PolynomialBlock, blocks::ProductsOfLinearsBlock, blocks::LinearFormsBlock, blocks::BlendBlock<System>, blocks::RandomizationBlock<System>>
 The closed set of evaluation blocks a System can be composed of.

Enumerations

enum class  ContStart { Front , Back }
enum class  SuccessCode {
  NeverStarted = -1 , Success = 0 , HigherPrecisionNecessary , ReduceStepSize ,
  GoingToInfinity , FailedToConverge , MatrixSolveFailure , MatrixSolveFailureFirstPartOfPrediction ,
  MaxNumStepsTaken , MaxPrecisionReached , MinStepSizeReached , Failure ,
  SingularStartPoint , ExternallyTerminated , MinTrackTimeReached , SecurityMaxNormReached ,
  CycleNumTooHigh , FailedToSelectPrecisionAndStepsize , WallClockLimitReached
}
enum class  ObserveResult { KeepObserving , Unsubscribe }
 The result an observer returns from Observe(), telling the observable whether to keep sending it events. More...
enum class  MatrixSuccessCode { Success , LargeChange , SmallValue }
 Outcome of a matrix-decomposition sanity check (e.g. LU pivot magnitude). More...
enum class  VariableGroupType { Homogeneous , Affine , Ungrouped }
 How a variable group participates in homogenization. More...
enum class  NumType : uint8_t { Real = 0 , Complex = 1 }
 The numeric type a memory slot holds, orthogonal to working precision (ADR-0034). More...
enum  Operation {
  Add = 1 << 0 , Subtract = 1 << 1 , Multiply = 1 << 2 , Divide = 1 << 3 ,
  Power = 1 << 4 , Exp = 1 << 5 , Log = 1 << 6 , Negate = 1 << 7 ,
  Sqrt = 1 << 8 , Sin = 1 << 9 , Cos = 1 << 10 , Tan = 1 << 11 ,
  Asin = 1 << 12 , Acos = 1 << 13 , Atan = 1 << 14 , Assign = 1 << 15 ,
  IntPower = 1 << 16
}
 The opcodes for the operations a straight-line program instruction can perform. More...

Functions

ParsedArgs ParseArgcArgv (int argc, char **argv)
 Parse command-line arguments and return a ParsedArgs struct.
int MainModeSwitch (ParsedArgs const &args)
 Route to the appropriate algorithm based on parsed arguments and the tracktype found in the input file's CONFIG section.
void RequestStop ()
 Ask any running computation in this process to stop at its next check.
void ClearStopRequest ()
 Withdraw a stop request, so later computations run normally.
bool StopRequested ()
 Has somebody asked this process to stop?
template<typename T>
std::ostream & operator<< (typename std::enable_if< std::is_enum< T >::value, std::ostream >::type &stream, const T &e)
 Method for printing class enums to streams.
template<typename... UnpermutedT, typename... PermutedPresentT>
std::tuple< const UnpermutedT &... > Unpermute (const PermutedPresentT &... present_permuted_args)
 Reorder a set of present arguments into the declared UnpermutedT order, default-constructing any absent.
std::mt19937 & ThreadEngine ()
 Returns this thread's canonical mt19937 engine.
std::complex< double > operator* (unsigned i, std::complex< double > z)
 Overload * for unsigned * complex<double>.
bool isnan (std::complex< double > const &z)
 an overload of isnan, for std::complex<double>
double RandReal ()
 Gets you a random real number between -1 and 1, fwiw.
complex_dbl pow (const complex_dbl &z, int power)
 Compute +,- integral powers of a std::complex<double> number.
template<typename Derived>
bool IsEmpty (Eigen::MatrixBase< Derived > const &v)
 Checks whether the number of rows and columns are either 0.
template<typename Derived>
bool ContainsNaN (Eigen::MatrixBase< Derived > const &v)
 True when any entry of a complex-valued Eigen object has a NaN real or imaginary part.
template<typename Derived>
unsigned Precision (Eigen::MatrixBase< Derived > const &v)
 Get the precision of an Eigen object.
template<typename Derived>
unsigned PrecisionRequireUniform (Eigen::MatrixBase< Derived > const &v)
 Query the precision of an Eigen object, requiring it to be non-empty, and of uniform precision.
template<typename Derived>
void Precision (Eigen::MatrixBase< Derived > &v, unsigned prec)
 Set the precision of an Eigen object.
template<typename T>
bool IsSmallValue (T const &testme)
 Test a numbers being very small.
template<typename T>
bool IsSymmRelDiffSmall (T const &a, T const &b, typename Eigen::NumTraits< T >::Real const &e)
 Check whether two values are very close to each other.
template<typename T>
bool IsLargeChange (T const &numerator, T const &denomenator)
 Test two numbers for having large ratio.
template<typename Derived>
MatrixSuccessCode LUPartialPivotDecompositionSuccessful (Eigen::MatrixBase< Derived > const &LU)
 Check the diagonal elements of an LU decomposition for small values and large ratios.
template<typename NumberType>
Eigen::Matrix< NumberType, Eigen::Dynamic, Eigen::Dynamic > KahanMatrix (unsigned int mat_size, NumberType c)
 Make a Kahan matrix with a given number type.
template<typename NumberType>
Mat< NumberType > RandomOfUnits (unsigned int rows, unsigned int cols)
 Make a random matrix of units (numbers with norm 1).
template<typename NumberType>
Mat< NumberType > RandomConjugateOrthonormalMatrix (unsigned int rows, unsigned int cols)
 Make a random conjugate-orthonormal matrix (orthonormal rows when rows<=cols, orthonormal columns when rows>=cols), to the current default precision.
template<typename NumberType>
Vec< NumberType > RandomOfUnits (unsigned int size)
 Make a random vector of units (numbers with norm 1).
template<typename DerivedA, typename DerivedB>
bool IsSamePoint (Eigen::MatrixBase< DerivedA > const &a, Eigen::MatrixBase< DerivedB > const &b, NumErrorT tol)
 True if two points are the same to within tol in the infinity norm.
template<typename DerivedA, typename DerivedB>
bool IsDistinct (Eigen::MatrixBase< DerivedA > const &a, Eigen::MatrixBase< DerivedB > const &b, NumErrorT tol)
 True if two points differ by more than tol in the infinity norm (the negation of :func:IsSamePoint).
void InstallFastAllocator ()
 Install the fast multiprecision allocator (idempotent; safe to call more than once).
std::shared_ptr< bertini::node::Node > Simplify (std::shared_ptr< bertini::node::Node > const &n)
 Functionally simplify a tree: returns a NEW simplified tree, leaving the input untouched (non-mutating, copy-on-write; ADR-0011, issue #251).
void OpenInFileThrowIfFail (ifstream &in, Path const &input_path)
 Try to open a file, and throw if it doesn't exist, or is a directory.
std::string FileToString (Path const &input_path)
 Read an entire file into a string.
std::string LicenseInfo ()
 Get a short description of Bertini2's licensing.
std::string SourceURL ()
 Get the URL of the Bertini2 source repository.
std::string WikiURL ()
 Get the URL of the Bertini2 wiki.
std::string Version ()
 Get the Bertini2 version string.
std::string Owners ()
 Get the names of the Bertini trademark owners.
std::string SplashScreen ()
 Get the multi-line splash screen text (trademark, URLs, version, license).
std::string GenericHelp ()
 Get the generic help text (currently empty).
std::string EigenHeaderVersion ()
 Get the version of the Eigen headers compiled against.
std::string GMPVersion ()
 Get the version of the GMP library linked against.
std::string MPFRVersion ()
 Get the version of the MPFR library linked against.
std::string MPIVersion ()
 Get the version of the MPI library linked against (or a note if serial).
std::string BoostHeaderVersion ()
 Get the version of the Boost headers compiled against.
std::string DependencyVersions ()
 Get a multi-line summary of the versions of Bertini2's dependencies (Boost, Eigen, GMP, MPFR).
auto DefaultPrecisionPolicy ()
 The default Boost.Multiprecision variable-precision policy used by bertini.
auto DefaultPrecision ()
 Get the global default precision (digits) for multiprecision numbers.
void DefaultPrecision (unsigned prec)
 Set the global default precision (digits) for multiprecision numbers, on this thread and globally.
void SetThreadPrecision (unsigned prec)
 Set the precision (digits) for the current thread only (does not touch the global default).
unsigned ThreadPrecision ()
 Get the current thread's precision (digits).
auto Precision (complex_mp const &num)
 Get the precision of a number.
void Precision (complex_mp &num, unsigned prec)
 Change the precision of a number.
bool isnan (complex_mp const &num)
 Query whether either component of a multiprecision complex number is NaN.
auto Precision (real_mp const &num)
 Get the precision of a real number.
void Precision (real_mp &num, unsigned prec)
 Change the precision of a real number.
template<typename T>
T max (T const &a, T const &b, T const &c)
 Three-argument form of max.
template<typename T>
T max (T const &a, T const &b, T const &c, T const &d)
 Four-argument form of max.
template<typename T>
T max (T const &a, T const &b, T const &c, T const &d, T const &e)
 Five-argument form of max.
bool IsIdentStart (char32_t cp)
 True if code point cp may START an identifier: any Unicode letter (ASCII A-Z a-z, plus Ω, α, CJK, ...) or an emoji base code point.
bool IsIdentCont (char32_t cp)
 True if code point cp may CONTINUE an identifier: any Unicode alphanumeric, one of the legacy continuation characters [ ] _, or an emoji base / sequence-glue code point (so a whole emoji reads as one name).
bool IsValidVariableName (std::string const &s)
 True if s is a well-formed identifier: nonempty, a valid UTF-8 IsIdentStart code point followed by zero or more IsIdentCont code points.
void ThrowIfInvalidVariableName (std::string const &s)
 Throw std::runtime_error if s is not a valid variable name (.
template<typename T>
T RandomUnit ()
 Get a random complex number of unit modulus, in number type T.
unsigned PrecisionIncrement ()
 The number of digits by which adaptive precision is increased at each step.
constexpr unsigned DoublePrecision ()
 The number of digits considered "double precision" (16).
constexpr unsigned LowestMultiplePrecision ()
 The lowest multiple-precision digit count used (20).
constexpr unsigned MaxPrecisionAllowed ()
 The maximum precision (digits) the library will escalate to.
unsigned Precision (double)
 Get the precision of a number.
void Precision (double, unsigned prec)
 For complex doubles, throw if the requested precision is not DoublePrecision.
unsigned Precision (complex_dbl)
 Get the precision of a number.
void Precision (complex_dbl, unsigned prec)
 For complex doubles, throw if the requested precision is not DoublePrecision.
complex_dbl rand_complex ()
 Get a random double-precision complex number (not unit modulus; see RandomUnit).
template<>
complex_dbl RandomUnit< complex_dbl > ()
 Get a random double-precision complex number of unit modulus.
template<>
complex_mp RandomUnit< complex_mp > ()
 Get a random multiprecision complex number of unit modulus.
template<>
real_mp RandomUnit< real_mp > ()
 Get a random multiprecision real number of unit modulus (i.e.
template<typename NumberType>
NumberType RandomOrthonormalSeed ()
 The entry a random orthonormal matrix is seeded with before its QR factorization: a unit draw for the complex types.
template<>
real_mp RandomOrthonormalSeed< real_mp > ()
 A real orthonormal seed entry: uniform on [-1, 1], never a bare sign.
void SetGlobalSeed (unsigned long seed)
 Set the global RNG seed.
unsigned long SetGlobalSeedFromEntropy ()
 Set the global RNG seed to one drawn from std::random_device, and return it, so the run can be reproduced by setting that seed.
unsigned long ApplyClassicRandomSeed (unsigned long randomseed)
 Apply a classic input file's randomseed, as Bertini 1 does: 0, the default, draws a seed from entropy; any other value is the seed.
unsigned long GetGlobalSeed ()
 Returns the effective global seed.
void ReseedThisThread (uint64_t stream_key)
 Reseed this thread's engine deterministically from the global seed mixed with stream_key.
unsigned long DerivedWorkerSeed (uint64_t worker_index)
 Derive a distinct, deterministic child seed for a worker rank from the global (master) seed.
unsigned long DeriveSolveSeed ()
 Derive an EFFECTIVE PER-SOLVE SEED from the current master.
template<unsigned long digits = 50>
mpz_int RandomInt ()
 Generate a random integer number between -10^digits and 10^digits.
template<unsigned long digits = 50>
mpq_rational RandomRat ()
 Generate a random rational number with numerator and denomenator between -10^digits and 10^digits.
template<unsigned int length_in_digits>
real_mp RandomMp ()
 Produce a random number with at length_in_digits non-zero digits.
template<unsigned int length_in_digits>
void RandomMpAssign (real_mp &a)
 a templated function for producing random numbers in the unit interval, of a given number of digits.
template<unsigned int length_in_digits>
real_mp RandomMp (const real_mp &left, const real_mp &right)
 a templated function for producing random numbers in a specified interval, of a given number of digits.
real_mp RandomMp ()
 create a random number, at the current default precision
real_mp RandomMp (unsigned num_digits)
 create a random number, at the specified precision
real_mp RandomMp (const real_mp &a, const real_mp &b)
 create a random number in a given interval, at the current default precision
real_mp RandomMp (const real_mp &a, const real_mp &b, unsigned num_digits)
 create a random number in a given interval, at the specified precision
void RandomMpAssign (real_mp &a, unsigned num_digits)
 Set an existing real_mp to a random number, to a given precision.
template<typename T>
T EvalExpression (std::shared_ptr< node::Node > const &expr, std::map< std::string, T > const &variable_values, bool strict=true)
 Evaluate an expression tree at a point supplied as a variable-name -> value map.
std::ostream & operator<< (std::ostream &out, Slice const &s)
 Provides output streaming for Slice.
template<typename T>
std::vector< T > IndexToSubscript (T index, std::vector< T > const &dimensions)
 Convert a zero-based index to a zero-based subscript vector.
constexpr bool IsUnary (Operation op)
 Query whether an operation takes a single operand.
constexpr bool IsBinary (Operation op)
 Query whether an operation takes two operands.
std::string OpcodeToString (Operation op)
 Get a human-readable name for an opcode.
bool SLPValueNumbering ()
 Whether the SLP compiler value-numbers (instruction-level CSE) while emitting the tape: an identical (op, operand-slots) computation reuses the earlier result slot instead of recomputing.
void SetSLPValueNumbering (bool on)
 Set whether the SLP compiler value-numbers while emitting the tape.
std::shared_ptr< const SLPProgram > InternProgram (std::shared_ptr< const SLPProgram > const &candidate)
 Hash-cons a freshly-compiled program: return an existing content-equal SLPProgram if one is live, otherwise register and return the candidate (ADR-0027 E4, ADR-0042).
NodeMatrix SymbolicJacobian (std::vector< std::shared_ptr< node::Node > > const &functions, VariableGroup const &variables)
 The symbolic Jacobian of a list of functions w.r.t.
System Concatenate (System sys1, System const &sys2)
 Concatenate two compatible systems.
std::string UniquePathVariableName (System const &target, std::string base="t")
 Produce a path-variable name guaranteed not to collide with any variable in target.
System MakeHomotopy (System const &target, System const &start, std::string const &path_variable_name="", std::shared_ptr< node::Node > const &gamma=nullptr)
 Form the gamma-trick straight-line homotopy H = (1-t)*target + gamma*t*start.
void CheckVariableStructuresMatch (System const &a, System const &b, std::string const &operation, std::string const &a_name, std::string const &b_name)
 Throw unless two systems describe points the same way, so that combining them is meaningful.
void AdoptVariableStructure (System &into, System const &from)
 Give a system that declares no variables the variable structure of another.
System MakeMovingHomotopy (System const &fixed, System const &start_moving, System const &end_moving, std::string const &path_variable_name="", std::shared_ptr< node::Node > const &gamma=nullptr)
 Form a homotopy that moves ONLY some rows, leaving the rest fixed and evaluated once.
System Clone (System const &sys)
 Do a deep clone of the system.
void Simplify (System &sys)
 Free form function for simplifying systems.
std::shared_ptr< const System > InternSystem (std::shared_ptr< System > const &candidate)
 Hash-cons a System: return the live sealed representative with equal ContentDigest() if one exists, else seal and register the candidate (ADR-0042).
std::shared_ptr< const System > LoadSystemUnified (std::istream &in)
 Load a System from a text archive and unify it with the live intern universe (ADR-0042): deserialize, ReinternNodes, InternSystem.

Variables

const int BinaryOperations = Add|Subtract | Multiply|Divide | Power | IntPower
 Bit-mask of the two-operand operations.
const int TrigOperations = Sin|Cos|Tan | Asin|Acos|Atan
 Bit-mask of the trigonometric operations.
const int UnaryOperations = Exp|Log | Negate | Assign | TrigOperations | Sqrt
 Bit-mask of the one-operand operations.
constexpr size_t kOpcodeMask = (static_cast<size_t>(1) << 17) - 1
 Mask recovering the base opcode from an instruction word.
constexpr size_t kArg0Real = static_cast<size_t>(1) << 20
 High bit: first operand slot is NumType::Real.
constexpr size_t kArg1Real = static_cast<size_t>(1) << 21
 High bit: second operand slot is Real (binary, not IntPower).
constexpr size_t kOutReal = static_cast<size_t>(1) << 22
 High bit: result slot is NumType::Real.
constexpr char SystemEncodingVersion [] = "b2sysenc/2"
 The version token of the System canonical encoding – the first word of every encoding text and the schema of every archived system definition.

Typedef Documentation

◆ Block

The closed set of evaluation blocks a System can be composed of.

Grows as block types are added (eventually a PolynomialBlock so the polynomial part is uniform too).

◆ complex_dbl

using bertini::complex_dbl = std::complex<double>

The double-precision complex number type.

◆ complex_mp

using bertini::complex_mp = bmp::number<mpc_complex_backend<0>, bmp::et_on >

The arbitrary-precision complex number type.

◆ ConstEvent

template<typename ObsT>
using bertini::ConstEvent = Event<ObsT,true>

An event holding a const reference to its observable.

◆ ifstream

using bertini::ifstream = std::ifstream

Shorthand for an input file stream.

◆ Mat

template<typename NumT>
using bertini::Mat = Eigen::Matrix<NumT, Eigen::Dynamic, Eigen::Dynamic>

A dynamically-sized matrix of NumT.

◆ mpq_rational

using bertini::mpq_rational = boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on>

The exact rational number type.

◆ mpz_int

using bertini::mpz_int = boost::multiprecision::number<boost::multiprecision::backends::gmp_int, boost::multiprecision::et_on>

The arbitrary-precision integer type.

◆ MutableEvent

template<typename ObsT>
using bertini::MutableEvent = Event<ObsT,false>

An event holding a mutable reference to its observable.

◆ NumErrorT

using bertini::NumErrorT = double

The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances, Newton residuals, condition numbers, same-point tolerances.

Declared here in the foundational num_traits header (included nearly everywhere) so tolerance-typed parameters can spell this alias instead of a bare double without any header adding a new include – keeping recompilation frequency and scope unchanged.

◆ Path

using bertini::Path = fs::path

Shorthand for a filesystem path.

◆ real_dbl

using bertini::real_dbl = double

The double-precision real number type.

◆ real_mp

using bertini::real_mp = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_on>

The arbitrary-precision real number type.

◆ SampCont

template<typename T>
using bertini::SampCont = std::deque<Vec<T> >

◆ SubstitutionMap

using bertini::SubstitutionMap = std::map< std::string, std::shared_ptr<node::Node> >

A substitution request for Node::Subs: variable name -> the node to put in its place.

◆ TimeCont

template<typename T>
using bertini::TimeCont = std::deque<T>

◆ VariableGroup

using bertini::VariableGroup = std::vector< std::shared_ptr<node::Variable> >

An ordered group of variables (the unit of homogenization / variable grouping).

◆ Vec

template<typename NumT>
using bertini::Vec = Eigen::Matrix<NumT, Eigen::Dynamic, 1>

A dynamically-sized column vector of NumT.

Enumeration Type Documentation

◆ ContStart

enum class bertini::ContStart
strong
Enumerator
Front 
Back 

◆ MatrixSuccessCode

enum class bertini::MatrixSuccessCode
strong

Outcome of a matrix-decomposition sanity check (e.g. LU pivot magnitude).

Enumerator
Success 

The decomposition looks healthy.

LargeChange 

A pivot changed by a suspiciously large amount.

SmallValue 

A pivot is suspiciously small (near-singular).

◆ NumType

enum class bertini::NumType : uint8_t
strong

The numeric type a memory slot holds, orthogonal to working precision (ADR-0034).

Precision (double vs multiprecision) is the Eval<NumT> template parameter; this is the ℝ/ℂ axis within a precision. A slot tagged Real lives in the real register bank (real_dbl / real_mp), Complex in the complex bank (complex_dbl / complex_mp). The compiler infers each slot's NumType from the function tree (a constant whose imaginary part is zero, an Integer, a Rational with zero imaginary part, Pi/E are Real; variables and the path variable are Complex; an operator's result is the join of its operands, escaping to Complex for ops that can leave ℝ). Integer is reserved for a later stage; S1 uses {Real, Complex}.

Enumerator
Real 
Complex 

◆ ObserveResult

enum class bertini::ObserveResult
strong

The result an observer returns from Observe(), telling the observable whether to keep sending it events.

Returning Unsubscribe is the clean, dispatch-safe way for an observer to stop receiving events: the observable removes it after the current notification loop finishes (no mid-iteration mutation of the observer list). This replaces the old pattern of calling RemoveObserver(*this) from inside Observe().

Enumerator
KeepObserving 
Unsubscribe 

◆ Operation

The opcodes for the operations a straight-line program instruction can perform.

Enumerator
Add 
Subtract 
Multiply 
Divide 
Power 
Exp 
Log 
Negate 
Sqrt 
Sin 
Cos 
Tan 
Asin 
Acos 
Atan 
Assign 
IntPower 

◆ SuccessCode

enum class bertini::SuccessCode
strong
Enumerator
NeverStarted 

No tracking was attempted.

This is a DEFAULT, never a verdict: no tracker returns it, and none may start to, because callers read it as "we never touched this path" and act on that – a solve records nothing for such a path, counts it as unreached, and reports itself cut short. A path that was attempted and got nowhere has a code that says what stopped it (SingularStartPoint from the initial refinement, MaxNumStepsTaken and its siblings from the per-iteration budgets, ExternallyTerminated, WallClockLimitReached). Pinned by test: a_tracker_never_returns_never_started.

Success 
HigherPrecisionNecessary 
ReduceStepSize 
GoingToInfinity 
FailedToConverge 
MatrixSolveFailure 
MatrixSolveFailureFirstPartOfPrediction 
MaxNumStepsTaken 
MaxPrecisionReached 
MinStepSizeReached 
Failure 
SingularStartPoint 
ExternallyTerminated 
MinTrackTimeReached 
SecurityMaxNormReached 
CycleNumTooHigh 
FailedToSelectPrecisionAndStepsize 
WallClockLimitReached 

The tracker's wall-clock deadline passed between steps; the path was abandoned where it was. Append new values AFTER this one: the integers are part of the b2rec record contract.

◆ VariableGroupType

enum class bertini::VariableGroupType
strong

How a variable group participates in homogenization.

Enumerator
Homogeneous 

A projective (homogeneous) variable group.

Affine 

An affine variable group (to be homogenized).

Ungrouped 

Variables not assigned to any group.

Function Documentation

◆ AdoptVariableStructure()

void bertini::AdoptVariableStructure ( System & into,
System const & from )

Give a system that declares no variables the variable structure of another.

The groups, their order, and the homogenizing variables are taken from from. A path variable into already has is kept. This is what the combining operations do with an operand that says nothing about variables: it is taken to be over the other operand's.

Parameters
intoThe system to receive the structure; it must declare no variables.
fromThe system whose variable structure is taken.
Exceptions
std::runtime_errorIf into already declares variables.

◆ ApplyClassicRandomSeed()

unsigned long bertini::ApplyClassicRandomSeed ( unsigned long randomseed)

Apply a classic input file's randomseed, as Bertini 1 does: 0, the default, draws a seed from entropy; any other value is the seed.

Only the classic input format reads 0 this way; to SetGlobalSeed it is an ordinary seed.

Parameters
randomseedThe value of randomseed in the classic input file.
Returns
The seed now in effect.

◆ BoostHeaderVersion()

std::string bertini::BoostHeaderVersion ( )
inline

Get the version of the Boost headers compiled against.

◆ CheckVariableStructuresMatch()

void bertini::CheckVariableStructuresMatch ( System const & a,
System const & b,
std::string const & operation,
std::string const & a_name,
std::string const & b_name )

Throw unless two systems describe points the same way, so that combining them is meaningful.

Checks that the two are over THE SAME VARIABLES: the same variable objects, in the same groups, in the same order – and, when both are patched, that they carry the same patch. An unpatched system is free to adopt the other's, which is what System+=System does. Variables are canonical by name, so "the same object" and "the same name" are one statement, and a system that came out of an archive satisfies it (ADR-0068).

It compares the variables, not how many there are. Two systems over (x, y) and (y, x) agree in every count and mean different things by a point; a blend of them evaluates one of them with its coordinates exchanged, and nothing downstream notices. The same goes for combining a projective system with an affine one, or two projective systems on different patches. This is the check that notices, and every operation that combines systems makes it: Concatenate, MakeHomotopy, MakeMovingHomotopy, +=.

A system that declares no variables at all is not checked by those operations: it takes the other's variable structure (see AdoptVariableStructure).

Parameters
aThe first system.
bThe second system.
operationThe name of the operation being attempted, for the message.
a_nameHow to refer to a in the message, e.g. "the target system".
b_nameHow to refer to b in the message.
Exceptions
std::runtime_errorIf the two cannot meaningfully be combined.

◆ ClearStopRequest()

void bertini::ClearStopRequest ( )

Withdraw a stop request, so later computations run normally.

◆ Clone()

System bertini::Clone ( System const & sys)

Do a deep clone of the system.

This includes the entire structure, variables, etc. everything.

◆ Concatenate()

System bertini::Concatenate ( System sys1,
System const & sys2 )

Concatenate two compatible systems.

Two systems are compatible for concatenation if they have the same variable structure, and if they have the same patch (if patched).

Parameters
sys1The top system.
sys2The bottom system.

If both patched both must have same patch. If not both are patched, then the patch will propagate to the returned system.

If the two patches have differing variable orderings, the call to Concatenate will throw.

◆ ContainsNaN()

template<typename Derived>
bool bertini::ContainsNaN ( Eigen::MatrixBase< Derived > const & v)
inline

True when any entry of a complex-valued Eigen object has a NaN real or imaginary part.

Component-wise isnan is REQUIRED for correctness: the self-inequality trick (z != z) does not work for complex_mp, whose equality does not follow IEEE NaN semantics (a NaN complex_mp compares EQUAL to itself) – which also makes Eigen's own hasNaN() unreliable there.

◆ DefaultPrecision() [1/2]

auto bertini::DefaultPrecision ( )
inline

Get the global default precision (digits) for multiprecision numbers.

◆ DefaultPrecision() [2/2]

void bertini::DefaultPrecision ( unsigned prec)
inline

Set the global default precision (digits) for multiprecision numbers, on this thread and globally.

◆ DefaultPrecisionPolicy()

auto bertini::DefaultPrecisionPolicy ( )
inline

The default Boost.Multiprecision variable-precision policy used by bertini.

◆ DependencyVersions()

std::string bertini::DependencyVersions ( )
inline

Get a multi-line summary of the versions of Bertini2's dependencies (Boost, Eigen, GMP, MPFR).

◆ DerivedWorkerSeed()

unsigned long bertini::DerivedWorkerSeed ( uint64_t worker_index)

Derive a distinct, deterministic child seed for a worker rank from the global (master) seed.

The MPI manager computes one per worker and hands it over; the worker calls SetGlobalSeed(child), giving every process its own non-overlapping deterministic stream – all reproducible from the one user seed, and no two processes ever generate the same random value.

◆ DeriveSolveSeed()

unsigned long bertini::DeriveSolveSeed ( )

Derive an EFFECTIVE PER-SOLVE SEED from the current master.

A seedless solve's setup draws (gamma, patch, start coefficients) come sequentially off the session stream, so they depend on everything drawn before – recording the session master seed under-determines such a run. Instead, the solve surface calls this at solve start when no explicit seed was given, passes the result to SetGlobalSeed, and records it as the run's ask seed: replaying that one number standalone rebuilds the identical homotopy.

The derivation is (master, solve ordinal) through pure integer mixing – NOT a draw from the thread-local streams, whose position after a multithreaded solve is scheduling-dependent. SetGlobalSeed resets the ordinal, and the solve surface rekeys to each derived seed, so consecutive seedless solves form a deterministic seed chain from the initial master: same master, same sequence of solves, same seeds – on every platform (the value is masked to 32 bits for LLP64 Windows). Never returns 0, so a recorded seed replays through a classic input file, where randomseed: 0 means "draw from entropy".

Returns
A nonzero seed for this solve, ready for SetGlobalSeed and the ask record.

◆ DoublePrecision()

unsigned bertini::DoublePrecision ( )
constexpr

The number of digits considered "double precision" (16).

◆ EigenHeaderVersion()

std::string bertini::EigenHeaderVersion ( )
inline

Get the version of the Eigen headers compiled against.

◆ EvalExpression()

template<typename T>
T bertini::EvalExpression ( std::shared_ptr< node::Node > const & expr,
std::map< std::string, T > const & variable_values,
bool strict = true )

Evaluate an expression tree at a point supplied as a variable-name -> value map.

The expression's variables are discovered with node::GatherVariables (distinct, sorted by name — the session-global canonical order), a one-function program is compiled for the expression (memoized on the node) and run at the point. Variables are matched to values by name, which is unambiguous because variables are canonical by name across the whole session.

Every variable appearing in the expression must have a supplied value; a missing value always throws (there is no number to return without it). When strict is true (the default), every supplied name must also appear in the expression — a guard against typos, since a value silently going nowhere is usually a mistake. When strict is false, names that are not variables of the expression are ignored: the expression is simply constant with respect to them. This lets one full point be reused across an expression and its derivatives (which drop variables), without pre-filtering.

Template Parameters
TThe evaluation number type (complex_dbl or complex_mp).
Parameters
exprThe expression to evaluate.
variable_valuesA map from variable name to the value to substitute.
strictWhen true, reject supplied names absent from the expression; when false, ignore them.
Returns
The value of the expression at the given point.

◆ FileToString()

std::string bertini::FileToString ( Path const & input_path)
inline

Read an entire file into a string.

Returns
The string, now contaning the file.
Parameters
input_pathThe path to the file.

◆ GenericHelp()

std::string bertini::GenericHelp ( )
inline

Get the generic help text (currently empty).

◆ GetGlobalSeed()

unsigned long bertini::GetGlobalSeed ( )

Returns the effective global seed.

If no seed has been set, draws one from entropy on the first call and keeps it.

◆ GMPVersion()

std::string bertini::GMPVersion ( )
inline

Get the version of the GMP library linked against.

◆ IndexToSubscript()

template<typename T>
std::vector< T > bertini::IndexToSubscript ( T index,
std::vector< T > const & dimensions )

Convert a zero-based index to a zero-based subscript vector.

Throws std::out_of_range if the index is out-of-range based on the dimensions.

This goes from front to back, top to bottom. So

[0 2 4 [(0,0) (0,1) (0,2) 1 3 5] (1,0) (1,1) (1,2)]

etc for higher-dimensional arrays. The functionality here is identical to that of Matlab's analagous call.

Parameters
indexThe index you want to convert.
dimensionsThe dimensions of the object you are subscripting or indexing into.
Returns
A vector containing the subscripts for the input index.
Exceptions
std::out_of_range,ifthe index is impossible to convert.

◆ InstallFastAllocator()

void bertini::InstallFastAllocator ( )

Install the fast multiprecision allocator (idempotent; safe to call more than once).

Call once, as early as possible, before heavy multiprecision work: at the top of main in the CLI, and at module import in the Python bindings. No-op if built without mimalloc or if the environment variable BERTINI2_NO_FAST_ALLOC is set.

◆ InternProgram()

std::shared_ptr< const SLPProgram > bertini::InternProgram ( std::shared_ptr< const SLPProgram > const & candidate)

Hash-cons a freshly-compiled program: return an existing content-equal SLPProgram if one is live, otherwise register and return the candidate (ADR-0027 E4, ADR-0042).

The Program-level analogue of node::Intern: a process-global, weak (self-cleaning), mutex-guarded table keyed by SLPProgram::ContentHash() and disambiguated by SameContent(). Facades (StraightLineProgram) sharing one interned Program each keep their own SLPMemory, so the ADR-0027 threading contract is unchanged. Wired into SLPCompiler::Compile and StraightLineProgram deserialization, so identical compiled tapes – including ones loaded from archives – collapse to a single shared immutable object.

◆ InternSystem()

std::shared_ptr< const System > bertini::InternSystem ( std::shared_ptr< System > const & candidate)

Hash-cons a System: return the live sealed representative with equal ContentDigest() if one exists, else seal and register the candidate (ADR-0042).

The System-level analogue of node::Intern / InternProgram: a process-global, mutex-guarded, weak (self-cleaning) table keyed by the full 256-bit content digest, so no equality disambiguation chain is needed. The candidate is sealed as a side effect (an interned identity must not mutate); the returned handle is const – interned Systems are shared. Copy an interned System to get an unsealed, mutable one.

Parameters
candidateThe system to intern; sealed if it becomes the representative.
Returns
The shared representative (the candidate itself on a table miss).

◆ IsBinary()

bool bertini::IsBinary ( Operation op)
constexpr

Query whether an operation takes two operands.

◆ IsDistinct()

template<typename DerivedA, typename DerivedB>
bool bertini::IsDistinct ( Eigen::MatrixBase< DerivedA > const & a,
Eigen::MatrixBase< DerivedB > const & b,
NumErrorT tol )
inline

True if two points differ by more than tol in the infinity norm (the negation of :func:IsSamePoint).

Points of different lengths are distinct. See issue #304.

Parameters
aOne point.
bThe other point.
tolThe (absolute) infinity-norm tolerance.

◆ IsEmpty()

template<typename Derived>
bool bertini::IsEmpty ( Eigen::MatrixBase< Derived > const & v)
inline

Checks whether the number of rows and columns are either 0.

◆ IsIdentCont()

bool bertini::IsIdentCont ( char32_t cp)
inline

True if code point cp may CONTINUE an identifier: any Unicode alphanumeric, one of the legacy continuation characters [ ] _, or an emoji base / sequence-glue code point (so a whole emoji reads as one name).

◆ IsIdentStart()

bool bertini::IsIdentStart ( char32_t cp)
inline

True if code point cp may START an identifier: any Unicode letter (ASCII A-Z a-z, plus Ω, α, CJK, ...) or an emoji base code point.

◆ IsLargeChange()

template<typename T>
bool bertini::IsLargeChange ( T const & numerator,
T const & denomenator )
inline

Test two numbers for having large ratio.

The basis for comparison is Eigen's fuzzy precision, Eigen::NumTraits<T>::dummy_precision();

Note
For doubles, the threshold is 1e-12, for mpfr_real is 1e3*current precision.
Parameters
numeratorThe numerator for the ratio.
denomenatorThe denomenator for the ratio.
Returns
true, if the ratio is very large, false otherwise

◆ isnan() [1/2]

bool bertini::isnan ( complex_mp const & num)
inline

Query whether either component of a multiprecision complex number is NaN.

◆ isnan() [2/2]

bool bertini::isnan ( std::complex< double > const & z)
inline

an overload of isnan, for std::complex<double>

◆ IsSamePoint()

template<typename DerivedA, typename DerivedB>
bool bertini::IsSamePoint ( Eigen::MatrixBase< DerivedA > const & a,
Eigen::MatrixBase< DerivedB > const & b,
NumErrorT tol )
inline

True if two points are the same to within tol in the infinity norm.

The tolerance-based point-equality test: max_i |a_i - b_i| <= tol. Points of different lengths are never the same. This is the primitive behind :func:bertini.is_distinct_up_to and the solver's point->metadata lookup (issue #304).

Parameters
aOne point.
bThe other point.
tolThe (absolute) infinity-norm tolerance.

◆ IsSmallValue()

template<typename T>
bool bertini::IsSmallValue ( T const & testme)
inline

Test a numbers being very small.

Compares the number against machine epsilon (or software epsilon if a multiple precision type), times 100.

Note
Machine epsilon for doubles is about 1e-16, for mpfr_real, it's 10^-current precision.
Parameters
testmeThe number to test
Returns
true, if the number is very small. False otherwise.

◆ IsSymmRelDiffSmall()

template<typename T>
bool bertini::IsSymmRelDiffSmall ( T const & a,
T const & b,
typename Eigen::NumTraits< T >::Real const & e )
inline

Check whether two values are very close to each other.

Template Parameters
TThe numeric type.
Parameters
aThe first value.
bThe second value.
eThe tolerance for being close.

See http://www.boost.org/doc/libs/1_34_0/libs/test/doc/components/test_tools/floating_point_comparison.html, for example.

◆ IsUnary()

bool bertini::IsUnary ( Operation op)
constexpr

Query whether an operation takes a single operand.

◆ IsValidVariableName()

bool bertini::IsValidVariableName ( std::string const & s)
inline

True if s is a well-formed identifier: nonempty, a valid UTF-8 IsIdentStart code point followed by zero or more IsIdentCont code points.

Rejects the empty string, leading digits, operators, whitespace, and malformed UTF-8.

◆ KahanMatrix()

template<typename NumberType>
Eigen::Matrix< NumberType, Eigen::Dynamic, Eigen::Dynamic > bertini::KahanMatrix ( unsigned int mat_size,
NumberType c )

Make a Kahan matrix with a given number type.

◆ LicenseInfo()

std::string bertini::LicenseInfo ( )
inline

Get a short description of Bertini2's licensing.

◆ LoadSystemUnified()

std::shared_ptr< const System > bertini::LoadSystemUnified ( std::istream & in)

Load a System from a text archive and unify it with the live intern universe (ADR-0042): deserialize, ReinternNodes, InternSystem.

The returned handle is the live sealed representative: if an equal system already exists in memory, THAT one comes back (its nodes shared with everything else); the loaded copy is discarded. This is the cross-session identity entry point – the same system loaded from two archives, or loaded and independently rebuilt, is one object.

Parameters
inThe stream holding a boost text archive written by oa << system.
Returns
The interned representative of the loaded system.

◆ LowestMultiplePrecision()

unsigned bertini::LowestMultiplePrecision ( )
constexpr

The lowest multiple-precision digit count used (20).

◆ LUPartialPivotDecompositionSuccessful()

template<typename Derived>
MatrixSuccessCode bertini::LUPartialPivotDecompositionSuccessful ( Eigen::MatrixBase< Derived > const & LU)

Check the diagonal elements of an LU decomposition for small values and large ratios.

Returns
Success if things are ok. LargeChange or SmallValue if one is found.

This function requires a square non-empty matrix.

Template Parameters
DerivedMatrix type from Eigen.

◆ MainModeSwitch()

int bertini::MainModeSwitch ( ParsedArgs const & args)

Route to the appropriate algorithm based on parsed arguments and the tracktype found in the input file's CONFIG section.

Returns
0 on success, nonzero on failure or unimplemented tracktype.

◆ MakeHomotopy()

System bertini::MakeHomotopy ( System const & target,
System const & start,
std::string const & path_variable_name = "",
std::shared_ptr< node::Node > const & gamma = nullptr )

Form the gamma-trick straight-line homotopy H = (1-t)*target + gamma*t*start.

The path variable t (named path_variable_name) is added to the returned homotopy, tracked from t=1 (where H is gamma*start, so its roots are start's solutions) down to t=0 (where H is target). When start carries a structured evaluation block (e.g. a products-of-linears start system) it cannot be fused by node arithmetic, so the two systems are combined with a BlendBlock that evaluates whole Systems; otherwise the node-arithmetic combination is used. This is the same construction the zero-dim solver's CloneGiven policy uses internally; it is exposed so a user-authored start system can be turned into a trackable homotopy for the user-homotopy solve path.

Parameters
targetThe target system (H at t=0).
startThe start system whose solutions seed the homotopy (H at t=1).
path_variable_nameThe name to give the homotopy's path variable. Defaults to empty, meaning "choose a safe name": a collision-free name based on t is generated via UniquePathVariableName(target). Pass a non-empty name to force it (it must not collide with a variable in target, or AddPathVariable throws).
gammaThe gamma coefficient (a node). If null, a random rational gamma is generated.

◆ MakeMovingHomotopy()

System bertini::MakeMovingHomotopy ( System const & fixed,
System const & start_moving,
System const & end_moving,
std::string const & path_variable_name = "",
std::shared_ptr< node::Node > const & gamma = nullptr )

Form a homotopy that moves ONLY some rows, leaving the rest fixed and evaluated once.

The "regeneration" homotopy: fixed holds the equations that do not move (the polynomial system and any static linear slices); start_moving and end_moving are systems holding just the rows that move, agreeing in function count and variable structure. The result is

H = [ fixed's blocks (unchanged) ;  (1-t)*end_moving + gamma*t*start_moving ]

with the moving rows produced by a single BlendBlock over end_moving/start_moving and the fixed rows kept as their own sibling blocks. Because the fixed blocks are autonomous, they are evaluated exactly once per point and contribute zero to dH/dt – the fixed system is never re-evaluated or scaled by the path coefficient as the moving rows slide. At t=1 the moving rows are gamma*start_moving (so the start points are roots of fixed together with start_moving), at t=0 they are end_moving.

The fixed rows come first, then the moving rows; build the matching target (for the user-homotopy pipeline) as fixed concatenated with end_moving, and the start points as the roots of fixed together with start_moving.

Parameters
fixedThe equations that do not move (evaluated once per point).
start_movingThe moving rows at t=1 (their roots, with fixed, are the start points).
end_movingThe moving rows at t=0 (the target rows).
path_variable_nameThe name to give the homotopy's path variable. Defaults to empty, meaning "choose a safe name": a collision-free name based on t is generated via UniquePathVariableName(fixed). Pass a non-empty name to force it (it must not collide with a variable in fixed, or AddPathVariable throws).
gammaThe gamma coefficient (a node). If null, a random rational gamma is generated.

◆ max() [1/3]

template<typename T>
T bertini::max ( T const & a,
T const & b,
T const & c )

Three-argument form of max.

Parameters
aInput one
bInput two
cInput three

◆ max() [2/3]

template<typename T>
T bertini::max ( T const & a,
T const & b,
T const & c,
T const & d )

Four-argument form of max.

Parameters
aInput one
bInput two
cInput three
dInput four

◆ max() [3/3]

template<typename T>
T bertini::max ( T const & a,
T const & b,
T const & c,
T const & d,
T const & e )

Five-argument form of max.

Parameters
aInput one
bInput two
cInput three
dInput four
eInput five

◆ MaxPrecisionAllowed()

unsigned bertini::MaxPrecisionAllowed ( )
constexpr

The maximum precision (digits) the library will escalate to.

◆ MPFRVersion()

std::string bertini::MPFRVersion ( )
inline

Get the version of the MPFR library linked against.

◆ MPIVersion()

std::string bertini::MPIVersion ( )
inline

Get the version of the MPI library linked against (or a note if serial).

◆ OpcodeToString()

std::string bertini::OpcodeToString ( Operation op)

Get a human-readable name for an opcode.

◆ OpenInFileThrowIfFail()

void bertini::OpenInFileThrowIfFail ( ifstream & in,
Path const & input_path )
inline

Try to open a file, and throw if it doesn't exist, or is a directory.

◆ operator*()

std::complex< double > bertini::operator* ( unsigned i,
std::complex< double > z )
inline

Overload * for unsigned * complex<double>.

◆ operator<<() [1/2]

std::ostream & bertini::operator<< ( std::ostream & out,
Slice const & s )

Provides output streaming for Slice.

◆ operator<<() [2/2]

template<typename T>
std::ostream & bertini::operator<< ( typename std::enable_if< std::is_enum< T >::value, std::ostream >::type & stream,
const T & e )

Method for printing class enums to streams.

This was adapted from https://stackoverflow.com/questions/11421432/how-can-i-output-the-value-of-an-enum-class-in-c11 asked by user Adi, answered by James Adkison. This code was provided CC-BY-SA 3.

This code does NOT work for streaming enum classes to Boost.Log streams.

Parameters
streamThe stream to print to.
eThe enum value to print
Returns
The stream you are writing to.

◆ Owners()

std::string bertini::Owners ( )
inline

Get the names of the Bertini trademark owners.

◆ ParseArgcArgv()

ParsedArgs bertini::ParseArgcArgv ( int argc,
char ** argv )

Parse command-line arguments and return a ParsedArgs struct.

Recognized flags: -f <file> use <file> as the input file (overrides default "input") <file> bare positional argument treated as input file path –help print usage and exit –version print version and exit

Parameters
argcThe number of arguments.
argvThe argument strings.

◆ pow()

complex_dbl bertini::pow ( const complex_dbl & z,
int power )
inline

Compute +,- integral powers of a std::complex<double> number.

This function recursively calls itself if the power is negative, by computing the power on the inverse.

Note
This overload was removed from C++ in C++11, for some insane reason. Here it is, back in black.

◆ Precision() [1/10]

unsigned bertini::Precision ( complex_dbl )
inline

Get the precision of a number.

For complex doubles, this is trivially 16.

◆ Precision() [2/10]

void bertini::Precision ( complex_dbl ,
unsigned prec )
inline

For complex doubles, throw if the requested precision is not DoublePrecision.

◆ Precision() [3/10]

void bertini::Precision ( complex_mp & num,
unsigned prec )
inline

Change the precision of a number.

For mpfr_floats, this calls the precision member method for real_mp.

◆ Precision() [4/10]

auto bertini::Precision ( complex_mp const & num)
inline

Get the precision of a number.

For mpfr_floats, this calls the precision member method for real_mp.

◆ Precision() [5/10]

unsigned bertini::Precision ( double )
inline

Get the precision of a number.

For doubles, this is trivially 16.

◆ Precision() [6/10]

void bertini::Precision ( double ,
unsigned prec )
inline

For complex doubles, throw if the requested precision is not DoublePrecision.

◆ Precision() [7/10]

template<typename Derived>
void bertini::Precision ( Eigen::MatrixBase< Derived > & v,
unsigned prec )

Set the precision of an Eigen object.

Parameters
vthe matrix to change
precthe new precision

◆ Precision() [8/10]

template<typename Derived>
unsigned bertini::Precision ( Eigen::MatrixBase< Derived > const & v)
inline

Get the precision of an Eigen object.

If the object is empty, it's the precision of a default-constructed Scalar. If it actually has content, then it's the precision of the first element.

If you require that the object be of uniform precision when you check, use PrecisionRequireUniform

◆ Precision() [9/10]

void bertini::Precision ( real_mp & num,
unsigned prec )
inline

Change the precision of a real number.

For mpfr_floats, this calls the precision member method for real_mp.

◆ Precision() [10/10]

auto bertini::Precision ( real_mp const & num)
inline

Get the precision of a real number.

For mpfr_floats, this calls the precision member method for real_mp.

◆ PrecisionIncrement()

unsigned bertini::PrecisionIncrement ( )
inline

The number of digits by which adaptive precision is increased at each step.

◆ PrecisionRequireUniform()

template<typename Derived>
unsigned bertini::PrecisionRequireUniform ( Eigen::MatrixBase< Derived > const & v)

Query the precision of an Eigen object, requiring it to be non-empty, and of uniform precision.

Exceptions
runtime_errorif not uniform precision Dies in an Eigen assert if empty (assuming you didn't disable these)

◆ rand_complex()

complex_dbl bertini::rand_complex ( )
inline

Get a random double-precision complex number (not unit modulus; see RandomUnit).

◆ RandomConjugateOrthonormalMatrix()

template<typename NumberType>
Mat< NumberType > bertini::RandomConjugateOrthonormalMatrix ( unsigned int rows,
unsigned int cols )
inline

Make a random conjugate-orthonormal matrix (orthonormal rows when rows<=cols, orthonormal columns when rows>=cols), to the current default precision.

Bertini 1 builds every random complex matrix conjugate-orthonormal (unitary), and when it needs a non-square shape it generates a SQUARE one and truncates. This produces the same distribution by a factorization sized to the shape requested: draw a tall random matrix (the longer side by the shorter), QR-factor it to a Q with orthonormal columns, and transpose when the requested shape is wide. The leading block of a Haar-distributed unitary IS a Haar-distributed orthonormal frame, so nothing changes statistically; the cost drops from O(max^3) to O(max * min^2) – an 8 x 4908 randomization matrix for an isosingular deflation, which as a 4908 x 4908 factorization did not finish in 900 s, now takes milliseconds (b2#401). The QR launders the seed draw away – the result is conjugate-orthonormal regardless of how the seed was drawn – and perfectly conditioned, which is the point: genericity without scaling trouble. Use it for every random matrix (slices, the randomization tail) the way the bounded-modulus scalar draw is used for individual coefficients (ADR-0041). A square request draws and factors exactly as before, so seeded square matrices are unchanged; non-square ones consume fewer random draws than the old recipe and therefore differ for the same seed.

The seed is a matrix of RandomOrthonormalSeed entries, not of units: a real unit is a sign, and a tall matrix of signs has only 2^thin distinct rows, so the Q built from it has only that many distinct rows – the wide real result then has repeated columns, and a deflated system randomized with it comes out singular. Real seeds are continuous draws; complex seeds are the units they always were.

Parameters
rowsThe number of rows of the returned matrix.
colsThe number of columns of the returned matrix.
Template Parameters
NumberTypethe (complex) number type to fill the matrix with.

◆ RandomInt()

template<unsigned long digits = 50>
mpz_int bertini::RandomInt ( )
inline

Generate a random integer number between -10^digits and 10^digits.

◆ RandomMp() [1/6]

real_mp bertini::RandomMp ( )

create a random number, at the current default precision

◆ RandomMp() [2/6]

template<unsigned int length_in_digits>
real_mp bertini::RandomMp ( )

Produce a random number with at length_in_digits non-zero digits.

Template Parameters
length_in_digitsThe length of the desired random number

◆ RandomMp() [3/6]

real_mp bertini::RandomMp ( const real_mp & a,
const real_mp & b )

create a random number in a given interval, at the current default precision

◆ RandomMp() [4/6]

real_mp bertini::RandomMp ( const real_mp & a,
const real_mp & b,
unsigned num_digits )

create a random number in a given interval, at the specified precision

◆ RandomMp() [5/6]

template<unsigned int length_in_digits>
real_mp bertini::RandomMp ( const real_mp & left,
const real_mp & right )

a templated function for producing random numbers in a specified interval, of a given number of digits.

Template Parameters
length_in_digitsThe length of the desired random number
Parameters
leftThe left bound.
rightThe right bound.

◆ RandomMp() [6/6]

real_mp bertini::RandomMp ( unsigned num_digits)

create a random number, at the specified precision

Parameters
num_digitsthe precision that you desire.

◆ RandomMpAssign() [1/2]

template<unsigned int length_in_digits>
void bertini::RandomMpAssign ( real_mp & a)

a templated function for producing random numbers in the unit interval, of a given number of digits.

Template Parameters
length_in_digitsThe length of the desired random number
Parameters
athe number which will be assigned in this call

◆ RandomMpAssign() [2/2]

void bertini::RandomMpAssign ( real_mp & a,
unsigned num_digits )

Set an existing real_mp to a random number, to a given precision.

This function is how to get random numbers at a precision different from the current default.

◆ RandomOfUnits() [1/2]

template<typename NumberType>
Mat< NumberType > bertini::RandomOfUnits ( unsigned int rows,
unsigned int cols )
inline

Make a random matrix of units (numbers with norm 1).

Returns
The random matrix of units.
Parameters
rowsThe number of rows.
colsThe number of columns.
Template Parameters
NumberTypethe type of number to fill the matrix with.

◆ RandomOfUnits() [2/2]

template<typename NumberType>
Vec< NumberType > bertini::RandomOfUnits ( unsigned int size)
inline

Make a random vector of units (numbers with norm 1).

Returns
The random vector of units.
Parameters
sizeThe length of the vector.
Template Parameters
NumberTypethe type of number to fill the vector with.

◆ RandomOrthonormalSeed()

template<typename NumberType>
NumberType bertini::RandomOrthonormalSeed ( )
inline

The entry a random orthonormal matrix is seeded with before its QR factorization: a unit draw for the complex types.

The QR launders the seed away, so any seed whose columns are generic will do – but the seed must BE generic. The real unit is +1 or -1, and a tall matrix of signs has only 2^cols distinct rows, so its Q has that many distinct rows too: an 8 x 4908 real randomization matrix built from it had 256 distinct columns, and randomizing a deflated system with it produced singular squares. Real seeds are therefore drawn from the symmetric interval instead (see the specialization below); the complex draw, a unit modulus at a uniform angle, is already continuous and is unchanged.

◆ RandomOrthonormalSeed< real_mp >()

A real orthonormal seed entry: uniform on [-1, 1], never a bare sign.

◆ RandomRat()

template<unsigned long digits = 50>
mpq_rational bertini::RandomRat ( )

Generate a random rational number with numerator and denomenator between -10^digits and 10^digits.

◆ RandomUnit()

template<typename T>
T bertini::RandomUnit ( )

Get a random complex number of unit modulus, in number type T.

◆ RandomUnit< complex_dbl >()

template<>
complex_dbl bertini::RandomUnit< complex_dbl > ( )
inline

Get a random double-precision complex number of unit modulus.

◆ RandomUnit< complex_mp >()

template<>
complex_mp bertini::RandomUnit< complex_mp > ( )
inline

Get a random multiprecision complex number of unit modulus.

◆ RandomUnit< real_mp >()

template<>
real_mp bertini::RandomUnit< real_mp > ( )
inline

Get a random multiprecision real number of unit modulus (i.e.

+1 or -1). The real analog of the complex unit draw, so RandomConjugateOrthonormalMatrix<real_mp> (QR of a matrix of real units) yields a real orthogonal matrix.

◆ RandReal()

double bertini::RandReal ( )
inline

Gets you a random real number between -1 and 1, fwiw.

◆ RequestStop()

void bertini::RequestStop ( )

Ask any running computation in this process to stop at its next check.

Safe to call from a signal handler: it only stores to an atomic.

◆ ReseedThisThread()

void bertini::ReseedThisThread ( uint64_t stream_key)

Reseed this thread's engine deterministically from the global seed mixed with stream_key.

Call at the top of each TrackSinglePath* with soln_ind as the key so per-step random draws (condition-number probe, PSEG rand-vector) are path-indexed and mode-independent.

◆ SetGlobalSeed()

void bertini::SetGlobalSeed ( unsigned long seed)

Set the global RNG seed.

Every value is a seed, 0 included, as in numpy and Python's random; SetGlobalSeedFromEntropy asks for an unpredictable one. Must be called before system construction (gamma, patch, TD-constants) to make those setup draws deterministic.

The classic input format differs: there randomseed: 0, its default, means "draw from entropy", as in Bertini 1, and the command-line program reads it that way.

◆ SetGlobalSeedFromEntropy()

unsigned long bertini::SetGlobalSeedFromEntropy ( )

Set the global RNG seed to one drawn from std::random_device, and return it, so the run can be reproduced by setting that seed.

◆ SetSLPValueNumbering()

void bertini::SetSLPValueNumbering ( bool on)

Set whether the SLP compiler value-numbers while emitting the tape.

◆ SetThreadPrecision()

void bertini::SetThreadPrecision ( unsigned prec)
inline

Set the precision (digits) for the current thread only (does not touch the global default).

◆ Simplify() [1/2]

std::shared_ptr< bertini::node::Node > bertini::Simplify ( std::shared_ptr< bertini::node::Node > const & n)

Functionally simplify a tree: returns a NEW simplified tree, leaving the input untouched (non-mutating, copy-on-write; ADR-0011, issue #251).

Thin wrapper over node::Node::Simplified().

◆ Simplify() [2/2]

void bertini::Simplify ( System & sys)

Free form function for simplifying systems.

◆ SLPValueNumbering()

bool bertini::SLPValueNumbering ( )

Whether the SLP compiler value-numbers (instruction-level CSE) while emitting the tape: an identical (op, operand-slots) computation reuses the earlier result slot instead of recomputing.

Complements node-level hash-consing by sharing intermediates that only coincide after lowering (e.g. the x^2 computed inside x^3 shared with a standalone x^2). Session-global A/B switch, ON by default; off recovers the pre-VN tape for measurement.

◆ SourceURL()

std::string bertini::SourceURL ( )
inline

Get the URL of the Bertini2 source repository.

◆ SplashScreen()

std::string bertini::SplashScreen ( )
inline

Get the multi-line splash screen text (trademark, URLs, version, license).

◆ StopRequested()

bool bertini::StopRequested ( )

Has somebody asked this process to stop?

Read between units of work. The load is relaxed: this is a request, not a synchronization point, and being one step late to notice it costs one step.

◆ SymbolicJacobian()

NodeMatrix bertini::SymbolicJacobian ( std::vector< std::shared_ptr< node::Node > > const & functions,
VariableGroup const & variables )

The symbolic Jacobian of a list of functions w.r.t.

a list of variables.

J[i,j] = functions[i] differentiated with respect to variables[j], as an expression tree (via Node::Differentiate). No numeric evaluation occurs. Returned row-major.

◆ ThreadEngine()

std::mt19937 & bertini::ThreadEngine ( )

Returns this thread's canonical mt19937 engine.

Every random draw of every type routes through here — integer/rational (RandomInt/RandomRat), double (rand_complex/RandReal), and multiprecision (RandomMp and everything built on it) — so SetGlobalSeed()/ReseedThisThread() control them all uniformly.

◆ ThreadPrecision()

unsigned bertini::ThreadPrecision ( )
inline

Get the current thread's precision (digits).

◆ ThrowIfInvalidVariableName()

void bertini::ThrowIfInvalidVariableName ( std::string const & s)
inline

Throw std::runtime_error if s is not a valid variable name (.

See also
IsValidVariableName). A no-op for a valid name.

◆ UniquePathVariableName()

std::string bertini::UniquePathVariableName ( System const & target,
std::string base = "t" )

Produce a path-variable name guaranteed not to collide with any variable in target.

Returns base if target has no variable of that name; otherwise appends _1, _2, ... to base and returns the first candidate absent from the system's VariableNameSet. The result is deterministic (depends only on target's variable names and base), so a caller that must recompute it later – e.g. to decide whether a homotopy needs rebuilding – gets the same answer. Used by the auto-construct homotopy path so a user variable named t (or even the zero-dim sentinel name) can never clash with the injected path variable.

Parameters
targetThe system whose variable names must be avoided.
baseThe desired path-variable name (mangled only if it collides).
Returns
A name not present in target.VariableNameSet().

◆ Unpermute()

template<typename... UnpermutedT, typename... PermutedPresentT>
std::tuple< const UnpermutedT &... > bertini::Unpermute ( const PermutedPresentT &... present_permuted_args)

Reorder a set of present arguments into the declared UnpermutedT order, default-constructing any absent.

◆ Version()

std::string bertini::Version ( )
inline

Get the Bertini2 version string.

Returns the full PEP 440 version including any prerelease suffix (e.g. 3.0.0.dev6). This is BERTINI2_VERSION_FULL, defined at compile time from the top-level VERSION file, not the stripped numeric BERTINI2_VERSION that jrl-cmakemodules bakes into config.hpp for cmake/SOVERSION semantics.

◆ WikiURL()

std::string bertini::WikiURL ( )
inline

Get the URL of the Bertini2 wiki.

Variable Documentation

◆ BinaryOperations

const int bertini::BinaryOperations = Add|Subtract | Multiply|Divide | Power | IntPower

Bit-mask of the two-operand operations.

◆ kArg0Real

size_t bertini::kArg0Real = static_cast<size_t>(1) << 20
constexpr

High bit: first operand slot is NumType::Real.

◆ kArg1Real

size_t bertini::kArg1Real = static_cast<size_t>(1) << 21
constexpr

High bit: second operand slot is Real (binary, not IntPower).

◆ kOpcodeMask

size_t bertini::kOpcodeMask = (static_cast<size_t>(1) << 17) - 1
constexpr

Mask recovering the base opcode from an instruction word.

◆ kOutReal

size_t bertini::kOutReal = static_cast<size_t>(1) << 22
constexpr

High bit: result slot is NumType::Real.

◆ SystemEncodingVersion

char bertini::SystemEncodingVersion[] = "b2sysenc/2"
inlineconstexpr

The version token of the System canonical encoding – the first word of every encoding text and the schema of every archived system definition.

Bump it (and regenerate the golden digest fixture, and APPEND to the version registry, in the same commit) whenever the emitted text changes in any way, including the ORDER the session canonicalization gives operands: the encoder writes them in that order. History: b2sysenc/1 (ADR-0042); b2sysenc/2 when the canonicalization tie-break moved from the printed form to the canonical encoding (ADR-0059).

◆ TrigOperations

const int bertini::TrigOperations = Sin|Cos|Tan | Asin|Acos|Atan

Bit-mask of the trigonometric operations.

◆ UnaryOperations

const int bertini::UnaryOperations = Exp|Log | Negate | Assign | TrigOperations | Sqrt

Bit-mask of the one-operand operations.