generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The following code is technically against the OpenQASM spec, as you can only close over global const variables (https://openqasm.com/language/scope.html#subroutine-and-gate-scope)
We may want to choose to interpret this as inputs allowed, since it's ambiguous whether those can change at runtime (be overwritten)
@aq.subroutine
def rx_alpha(qubit: int):
rx(qubit, FreeParameter("alpha"))
@aq.main(num_qubits=3)
def parametric():
rx_alpha(2)
expected = """OPENQASM 3.0;
def rx_alpha(int[32] qubit) {
rx(alpha) __qubits__[qubit];
}
input float[64] alpha;
qubit[3] __qubits__;
rx_alpha(2);"""
Note that the generated rx_alpha subroutine references the alpha input variable, which is defined only at global scope.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog