neuralqx.experimental.operators.symbolic.ir.term module

Typed declarative symbolic operator-term IR structures.

class EmissionSpec(update_program, amplitude, branch_tag=None)

Bases: object

One output branch (connected state + matrix element) of a term.

A single iterator evaluation can produce multiple branches, one per EmissionSpec in the parent term’s emissions tuple. This allows a plaquette term, for example, to emit both + and - connected states from the same site-tuple without splitting into two separate terms.

update_program

Site-update program mapping x -> x'.

amplitude

Matrix-element expression evaluated in the source environment.

branch_tag

Optional diagnostic tag for this emission slot.

class KBodyIteratorSpec(labels, index_sets)

Bases: object

Static K-body iterator over a pre-computed list of site-index tuples.

This iterator evaluates a term kernel once per entry in index_sets. Each entry is a K-tuple of integer site indices that are bound to the corresponding element of labels inside the evaluation environment.

For a single-site iterator over all N sites, use KBodyIteratorSpec(labels=("i",), index_sets=tuple((k,) for k in range(N))). For a static triplet iterator, provide the explicit list of (e1, e2, e3) triplets. For a global (one-branch) term, use KBodyIteratorSpec(labels=(), index_sets=((),)).

labels

Ordered tuple of K label strings bound per iteration.

index_sets

M-tuple of K-tuples of int site indices.

class SymbolicIRTerm(name, iterator, predicate, update_program, amplitude, branch_tag=None, metadata=<factory>, fanout_hint=None, emissions=None)

Bases: object

One primitive declarative symbolic operator term.

name

Term name.

iterator

Iterator descriptor (KBodyIteratorSpec).

predicate

Branch-selection predicate.

update_program

Matrix-element update program.

amplitude

Matrix-element expression.

branch_tag

Optional branch tag for diagnostics.

metadata

Optional stable term metadata tuple.

fanout_hint

Optional static upper-bound hint on the number of connected states this term produces per input configuration.

emissions

Optional multi-emission tuple that, when present, supersedes update_program and amplitude. Each entry is an EmissionSpec representing one output branch per iterator evaluation.

_scale_ir_term(term, scale_expr)

Returns a new SymbolicIRTerm with all emission amplitudes multiplied by scale_expr.

Handles both the multi-emission path (term.emissions is not None) and the single-emission path.

Return type:

SymbolicIRTerm