|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
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. | |
| using bertini::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.
Grows as block types are added (eventually a PolynomialBlock so the polynomial part is uniform too).
| using bertini::complex_dbl = std::complex<double> |
The double-precision complex number type.
| using bertini::complex_mp = bmp::number<mpc_complex_backend<0>, bmp::et_on > |
The arbitrary-precision complex number type.
| using bertini::ConstEvent = Event<ObsT,true> |
An event holding a const reference to its observable.
| using bertini::ifstream = std::ifstream |
Shorthand for an input file stream.
| using bertini::Mat = Eigen::Matrix<NumT, Eigen::Dynamic, Eigen::Dynamic> |
A dynamically-sized matrix of NumT.
| using bertini::mpq_rational = boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on> |
The exact rational number type.
| using bertini::mpz_int = boost::multiprecision::number<boost::multiprecision::backends::gmp_int, boost::multiprecision::et_on> |
The arbitrary-precision integer type.
| using bertini::MutableEvent = Event<ObsT,false> |
An event holding a mutable reference to its observable.
| 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.
| using bertini::Path = fs::path |
Shorthand for a filesystem path.
| using bertini::real_dbl = double |
The double-precision real number type.
| using bertini::real_mp = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_on> |
The arbitrary-precision real number type.
| using bertini::SampCont = std::deque<Vec<T> > |
| 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.
| using bertini::TimeCont = std::deque<T> |
| using bertini::VariableGroup = std::vector< std::shared_ptr<node::Variable> > |
An ordered group of variables (the unit of homogenization / variable grouping).
| using bertini::Vec = Eigen::Matrix<NumT, Eigen::Dynamic, 1> |
A dynamically-sized column vector of NumT.
|
strong |
|
strong |
|
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 | |
|
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 | |
| enum bertini::Operation |
|
strong |
|
strong |
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.
| into | The system to receive the structure; it must declare no variables. |
| from | The system whose variable structure is taken. |
| std::runtime_error | If into already declares variables. |
| 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.
| randomseed | The value of randomseed in the classic input file. |
|
inline |
Get the version of the Boost headers compiled against.
| 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).
| a | The first system. |
| b | The second system. |
| operation | The name of the operation being attempted, for the message. |
| a_name | How to refer to a in the message, e.g. "the target system". |
| b_name | How to refer to b in the message. |
| std::runtime_error | If the two cannot meaningfully be combined. |
| void bertini::ClearStopRequest | ( | ) |
Withdraw a stop request, so later computations run normally.
Do a deep clone of the system.
This includes the entire structure, variables, etc. everything.
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).
| sys1 | The top system. |
| sys2 | The 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.
|
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.
|
inline |
Get the global default precision (digits) for multiprecision numbers.
|
inline |
Set the global default precision (digits) for multiprecision numbers, on this thread and globally.
|
inline |
The default Boost.Multiprecision variable-precision policy used by bertini.
|
inline |
Get a multi-line summary of the versions of Bertini2's dependencies (Boost, Eigen, GMP, MPFR).
| 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.
| 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".
|
constexpr |
The number of digits considered "double precision" (16).
|
inline |
Get the version of the Eigen headers compiled against.
| 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.
| T | The evaluation number type (complex_dbl or complex_mp). |
| expr | The expression to evaluate. |
| variable_values | A map from variable name to the value to substitute. |
| strict | When true, reject supplied names absent from the expression; when false, ignore them. |
|
inline |
Read an entire file into a string.
| input_path | The path to the file. |
|
inline |
Get the generic help text (currently empty).
| 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.
|
inline |
Get the version of the GMP library linked against.
| 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.
| index | The index you want to convert. |
| dimensions | The dimensions of the object you are subscripting or indexing into. |
| std::out_of_range,if | the index is impossible to convert. |
| 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.
| 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.
| 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.
| candidate | The system to intern; sealed if it becomes the representative. |
|
constexpr |
Query whether an operation takes two operands.
|
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.
| a | One point. |
| b | The other point. |
| tol | The (absolute) infinity-norm tolerance. |
|
inline |
Checks whether the number of rows and columns are either 0.
|
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).
|
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.
|
inline |
Test two numbers for having large ratio.
The basis for comparison is Eigen's fuzzy precision, Eigen::NumTraits<T>::dummy_precision();
| numerator | The numerator for the ratio. |
| denomenator | The denomenator for the ratio. |
|
inline |
Query whether either component of a multiprecision complex number is NaN.
|
inline |
an overload of isnan, for std::complex<double>
|
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).
| a | One point. |
| b | The other point. |
| tol | The (absolute) infinity-norm tolerance. |
|
inline |
Test a numbers being very small.
Compares the number against machine epsilon (or software epsilon if a multiple precision type), times 100.
| testme | The number to test |
|
inline |
Check whether two values are very close to each other.
| T | The numeric type. |
| a | The first value. |
| b | The second value. |
| e | The 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.
|
constexpr |
Query whether an operation takes a single operand.
|
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.
| Eigen::Matrix< NumberType, Eigen::Dynamic, Eigen::Dynamic > bertini::KahanMatrix | ( | unsigned int | mat_size, |
| NumberType | c ) |
Make a Kahan matrix with a given number type.
|
inline |
Get a short description of Bertini2's licensing.
| 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.
| in | The stream holding a boost text archive written by oa << system. |
|
constexpr |
The lowest multiple-precision digit count used (20).
| MatrixSuccessCode bertini::LUPartialPivotDecompositionSuccessful | ( | Eigen::MatrixBase< Derived > const & | LU | ) |
Check the diagonal elements of an LU decomposition for small values and large ratios.
This function requires a square non-empty matrix.
| Derived | Matrix type from Eigen. |
| 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.
| 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.
| target | The target system (H at t=0). |
| start | The start system whose solutions seed the homotopy (H at t=1). |
| path_variable_name | The 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). |
| gamma | The gamma coefficient (a node). If null, a random rational gamma is generated. |
| 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.
| fixed | The equations that do not move (evaluated once per point). |
| start_moving | The moving rows at t=1 (their roots, with fixed, are the start points). |
| end_moving | The moving rows at t=0 (the target rows). |
| path_variable_name | The 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). |
| gamma | The gamma coefficient (a node). If null, a random rational gamma is generated. |
| T bertini::max | ( | T const & | a, |
| T const & | b, | ||
| T const & | c ) |
Three-argument form of max.
| a | Input one |
| b | Input two |
| c | Input three |
| T bertini::max | ( | T const & | a, |
| T const & | b, | ||
| T const & | c, | ||
| T const & | d ) |
Four-argument form of max.
| a | Input one |
| b | Input two |
| c | Input three |
| d | Input four |
| T bertini::max | ( | T const & | a, |
| T const & | b, | ||
| T const & | c, | ||
| T const & | d, | ||
| T const & | e ) |
Five-argument form of max.
| a | Input one |
| b | Input two |
| c | Input three |
| d | Input four |
| e | Input five |
|
constexpr |
The maximum precision (digits) the library will escalate to.
|
inline |
Get the version of the MPFR library linked against.
|
inline |
Get the version of the MPI library linked against (or a note if serial).
| std::string bertini::OpcodeToString | ( | Operation | op | ) |
Get a human-readable name for an opcode.
Try to open a file, and throw if it doesn't exist, or is a directory.
|
inline |
Overload * for unsigned * complex<double>.
| std::ostream & bertini::operator<< | ( | std::ostream & | out, |
| Slice const & | s ) |
Provides output streaming for Slice.
| 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.
| stream | The stream to print to. |
| e | The enum value to print |
|
inline |
Get the names of the Bertini trademark owners.
| 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
| argc | The number of arguments. |
| argv | The argument strings. |
|
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.
|
inline |
Get the precision of a number.
For complex doubles, this is trivially 16.
|
inline |
For complex doubles, throw if the requested precision is not DoublePrecision.
|
inline |
Change the precision of a number.
For mpfr_floats, this calls the precision member method for real_mp.
|
inline |
Get the precision of a number.
For mpfr_floats, this calls the precision member method for real_mp.
|
inline |
Get the precision of a number.
For doubles, this is trivially 16.
|
inline |
For complex doubles, throw if the requested precision is not DoublePrecision.
| void bertini::Precision | ( | Eigen::MatrixBase< Derived > & | v, |
| unsigned | prec ) |
Set the precision of an Eigen object.
| v | the matrix to change |
| prec | the new precision |
|
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
|
inline |
Change the precision of a real number.
For mpfr_floats, this calls the precision member method for real_mp.
|
inline |
Get the precision of a real number.
For mpfr_floats, this calls the precision member method for real_mp.
|
inline |
The number of digits by which adaptive precision is increased at each step.
| unsigned bertini::PrecisionRequireUniform | ( | Eigen::MatrixBase< Derived > const & | v | ) |
|
inline |
Get a random double-precision complex number (not unit modulus; see RandomUnit).
|
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.
| rows | The number of rows of the returned matrix. |
| cols | The number of columns of the returned matrix. |
| NumberType | the (complex) number type to fill the matrix with. |
|
inline |
Generate a random integer number between -10^digits and 10^digits.
| real_mp bertini::RandomMp | ( | ) |
create a random number, at the current default precision
| real_mp bertini::RandomMp | ( | ) |
Produce a random number with at length_in_digits non-zero digits.
| length_in_digits | The length of the desired random number |
create a random number in a given interval, at the current default precision
create a random number in a given interval, at the specified precision
| 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.
| length_in_digits | The length of the desired random number |
| left | The left bound. |
| right | The right bound. |
| real_mp bertini::RandomMp | ( | unsigned | num_digits | ) |
create a random number, at the specified precision
| num_digits | the precision that you desire. |
| void bertini::RandomMpAssign | ( | real_mp & | a | ) |
a templated function for producing random numbers in the unit interval, of a given number of digits.
| length_in_digits | The length of the desired random number |
| a | the number which will be assigned in this call |
| 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.
|
inline |
Make a random matrix of units (numbers with norm 1).
| rows | The number of rows. |
| cols | The number of columns. |
| NumberType | the type of number to fill the matrix with. |
|
inline |
Make a random vector of units (numbers with norm 1).
| size | The length of the vector. |
| NumberType | the type of number to fill the vector with. |
|
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.
|
inline |
A real orthonormal seed entry: uniform on [-1, 1], never a bare sign.
| mpq_rational bertini::RandomRat | ( | ) |
Generate a random rational number with numerator and denomenator between -10^digits and 10^digits.
| T bertini::RandomUnit | ( | ) |
Get a random complex number of unit modulus, in number type T.
|
inline |
Get a random double-precision complex number of unit modulus.
|
inline |
Get a random multiprecision complex number of unit modulus.
|
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.
|
inline |
Gets you a random real number between -1 and 1, fwiw.
| 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.
| 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.
| 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.
| 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.
| void bertini::SetSLPValueNumbering | ( | bool | on | ) |
Set whether the SLP compiler value-numbers while emitting the tape.
|
inline |
Set the precision (digits) for the current thread only (does not touch the global default).
| 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().
| void bertini::Simplify | ( | System & | sys | ) |
Free form function for simplifying systems.
| 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.
|
inline |
Get the URL of the Bertini2 source repository.
|
inline |
Get the multi-line splash screen text (trademark, URLs, version, license).
| 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.
| 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.
| 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.
|
inline |
Get the current thread's precision (digits).
|
inline |
Throw std::runtime_error if s is not a valid variable name (.
| 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.
| target | The system whose variable names must be avoided. |
| base | The desired path-variable name (mangled only if it collides). |
| 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.
|
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.
|
inline |
Get the URL of the Bertini2 wiki.
Bit-mask of the two-operand operations.
|
constexpr |
High bit: first operand slot is NumType::Real.
|
constexpr |
High bit: second operand slot is Real (binary, not IntPower).
|
constexpr |
Mask recovering the base opcode from an instruction word.
|
constexpr |
High bit: result slot is NumType::Real.
|
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).
Bit-mask of the trigonometric operations.