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

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

#include <straight_line_program.hpp>

Public Types

using IntT = int
 The integer type used for the program's integer bank.

Public Member Functions

 SLPProgram ()=default
bool HavePathVariable () const
 Query whether the program has a path variable.
unsigned NumFunctions () const
 Get the number of functions in the program.
unsigned NumVariables () const
 Get the number of variables in the program.
size_t NumSlots () const
 Get the total number of memory slots (per register bank) the program needs.
size_t FirstLiveInstructionOffset () const
 Get the word offset into the tape where the live (post-frozen-prologue) segment begins.
std::size_t ContentHash () const
 In-process structural hash of the full immutable program content: the (specialized) instruction tape, the exact constant recipes, the integer bank, and the memory layout.
bool SameContent (SLPProgram const &other) const
 Exact content equality over every field ContentHash folds; disambiguates hash collisions in the program intern table.
template<typename NumT>
void Eval (SLPMemory &memory) const
 loops through the instructions in the tape and evaluates each operation against the given memory.

Static Public Attributes

static bool tiers_enabled_
 ADR-0034 A/B switch: when false, leave every slot Complex (pre-tier all-complex eval).

Friends

class StraightLineProgram
class boost::serialization::access
std::ostream & operator<< (std::ostream &out, const StraightLineProgram &s)

Detailed Description

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

Built once by the SLPCompiler; thereafter read-only, so it is shareable across threads. Evaluation runs the tape against a per-thread SLPMemory.

Member Typedef Documentation

◆ IntT

The integer type used for the program's integer bank.

Constructor & Destructor Documentation

◆ SLPProgram()

bertini::SLPProgram::SLPProgram ( )
default

Member Function Documentation

◆ ContentHash()

std::size_t bertini::SLPProgram::ContentHash ( ) const

In-process structural hash of the full immutable program content: the (specialized) instruction tape, the exact constant recipes, the integer bank, and the memory layout.

Keys the program intern table (ADR-0027 E4). NOT stable across runs or compilers – persistent identity belongs to the owning System's ContentDigest (ADR-0042).

◆ Eval()

template<typename NumT>
void bertini::SLPProgram::Eval ( SLPMemory & memory) const

loops through the instructions in the tape and evaluates each operation against the given memory.

Template Parameters
NumTnumeric type

uses a switch to find different operations from memory to make sure its performing the correct evaluations

todo: implement a compile-time version of this using Boost.Hana

◆ FirstLiveInstructionOffset()

size_t bertini::SLPProgram::FirstLiveInstructionOffset ( ) const
inline

Get the word offset into the tape where the live (post-frozen-prologue) segment begins.

◆ HavePathVariable()

bool bertini::SLPProgram::HavePathVariable ( ) const
inline

Query whether the program has a path variable.

◆ NumFunctions()

unsigned bertini::SLPProgram::NumFunctions ( ) const
inline

Get the number of functions in the program.

◆ NumSlots()

size_t bertini::SLPProgram::NumSlots ( ) const
inline

Get the total number of memory slots (per register bank) the program needs.

◆ NumVariables()

unsigned bertini::SLPProgram::NumVariables ( ) const
inline

Get the number of variables in the program.

◆ SameContent()

bool bertini::SLPProgram::SameContent ( SLPProgram const & other) const

Exact content equality over every field ContentHash folds; disambiguates hash collisions in the program intern table.

SameContent(a,b) implies equal ContentHash.

◆ boost::serialization::access

friend class boost::serialization::access
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const StraightLineProgram & s )
friend

◆ StraightLineProgram

friend class StraightLineProgram
friend

Member Data Documentation

◆ tiers_enabled_

bool bertini::SLPProgram::tiers_enabled_
static

ADR-0034 A/B switch: when false, leave every slot Complex (pre-tier all-complex eval).

Read at compile time; default true. For benchmarking only, not production toggling.