Skip to content

Commit fef7072

Browse files
authored
Remove returns from if body for compat with new kirin version (#301)
1 parent 733e85a commit fef7072

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

docs/digital/examples/qasm2/qft.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323

2424
@qasm2.extended
2525
def qft(qreg: qasm2.QReg, n: int, k: int):
26-
if k == n:
27-
return qreg
28-
29-
qasm2.h(qreg[k])
30-
for i in range(k + 1, n):
31-
qasm2.cu1(qreg[i], qreg[k], 2 * math.pi / 2**i)
32-
qft(qreg, n, k + 1) # recursion
26+
if k != n:
27+
qasm2.h(qreg[k])
28+
for i in range(k + 1, n):
29+
qasm2.cu1(qreg[i], qreg[k], 2 * math.pi / 2**i)
30+
qft(qreg, n, k + 1) # recursion
3331
return qreg
3432

3533

docs/digital/examples/qasm2/repeat_until_success.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ def z_phase_gate_recursive(target: qasm2.Qubit, theta: float) -> qasm2.Qubit:
8181
qasm2.cx(ancilla, target)
8282
creg = qasm2.creg(1)
8383
qasm2.measure(target, creg[0])
84-
if not creg[0]:
85-
return z_phase_gate_recursive(ancilla, 2 * theta)
8684
if creg[0]:
8785
qasm2.x(ancilla)
86+
else:
87+
ancilla = z_phase_gate_recursive(ancilla, 2 * theta)
8888
return ancilla
8989

9090

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ classifiers = [
1919
]
2020
requires-python = ">=3.10"
2121
dependencies = [
22-
"bloqade-circuit[cirq,qasm2,qbraid,vis,stim]~=0.8.0",
22+
"bloqade-circuit[cirq,qasm2,qbraid,vis,stim]~=0.9.0",
2323
"bloqade-analog~=0.16.3",
2424
]
2525

0 commit comments

Comments
 (0)