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

A class which stores all the explicit single-step multi-stage ODE predictor methods. More...

#include <explicit_predictors.hpp>

Public Member Functions

 ExplicitRKPredictor (const System &S)
 Construct a predictor to work on a system.
 ExplicitRKPredictor (Predictor method, const System &S)
 Constructor for a particular predictor method.
void PredictorMethod (Predictor method)
 /brief Sets the local variables to correspond to a particular predictor method
void ChangeSystem (const System &S)
 Change the system (number of total functions) that the predictor uses.
void ResizeK ()
 Resize the internal Runge-Kutta stage matrix K to match the current system and stage count.
void SetConditionProbe (std::tuple< Vec< complex_dbl >, Vec< complex_mp > > const &probe)
 Adopt an externally-owned condition-number probe direction (both precisions).
unsigned precision () const
 get the current precision of the predictor
void ChangePrecision (unsigned new_precision)
 /brief Change the precision of the predictor variables and reassign the Butcher table variables.
void PrecisionSanityCheck () const
 Assert (in debug builds) that the predictor's state is all at the expected precision.
template<typename ComplexT>
SuccessCode Predict (Vec< ComplexT > &next_space, StepMetadata &meta, System const &S, const Vec< ComplexT > &current_space, ComplexT current_time, ComplexT const &delta_t, unsigned &num_steps_since_last_condition_number_computation, unsigned frequency_of_CN_estimation, NumErrorT const &tracking_tolerance, AdaptiveMultiplePrecisionConfig const *AMP_config=nullptr)
 Perform a generic predictor step.
Predictor PredictorMethod ()
 Get the currently used prediction method.
unsigned Order ()
 Get the order of the currently used prediction method.
bool HasErrorEstimate ()
 Get whether the current prediction method provides an error estimate.

Protected Member Functions

template<typename ComplexT>
SuccessCode FullStep (Vec< ComplexT > &next_space, System const &S, Vec< ComplexT > const &current_space, ComplexT const &current_time, ComplexT const &delta_t)
 Performs a full prediction step from current_time to current_time + delta_t.
template<typename ComplexT>
void SetNormsCond (NumErrorT &norm_J, NumErrorT &norm_J_inverse, NumErrorT &condition_number_estimate, unsigned &num_steps_since_last_condition_number_computation, unsigned frequency_of_CN_estimation)
 Compute and (when due) refresh the Jacobian norms and condition-number estimate.
template<typename ComplexT>
SuccessCode SetErrorEstimate (NumErrorT &error_estimate, ComplexT const &delta_t)
 Computes the error estimate of this prediction step.
template<typename ComplexT>
SuccessCode SetSizeProportion (NumErrorT &size_proportion, ComplexT const &delta_t)
 Compute the size proportion variable for AMP computation.
template<typename ComplexT>
SuccessCode EvalRHS (System const &S, const Vec< ComplexT > &space, const ComplexT &time, Mat< ComplexT > &K, unsigned stage)
 Evaluates the RHS of the Davidenko differential equation at a particular time and space.

Detailed Description

A class which stores all the explicit single-step multi-stage ODE predictor methods.

Purpose

Stores all the information needed to implement the predictor method

  • Butcher Table
  • Number of Stages
  • Order of the method.

Also stores information computed during implementation of the method.

Use

Each predictor method is stored as a static Butcher table. To perform a predict step, you must instantiate an object with a particular predictor method and call Predict:

ExplicitRKPredictors<Complex,Real> euler(Predictor::Euler, sys)
success_code = euler.Predict( ... )
@ Euler
Definition config.hpp:57

Constructor & Destructor Documentation

◆ ExplicitRKPredictor() [1/2]

bertini::tracking::predict::ExplicitRKPredictor::ExplicitRKPredictor ( const System & S)
inline

Construct a predictor to work on a system.

Parameters
Sthe system the predictor will be predicting on.

◆ ExplicitRKPredictor() [2/2]

bertini::tracking::predict::ExplicitRKPredictor::ExplicitRKPredictor ( Predictor method,
const System & S )
inline

Constructor for a particular predictor method.

Parameters
methodThe predictor method to be implemented.
Sthe system to be predicting on.

Member Function Documentation

◆ ChangePrecision()

void bertini::tracking::predict::ExplicitRKPredictor::ChangePrecision ( unsigned new_precision)
inline

/brief Change the precision of the predictor variables and reassign the Butcher table variables.

Parameters
new_precisionThe new precision.

◆ ChangeSystem()

void bertini::tracking::predict::ExplicitRKPredictor::ChangeSystem ( const System & S)
inline

Change the system (number of total functions) that the predictor uses.

Parameters
SNew system to switch to.

◆ EvalRHS()

template<typename ComplexT>
SuccessCode bertini::tracking::predict::ExplicitRKPredictor::EvalRHS ( System const & S,
const Vec< ComplexT > & space,
const ComplexT & time,
Mat< ComplexT > & K,
unsigned stage )
inlineprotected

Evaluates the RHS of the Davidenko differential equation at a particular time and space.

Parameters
SThe homotopy system
spaceThe space variable used to evaluate RHS
timeThe time variable used to evaluate RHS
KMatrix of stage variables
stageWhich stage variable(column of K) should be filled by this computation
Returns
Success code of this computation

◆ FullStep()

template<typename ComplexT>
SuccessCode bertini::tracking::predict::ExplicitRKPredictor::FullStep ( Vec< ComplexT > & next_space,
System const & S,
Vec< ComplexT > const & current_space,
ComplexT const & current_time,
ComplexT const & delta_t )
inlineprotected

Performs a full prediction step from current_time to current_time + delta_t.

Parameters
next_spaceThe computed prediction space
SThe homotopy system
current_spaceThe current space values
current_timeThe current time values
delta_tThe time step
Returns
SuccessCode determining result of the computation

◆ HasErrorEstimate()

bool bertini::tracking::predict::ExplicitRKPredictor::HasErrorEstimate ( )
inline

Get whether the current prediction method provides an error estimate.

Returns
Yes or no.

◆ Order()

unsigned bertini::tracking::predict::ExplicitRKPredictor::Order ( )
inline

Get the order of the currently used prediction method.

This is the lowest order of the predictor. The order of the error estimate is this plus one.

Returns
The aforementioned order.

◆ precision()

unsigned bertini::tracking::predict::ExplicitRKPredictor::precision ( ) const
inline

get the current precision of the predictor

◆ PrecisionSanityCheck()

void bertini::tracking::predict::ExplicitRKPredictor::PrecisionSanityCheck ( ) const
inline

Assert (in debug builds) that the predictor's state is all at the expected precision.

◆ Predict()

template<typename ComplexT>
SuccessCode bertini::tracking::predict::ExplicitRKPredictor::Predict ( Vec< ComplexT > & next_space,
StepMetadata & meta,
System const & S,
const Vec< ComplexT > & current_space,
ComplexT current_time,
ComplexT const & delta_t,
unsigned & num_steps_since_last_condition_number_computation,
unsigned frequency_of_CN_estimation,
NumErrorT const & tracking_tolerance,
AdaptiveMultiplePrecisionConfig const * AMP_config = nullptr )
inline

Perform a generic predictor step.

Parameters
next_spaceThe computed prediction.
metaStep metadata, populated during the step with the Jacobian norms and condition number estimate.
SThe system being solved.
current_spaceThe current space variable vector.
current_timeThe current time.
delta_tThe size of the time step.
num_steps_since_last_condition_number_computationUpdated in this function.
frequency_of_CN_estimationHow many steps to take between condition number estimates.
tracking_toleranceHow tightly to track the path.
AMP_configOptional adaptive-multiple-precision configuration; when null, fixed-precision behaviour is used.
Returns
SuccessCode indicating how the prediction went.

◆ PredictorMethod() [1/2]

Predictor bertini::tracking::predict::ExplicitRKPredictor::PredictorMethod ( )
inline

Get the currently used prediction method.

Returns
The current method.

◆ PredictorMethod() [2/2]

void bertini::tracking::predict::ExplicitRKPredictor::PredictorMethod ( Predictor method)
inline

/brief Sets the local variables to correspond to a particular predictor method

Parameters
methodEnum class that determines the predictor method

◆ ResizeK()

void bertini::tracking::predict::ExplicitRKPredictor::ResizeK ( )
inline

Resize the internal Runge-Kutta stage matrix K to match the current system and stage count.

◆ SetConditionProbe()

void bertini::tracking::predict::ExplicitRKPredictor::SetConditionProbe ( std::tuple< Vec< complex_dbl >, Vec< complex_mp > > const & probe)
inline

Adopt an externally-owned condition-number probe direction (both precisions).

The tracker calls this once per path so the predictor estimates ||J^{-1}|| against the SAME random direction as the corrector (ADR-0024: one tracker-owned, per-path probe). Standalone use (e.g. unit tests with no tracker) keeps the per-system probe drawn in ChangeSystem.

◆ SetErrorEstimate()

template<typename ComplexT>
SuccessCode bertini::tracking::predict::ExplicitRKPredictor::SetErrorEstimate ( NumErrorT & error_estimate,
ComplexT const & delta_t )
inlineprotected

Computes the error estimate of this prediction step.

Parameters
error_estimateComputed error estimate
delta_tThe time step
Returns
Success code or the computation

◆ SetNormsCond()

template<typename ComplexT>
void bertini::tracking::predict::ExplicitRKPredictor::SetNormsCond ( NumErrorT & norm_J,
NumErrorT & norm_J_inverse,
NumErrorT & condition_number_estimate,
unsigned & num_steps_since_last_condition_number_computation,
unsigned frequency_of_CN_estimation )
inlineprotected

Compute and (when due) refresh the Jacobian norms and condition-number estimate.

Template Parameters
ComplexTThe complex number type to compute at.
Parameters
[out]norm_JSet to ||J||.
[out]norm_J_inverseSet to the estimate of ||J^{-1}||.
[out]condition_number_estimateSet to the product of the two norms.
[in,out]num_steps_since_last_condition_number_computationSteps elapsed since the last estimate; advanced/reset here, so it MUST be the caller's counter by reference (passing by value silently turns any frequency > 1 into "never refresh").
frequency_of_CN_estimationRecompute the estimate once this many steps have passed.

◆ SetSizeProportion()

template<typename ComplexT>
SuccessCode bertini::tracking::predict::ExplicitRKPredictor::SetSizeProportion ( NumErrorT & size_proportion,
ComplexT const & delta_t )
inlineprotected

Compute the size proportion variable for AMP computation.

Parameters
size_proportionComputed size proportion
delta_tThe time step
Returns
Success code of the computation