neuralqx.experimental.operators.symbolic.dsl.selectors module¶
Symbolic selector helpers for the declarative symbolic operator DSL.
Selectors are lightweight immutable facades used at build time to construct IR symbol references pointing to site quantum numbers, site indices, and free named parameters.
- class SiteSelector(label, namespace='site')¶
Bases:
objectSymbolic selector for one Hilbert-space site iterator.
SiteSelector is created by
site()and used inside DSL predicates, amplitude rules, and update programs. Attribute access on a selector returns symbolicAmplitudeExprnodes that are resolved by the compiler at lowering time.- Parameters:
label (
str) – Iterator label bound byfor_each_site(label).
- site(label)¶
Returns a symbolic site selector.
- Parameters:
label (
str) – Iterator label bound byfor_each_site(label)orfor_each_pair(label_a, label_b).- Return type:
- Returns:
Site selector handle.
Example
from neuralqx.experimental.operators.symbolic.dsl import site s = site("i") print(s.value) # AmplitudeExpr, x[i] print(s.index) # AmplitudeExpr, i print(s.value < 3) # PredicateExpr, x[i] < 3 print(s.value + 1) # AmplitudeExpr, x[i] + 1
- emitted(label)¶
Returns a symbolic selector bound to the emitted or connected state
x'.- Return type:
Example
from neuralqx.experimental.operators.symbolic.dsl import emitted e = emitted("i") print(e.value) # AmplitudeExpr, x'[i] print(e.index) # AmplitudeExpr, i