Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
amp_tracker.hpp File Reference

Contains the AMPTracker type, and necessary functions. More...

#include <assert.h>
#include "bertini2/trackers/base_tracker.hpp"
Include dependency graph for amp_tracker.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  bertini::tracking::AMPTracker
 Functor-like class for tracking paths on a system. More...
 

Functions

double bertini::tracking::ArithmeticCost (unsigned precision)
 Compute the cost function for arithmetic versus precision.
 
template<typename T>
T bertini::tracking::max (T const &a, T const &b, T const &c)
 Three-argument form of max.
 
unsigned bertini::tracking::MinDigitsForLogOfStepsize (mpfr_float const &log_of_stepsize, mpfr_float const &time_to_go, unsigned safety_digits=3)
 The minimum number of digits based on a log10 of a stepsize.
 
unsigned bertini::tracking::MinDigitsForStepsizeInterval (mpfr_float const &min_stepsize, mpfr_float const &max_stepsize, mpfr_float const &time_to_go)
 For a given range of stepsizes under consideration, gives the minimum number of digits.
 
template<typename RealT>
void bertini::tracking::MinimizeTrackingCost (unsigned &new_precision, RealT &new_stepsize, unsigned min_precision, RealT const &min_stepsize, unsigned max_precision, RealT const &max_stepsize, unsigned digits_B, unsigned num_newton_iterations, unsigned predictor_order=0)
 Compute precision and stepsize minimizing the ArithmeticCost() of tracking.
 
mpfr_float bertini::tracking::MinStepSizeForPrecision (unsigned precision, mpfr_float const &time_to_go, int safety_digits=3)
 Just another name for MinTimeForCurrentPrecision.
 
mpfr_float bertini::tracking::MinTimeForCurrentPrecision (unsigned precision, mpfr_float const &time_to_go, int safety_digits=3)
 
mpfr_float bertini::tracking::StepsizeSatisfyingCriterionB (unsigned precision, unsigned digits_B, unsigned num_newton_iterations, unsigned predictor_order=0)
 Compute a stepsize satisfying AMP Criterion B with a given precision.
 

Detailed Description

Contains the AMPTracker type, and necessary functions.

Function Documentation

◆ ArithmeticCost()

double bertini::tracking::ArithmeticCost ( unsigned precision)
inline

Compute the cost function for arithmetic versus precision.

From [2], \(C(P)\). As currently implemented, this is \( 10.35 + 0.13 P \), where P is the precision. These numbers are stale, and need to be recomputed. Badly. Please do this.

This function tells you the relative cost of arithmetic at a given precision.

Todo
Recompute this cost function for boost::multiprecision::mpfr_float
Parameters
precisionAn integral number of digits – then this gives the cost for arithmetic
Returns
A double indicating how expensive arithmetic at a given precision is. 1 is the base-line for double-precision.

◆ max()

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

◆ MinDigitsForLogOfStepsize()

unsigned bertini::tracking::MinDigitsForLogOfStepsize ( mpfr_float const & log_of_stepsize,
mpfr_float const & time_to_go,
unsigned safety_digits = 3 )
inline

The minimum number of digits based on a log10 of a stepsize.

Parameters
log_of_stepsizelog10 of a stepsize
time_to_goHow much time you have left to track.
safety_digitsA buffer of extra digits to use, over the computed min. Yes, this is added in, in this function.
Returns
An integral number of necessary digits to use

◆ MinDigitsForStepsizeInterval()

unsigned bertini::tracking::MinDigitsForStepsizeInterval ( mpfr_float const & min_stepsize,
mpfr_float const & max_stepsize,
mpfr_float const & time_to_go )
inline

For a given range of stepsizes under consideration, gives the minimum number of digits.

Parameters
min_stepsizeThe smallest stepsize under consideration
max_stepsizeThe largest stepsize under consideration
time_to_goHow much time is left to track.
Returns
The min number of digits.

This function assumes you are going to time=0, or that you have taken care of that difference. That is, time_to_go should be a duration, not the current time, unless you are tracking to t=0, in which case current time is the duration left to go. Dig it?

◆ MinimizeTrackingCost()

template<typename RealT>
void bertini::tracking::MinimizeTrackingCost ( unsigned & new_precision,
RealT & new_stepsize,
unsigned min_precision,
RealT const & min_stepsize,
unsigned max_precision,
RealT const & max_stepsize,
unsigned digits_B,
unsigned num_newton_iterations,
unsigned predictor_order = 0 )

Compute precision and stepsize minimizing the ArithmeticCost() of tracking.

For a given range of precisions, an old stepsize, and a maximum stepsize, the Cost of tracking is computed, and a minimizer found.

This function is used in the AMPTracker tracking loop, both in case of successful steps and in Criterion errors.

Parameters
[out]new_precisionThe minimizing precision.
[out]new_stepsizeThe minimizing stepsize.
[in]min_precisionThe minimum considered precision.
[in]min_stepsizeThe minimum permitted stepsize.
[in]max_precisionThe maximum considered precision.
[in]max_stepsizeThe maximum permitted stepsize.
[in]digits_BThe number of digits required, according to CriterionB from [1], [2]
[in]num_newton_iterationsThe number of allowed Newton corrector iterations.
[in]predictor_orderThe order of the predictor being used. This is the order itself, not the order of the error estimate.
See also
ArithmeticCost

◆ MinStepSizeForPrecision()

mpfr_float bertini::tracking::MinStepSizeForPrecision ( unsigned precision,
mpfr_float const & time_to_go,
int safety_digits = 3 )
inline

Just another name for MinTimeForCurrentPrecision.

Parameters
precisionThe number of digits you want to use
time_to_goThe duration of remaining time to track
safety_digitsA buffer of extra digits to use
Returns
The smallest permissible stepsize

◆ MinTimeForCurrentPrecision()

mpfr_float bertini::tracking::MinTimeForCurrentPrecision ( unsigned precision,
mpfr_float const & time_to_go,
int safety_digits = 3 )
inline

The minimum time that can be represented effectively using a given precision

Parameters
precisionThe number of digits you want to use
time_to_goThe duration of remaining time to track
safety_digitsA buffer of extra digits to use
Returns
The smallest permissible stepsize
Todo
This function has a hardcoded value which should be replaced

◆ StepsizeSatisfyingCriterionB()

mpfr_float bertini::tracking::StepsizeSatisfyingCriterionB ( unsigned precision,
unsigned digits_B,
unsigned num_newton_iterations,
unsigned predictor_order = 0 )
inline

Compute a stepsize satisfying AMP Criterion B with a given precision.

Parameters
precisionThe current working precision
digits_BThe number of digits from Criterion B
num_newton_iterationsThe number of remaining newton iterations allowed in the correction
predictor_orderThe order of the predictor
Returns
The stepsize
Todo
Remove the default value of the predictor order, as that seems weird to have