-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
Looking for feedback on the API for #283, where we want to add interoperability with cirq.
There is already a draft PR here: #294
The currently chosen API there looks like this:
import cirq
from bloqade import squin
qubit = cirq.GridQubit(0, 0)
qubit2 = cirq.GridQubit(1, 0)
# Create a circuit.
circuit = cirq.Circuit(
cirq.X(qubit),
cirq.Y(qubit2),
cirq.Z(qubit),
cirq.H(qubit),
cirq.S(qubit),
cirq.T(qubit2),
cirq.Rx(rads=math.pi / 4).on(qubit),
cirq.Ry(rads=math.pi / 3).on(qubit2),
cirq.Rz(rads=math.pi / 10).on(qubit),
cirq.CX(qubit2, qubit),
cirq.CZ(qubit, qubit2),
cirq.measure(qubit, key="m"), # Measurement.
)
kernel = squin.load_circuit(circuit)
kernel.print()The created kernel is a method as it would be when defined using the @squin.kernel decorator on a function. So we can then run passes / rewrites on that and throw it e.g. into a pyqrack simulator.
There are still some features missing (e.g. noisy circuits) and the API is still up for discussion.
Note, that we are also looking into potentially adding support to create a circuit from a kernel in the future. Just to keep that in mind, although there should no be discussion on this part in this issue.