22#ifndef BERTINI_TRACKING_CONFIG_HPP
23#define BERTINI_TRACKING_CONFIG_HPP
274 throw std::runtime_error(
"adaptive precision derives its error bounds from the "
275 "degree of the system, and this system is not a polynomial one, so it has no "
276 "degree. Two ways on: track with a fixed-precision tracker, at double or at "
277 "multiple precision, which needs no such bound; or set this config's "
278 "jacobian_eval_error_bound and function_eval_error_bound yourself and hand it "
279 "to the tracker, choosing values you can defend for your system.");
377 class FixedPrecisionTracker;
378 class MultiplePrecisionTracker;
379 class DoublePrecisionTracker;
395 static constexpr char const* kRecordName =
"double";
397 using BaseRealT = double;
416 struct TrackerTraits<MultiplePrecisionTracker>
418 static constexpr char const* kRecordName =
"multiple";
421 using EventEmitterType = FixedPrecisionTracker<MultiplePrecisionTracker>;
422 using PrecisionConfig = FixedPrecisionConfig;
429 using NeededTypes = detail::TypeList<complex_mp>;
431 using NeededConfigs = detail::TypeList<
444 static constexpr char const* kRecordName =
"adaptive";
447 using EventEmitterType = AMPTracker;
455 using NeededTypes = detail::TypeList<complex_dbl, complex_mp>;
457 using NeededConfigs = detail::TypeList<
471 using BaseComplexT =
typename TrackerTraits<D>::BaseComplexT;
472 using BaseRealT =
typename TrackerTraits<D>::BaseRealT;
473 using EventEmitterType =
typename TrackerTraits<D>::EventEmitterType;
474 using PrecisionConfig =
typename TrackerTraits<D>::PrecisionConfig;
481 using NeededTypes =
typename TrackerTraits<D>::NeededTypes;
482 using NeededConfigs =
typename TrackerTraits<D>::NeededConfigs;
The fundamental polynomial system class for Bertini2.
Definition system.hpp:106
Eigen::NumTraits< NumT >::Real CoefficientBound(unsigned num_evaluations=1) const
Compute an estimate of an upper bound of the absolute values of the coefficients in the system.
bool IsPolynomial() const
Checks whether a system is polynomial, overall.
int DegreeBound() const
Compute an upper bound on the degree of the system.
size_t NumVariables() const
Get the total number of variables in this system, including homogenizing variables.
Functor-like class for tracking paths on a system.
Definition amp_tracker.hpp:409
A tracker that works entirely in hardware double precision.
Definition fixed_precision_tracker.hpp:423
CRTP base for trackers that work at a single fixed precision (double or fixed multiple).
Definition fixed_precision_tracker.hpp:56
Bertini extensions of the Eigen linear algebra library.
Extensions to the Boost.Multiprecision library.
AdaptiveMultiplePrecisionConfig AdaptiveMultiplePrecisionConfig
Alias bringing the AMP config type into this scope for the parser specialization below.
Definition tracking.hpp:579
double D(double const &norm_J, double const &norm_J_inverse, AdaptiveMultiplePrecisionConfig const &_config)
Compute the expression from the AMP papers amp1, amp2, amp3.
Definition amp_criteria.hpp:84
Definition adaptive_precision_utilities.hpp:35
Predictor
The predictor (ODE integration) method used during path tracking.
Definition config.hpp:55
@ RKCashKarp45
Definition config.hpp:63
@ Euler
Definition config.hpp:57
@ RKNorsett34
Definition config.hpp:61
@ RKDormandPrince56
Definition config.hpp:64
@ RKVerner67
Definition config.hpp:65
@ RKF45
Definition config.hpp:62
@ HeunEuler
Definition config.hpp:60
@ Constant
Definition config.hpp:56
@ Heun
Definition config.hpp:58
@ RK4
Definition config.hpp:59
std::ostream & operator<<(std::ostream &out, FixedPrecisionConfig const &)
Stream-insertion for FixedPrecisionConfig (a no-op; the config carries no printable state).
Definition config.hpp:185
static AdaptiveMultiplePrecisionConfig AMPConfigFrom(System const &sys)
Construct a ready-to-go set of AMP settings from a system.
Definition config.hpp:366
PrecisionType
The precision regime a tracker operates in: fixed double, fixed multiple, or adaptive.
Definition config.hpp:46
@ Adaptive
Definition config.hpp:49
@ Fixed
Definition config.hpp:47
@ FixedMultiple
Definition config.hpp:48
Definition algorithm_builder.hpp:36
std::complex< double > complex_dbl
The double-precision complex number type.
Definition double_extensions.hpp:47
complex_dbl pow(const complex_dbl &z, int power)
Compute +,- integral powers of a std::complex<double> number.
Definition double_extensions.hpp:92
double NumErrorT
The numeric type used to hold error/tolerance magnitudes throughout Bertini2 – tracking tolerances,...
Definition num_traits.hpp:48
bmp::number< mpc_complex_backend< 0 >, bmp::et_on > complex_mp
The arbitrary-precision complex number type.
Definition mpfr_complex.hpp:58
boost::multiprecision::number< boost::multiprecision::mpfr_float_backend< 0 >, boost::multiprecision::et_on > real_mp
The arbitrary-precision real number type.
Definition mpfr_extensions.hpp:53
boost::multiprecision::number< boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on > mpq_rational
The exact rational number type.
Definition mpfr_extensions.hpp:55
A basic typelist, in the style of Modern C++ Design, but using variadic templates.
Definition typelist.hpp:42
Holds the program parameters with respect to Adaptive Multiple Precision.
Definition config.hpp:214
NumErrorT function_eval_error_bound
Bound on the error of evaluating the functions, divided by the unit roundoff error.
Definition config.hpp:240
NumErrorT coefficient_bound
User-defined bound on the sum of the abs vals of the coeffs for any polynomial in the system (for ada...
Definition config.hpp:215
void SetAMPConfigFrom(System const &sys)
Set every system-derived AMP setting from a system: the degree, coefficient and linear-solve bounds,...
Definition config.hpp:302
unsigned int maximum_precision
User-chosed setting for the maximum allowable precision. Paths will die if their precision is request...
Definition config.hpp:244
AdaptiveMultiplePrecisionConfig(System const &sys)
Construct AMP settings derived from a system's bounds, where that is possible.
Definition config.hpp:332
int safety_digits_2
User-chosen setting for the number of safety digits used during Criterion C.
Definition config.hpp:243
void SetErrorBoundsFromDegreeAndCoefficient()
Set the two evaluation error bounds from the degree and coefficient bounds.
Definition config.hpp:294
int safety_digits_1
User-chosen setting for the number of safety digits used during Criteria A & B.
Definition config.hpp:242
NumErrorT jacobian_eval_error_bound
Bound on the error of evaluating the Jacobian, divided by the unit roundoff error .
Definition config.hpp:233
unsigned max_num_precision_decreases
The maximum number of times precision can be lowered during tracking of a segment of path.
Definition config.hpp:253
NumErrorT linear_solve_error_bound
Bound on the growth in error from a linear solve.
Definition config.hpp:222
void SetBoundsFrom(System const &sys)
Set the linear-solve error bound, the degree bound and the coefficient bound from a system.
Definition config.hpp:264
AdaptiveMultiplePrecisionConfig()
Construct with default AMP bounds and safety digits.
Definition config.hpp:317
NumErrorT degree_bound
User-set bound on degrees of polynomials in the system - tricky to compute for factored polys,...
Definition config.hpp:216
Settings for a fixed-precision tracker (carries the single working precision in effect).
Definition config.hpp:157
double RealT
The real number type.
Definition config.hpp:158
unsigned precision
The number of digits to always work at.
Definition config.hpp:170
FixedPrecisionConfig()=default
FixedPrecisionConfig(System const &)
Construct a ready-to-go set of fixed precision settings from a system.
Definition config.hpp:176
Settings governing the Newton corrector's iteration bounds.
Definition config.hpp:119
unsigned min_num_newton_iterations
The minimum number of Newton iterations per correction.
Definition config.hpp:121
unsigned max_num_newton_iterations
The maximum number of Newton iterations per correction. MaxNewtonIts.
Definition config.hpp:120
Settings governing step-size adjustment during tracking.
Definition config.hpp:96
mpq_rational initial_step_size
The length of the first time step when calling TrackPath. StepInitSize.
Definition config.hpp:100
mpq_rational max_step_size
The largest allowed step size. MaxStepSize.
Definition config.hpp:101
unsigned frequency_of_CN_estimation
Estimate the condition number every so many steps. Eh.
Definition config.hpp:112
unsigned max_num_steps
The maximum number of steps allowed during tracking, counting FAILED steps as well as successful ones...
Definition config.hpp:110
mpq_rational step_size_fail_factor
Factor by which to contract the time step when triggered. StepFailFactor.
Definition config.hpp:105
unsigned min_num_steps
The minimum number of steps allowed during tracking.
Definition config.hpp:109
unsigned consecutive_successful_steps_before_stepsize_increase
What it says. If you can come up with a better name, please suggest it. StepsForIncrease.
Definition config.hpp:107
mpq_rational step_size_success_factor
Factor by which to dilate the time step when triggered. StepSuccessFactor.
Definition config.hpp:104
double min_step_size
The minimum allowed step size (threshold only, double precision is sufficient). MinStepSize.
Definition config.hpp:102
The thresholds a tracker judges a path against: close enough, and too big.
Definition config.hpp:142
NumErrorT path_truncation_threshold
The tracker abandons a path once the largest coordinate of its dehomogenized point exceeds this....
Definition config.hpp:145
NumErrorT tracking_tolerance
How tightly Newton must correct onto the path for a step to be accepted.
Definition config.hpp:144
Predictor predictor
The ODE method used to predict the next point along the path. RKF45 – order 4 with an embedded error ...
Definition config.hpp:143
Trait lookup mapping a tracker type to its numeric types, event-emitter type, precision config,...
Definition config.hpp:387
Provides the bertini::System class.
Contains the detail/typelist helper type, for templated getting/setting/storage of config structs.