lppl  v2.0.0

◆ construct_program()

template<typename... Ts>
program_rep construct_program ( gr_pair< Ts... > &  gr,
program_info info,
std::optional< std::string >  file_ = std::nullopt 
)

Translates a graph_ir into a sample-based graphical model library built on ccyan primitives.

Given a directed graphical model represented as a graph_ir, this function does multiple things:

  • defines observed and unobserved structs that hold values of observed and unobserved random variables and their associated log probabilities
  • defines a function to compute the joint log probability of the model
  • defines functions that are equivalent to the following interpretations of the graphical model: (a) running it forward conditioned on observed data; (b) evaluating the joint log probability of the model conditioned on both observed and unobserved random variables; (c) predicting values of observed random variables conditioned on unobserved random variables.
  • creates associated build utilities (CMakeLists.txt files, blank canvas main file)
  • Todo:
    more functionality coming – a work in progress

These functions are implemented using ccyan primitives. ccyan is a C99 library that depends only on libm and stdint. It does not dynamically allocate memory, making it safe for many low-resource or real-time applications.

Template Parameters
TsThe distribution types in the graph_ir
Parameters
gra graph_ir and a record pair
infoinformation about the generated program
Todo:
more information – a work in progress
Parameters
file_if not null, the directory in which to save the generated code relative to executable directory (e.g., "out/")
Returns
program_rep