Qx.Export.OpenQASM.Codegen (Qx - Quantum Computing Simulator v0.6.0)
View SourceTranslates a single OpenQASM gate definition into Elixir source code
that defines an equivalent circuit-transforming function.
The generated function has the signature
def name(circuit, p1, p2, ..., q1, q2, ...)— circuit first, then declared parameters in source order, then qubit
arguments in source order — and returns a new circuit with the
expanded gate body applied.
Only stdgate references are emitted in v1; nested user-defined gate
references and modifiers (inv, pow, ctrl, negctrl) are rejected
with Qx.QasmUnsupportedError upstream in the parser/lowering layer.
Summary
Functions
Generates a %{name, arity, source} map from a :gate_def AST node.
Functions
@spec generate(tuple()) :: {:ok, map()} | {:error, Exception.t()}
Generates a %{name, arity, source} map from a :gate_def AST node.
Returns {:ok, map} or {:error, exception}.