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

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...

#include <straight_line_program.hpp>

Public Types

enum class  Kind : int {
  Integer , Rational , Complex , Pi ,
  E
}
 Which kind of constant this recipe produces. More...

Public Member Functions

template<typename NumT>
NumT Produce () const
 Produce the constant's value at the ambient working precision (ThreadPrecision), matching the corresponding number node's FreshEval exactly.
template<typename RealT>
RealT ProduceReal () const
 Produce just the REAL value (for a slot inferred NumType::Real). Only valid when IsReal().
bool IsReal () const
 Whether this constant is real-valued: Integer/Pi/E always; a Rational/Complex literal iff its imaginary part is exactly zero.

Public Attributes

Kind kind = Kind::Integer
 Which kind of constant this is.
mpz_int int_value
 Kind::Integer (exact).
mpq_rational rat_real
 Kind::Rational real part (exact).
mpq_rational rat_imag
 Kind::Rational imaginary part (exact).
complex_mp float_value
 Kind::Complex (authored-precision literal; also a fixed variable's value).
size_t slot = 0
 where this constant lives in the register file

Friends

class boost::serialization::access

Detailed Description

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).

Integers and rationals are stored exactly (so they downsample to any precision without loss — sidestepping any maximum-precision setting); Pi/E are recomputed at the working precision; a Complex literal carries its authored-precision value (its inherent ceiling).

Member Enumeration Documentation

◆ Kind

enum class bertini::ConstantRecipe::Kind : int
strong

Which kind of constant this recipe produces.

Enumerator
Integer 
Rational 
Complex 
Pi 
E 

Member Function Documentation

◆ IsReal()

bool bertini::ConstantRecipe::IsReal ( ) const
inline

Whether this constant is real-valued: Integer/Pi/E always; a Rational/Complex literal iff its imaginary part is exactly zero.

Drives NumType::Real inference for constant slots (ADR-0034).

◆ Produce()

template<typename NumT>
NumT bertini::ConstantRecipe::Produce ( ) const

Produce the constant's value at the ambient working precision (ThreadPrecision), matching the corresponding number node's FreshEval exactly.

Definition + instantiations in the cpp.

◆ ProduceReal()

template<typename RealT>
RealT bertini::ConstantRecipe::ProduceReal ( ) const

Produce just the REAL value (for a slot inferred NumType::Real). Only valid when IsReal().

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ float_value

complex_mp bertini::ConstantRecipe::float_value

Kind::Complex (authored-precision literal; also a fixed variable's value).

◆ int_value

mpz_int bertini::ConstantRecipe::int_value

Kind::Integer (exact).

◆ kind

Kind bertini::ConstantRecipe::kind = Kind::Integer

Which kind of constant this is.

◆ rat_imag

mpq_rational bertini::ConstantRecipe::rat_imag

Kind::Rational imaginary part (exact).

◆ rat_real

mpq_rational bertini::ConstantRecipe::rat_real

Kind::Rational real part (exact).

◆ slot

size_t bertini::ConstantRecipe::slot = 0

where this constant lives in the register file