You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to allow users to declare pytket circuits to be used within Guppy at the module level:
frompytketimportCircuitpytket_circ=Circuit(2)
pytket_circ.H(0)
pytket_circ.CX(0, 1)
@guppy.pytket(pytket_circ)defguppy_circ(q1: qubit, q2: qubit) ->None:
"""Explicit stub for the circuit."""# Alternatively, we also want to support loading without declaring a stubguppy_circ=guppy.load_pytket(circ)
@guppydefmain() ->None:
q1, q2=qubit(), qubit()
guppy_circ(q1, q2)
measure(q1)
measure(q2)
The benefit of the stub approach is that it will allow the user to specify whether they want to use arrays for registers or pass qubits one by one.
To implement this feature, we need to add new kind of Definition:
RawPytketDef that holds a reference to the Python stub function and implements ParsableDef. The parse method should check that the provided stub signature makes sense for the circuit.
ParsedPytketDef that holds the parsed circuit signature and implements CallableDef and CheckableDef. guppy.load_pytket should directly lower to that.
CompiledPytketDef that holds a reference to the Hugr FuncDefn that was generated for the circuit and implements CompiledCallableDef.
In decorator.py, we need to add the appropriate guppy_circ and load_pytket functions that construct a RawPytketDef or a PytketDef respectively, and register it with the current module.
ss2165
changed the title
read in py circuit as a function definition rather than value
Load circuit as a function definition
Nov 25, 2024
So that function value execution isn't required
Use uuids for circuits - can use circuit names or custom names in future once we have #563 and use that for circuits
The text was updated successfully, but these errors were encountered: