![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Template implementation of GenericCircuit::evaluate().
More...


Go to the source code of this file.
Template implementation of GenericCircuit::evaluate().
Provides the out-of-line definition of the evaluate() template method declared in GenericCircuit.h. This file must be included (directly or transitively) by any translation unit that instantiates GenericCircuit::evaluate<S>() for a specific semiring type S.
The evaluate() method performs a post-order traversal of the sub-circuit rooted at gate g, looking up input-gate values from provenance_mapping and combining them using the semiring operations:
| Gate type | Semiring operation |
|---|---|
| gate_input | lookup in provenance_mapping (else unmapped_input) |
| gate_plus | semiring.plus(children) |
| gate_times | semiring.times(children) |
| gate_monus | semiring.monus(left, right) |
| gate_delta | semiring.delta(child) |
| gate_cmp | semiring.cmp(left, op, right) |
| gate_semimod | semiring.semimod(x, s) |
| gate_agg | semiring.agg(op, children) |
| gate_value | semiring.value(string) |
| gate_one | semiring.one() |
| gate_zero | semiring.zero() |
| gate_rv | semiring.rv(spec, params) |
| gate_arith | semiring.arith(op, children, extra) |
| gate_mixture | semiring.mixture(p, x, y) / semiring.categorical(…) |
| gate_case | semiring.guarded_case(children) |
| gate_observe | semiring.observe(child, datum) |
| gate_conditioned | semiring.conditioned(children) |
The last six are measure-carrier gates with no algebraic reading: the Semiring base class refuses them, and only the symbolic Formula pseudo-semiring overrides the hooks (to render them rather than interpret them).
Definition in file GenericCircuit.hpp.