Skip to content

Commit 27d7e2f

Browse files
committed
updating the names of statement fields to match squin
1 parent f09029f commit 27d7e2f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/bloqade/native/dialects/gate/stmts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
@statement(dialect=dialect)
1313
class CZ(ir.Statement):
1414
traits = frozenset({lowering.FromPythonCall()})
15-
ctrls: ir.SSAValue = info.argument(ilist.IListType[QubitType, N])
16-
qargs: ir.SSAValue = info.argument(ilist.IListType[QubitType, N])
15+
controls: ir.SSAValue = info.argument(ilist.IListType[QubitType, N])
16+
targets: ir.SSAValue = info.argument(ilist.IListType[QubitType, N])
1717

1818

1919
@statement(dialect=dialect)
2020
class R(ir.Statement):
2121
traits = frozenset({lowering.FromPythonCall()})
22-
inputs: ir.SSAValue = info.argument(ilist.IListType[QubitType, types.Any])
22+
qubits: ir.SSAValue = info.argument(ilist.IListType[QubitType, types.Any])
2323
axis_angle: ir.SSAValue = info.argument(types.Float)
2424
rotation_angle: ir.SSAValue = info.argument(types.Float)
2525

2626

2727
@statement(dialect=dialect)
2828
class Rz(ir.Statement):
2929
traits = frozenset({lowering.FromPythonCall()})
30-
inputs: ir.SSAValue = info.argument(ilist.IListType[QubitType, types.Any])
30+
qubits: ir.SSAValue = info.argument(ilist.IListType[QubitType, types.Any])
3131
rotation_angle: ir.SSAValue = info.argument(types.Float)

src/bloqade/pyqrack/native.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
from pyqrack import Pauli
88
from bloqade.pyqrack import PyQrackQubit
99
from bloqade.pyqrack.base import PyQrackInterpreter
10-
from bloqade.native.dialects import gates
10+
from bloqade.native.dialects import gate
1111

1212

13-
@gates.dialect.register(key="pyqrack")
13+
@gate.dialect.register(key="pyqrack")
1414
class NativeMethods(interp.MethodTable):
1515

16-
@interp.impl(gates.CZ)
17-
def cz(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gates.CZ):
18-
ctrls = frame.get_casted(stmt.ctrls, ilist.IList[PyQrackQubit, Any])
19-
qargs = frame.get_casted(stmt.qargs, ilist.IList[PyQrackQubit, Any])
16+
@interp.impl(gate.CZ)
17+
def cz(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gate.CZ):
18+
ctrls = frame.get_casted(stmt.controls, ilist.IList[PyQrackQubit, Any])
19+
qargs = frame.get_casted(stmt.targets, ilist.IList[PyQrackQubit, Any])
2020

2121
for ctrl, qarg in zip(ctrls, qargs):
2222
if ctrl.is_active() and qarg.is_active():
2323
ctrl.sim_reg.mcz([ctrl.addr], qarg.addr)
2424

2525
return ()
2626

27-
@interp.impl(gates.R)
28-
def r(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gates.R):
29-
inputs = frame.get_casted(stmt.inputs, ilist.IList[PyQrackQubit, Any])
27+
@interp.impl(gate.R)
28+
def r(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gate.R):
29+
inputs = frame.get_casted(stmt.qubits, ilist.IList[PyQrackQubit, Any])
3030
rotation_angle = 2 * math.pi * frame.get_casted(stmt.rotation_angle, float)
3131
axis_angle = 2 * math.pi * frame.get_casted(stmt.axis_angle, float)
3232
for qubit in inputs:
@@ -37,9 +37,9 @@ def r(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gates.R):
3737

3838
return ()
3939

40-
@interp.impl(gates.Rz)
41-
def rz(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gates.Rz):
42-
inputs = frame.get_casted(stmt.inputs, ilist.IList[PyQrackQubit, Any])
40+
@interp.impl(gate.Rz)
41+
def rz(self, _interp: PyQrackInterpreter, frame: interp.Frame, stmt: gate.Rz):
42+
inputs = frame.get_casted(stmt.qubits, ilist.IList[PyQrackQubit, Any])
4343
rotation_angle = 2 * math.pi * frame.get_casted(stmt.rotation_angle, float)
4444

4545
for qubit in inputs:

0 commit comments

Comments
 (0)