Skip to content

Commit 478350d

Browse files
committed
Merge branch 'main' into phil/new-address-analysis
2 parents b95646f + b6a48b4 commit 478350d

File tree

6 files changed

+107
-126
lines changed

6 files changed

+107
-126
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
token: ${{ secrets.CODECOV_TOKEN }} # required
4444
- name: Archive code coverage results
4545
if: matrix.python-version == '3.12'
46-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@v5
4747
with:
4848
name: code-coverage-report
4949
path: coverage.xml
@@ -55,7 +55,7 @@ jobs:
5555
steps:
5656
- uses: actions/checkout@v5
5757
- name: download covearge
58-
uses: actions/download-artifact@v5
58+
uses: actions/download-artifact@v6
5959
with:
6060
name: code-coverage-report
6161
- name: check coverage

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Build distribution 📦
2020
run: uv build
2121
- name: Store the distribution packages
22-
uses: actions/upload-artifact@v4
22+
uses: actions/upload-artifact@v5
2323
with:
2424
name: python-package-distributions
2525
path: dist/
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Download all the dists
42-
uses: actions/download-artifact@v5
42+
uses: actions/download-artifact@v6
4343
with:
4444
name: python-package-distributions
4545
path: dist/
@@ -60,12 +60,12 @@ jobs:
6060

6161
steps:
6262
- name: Download all the dists
63-
uses: actions/download-artifact@v5
63+
uses: actions/download-artifact@v6
6464
with:
6565
name: python-package-distributions
6666
path: dist/
6767
- name: Sign the dists with Sigstore
68-
uses: sigstore/gh-action-sigstore-python@v3.0.1
68+
uses: sigstore/gh-action-sigstore-python@v3.1.0
6969
with:
7070
inputs: >-
7171
./dist/*.tar.gz

src/bloqade/squin/rewrite/U3_to_clifford.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ class Sdag(ir.Statement):
1515
pass
1616

1717

18+
class SqrtXdag(ir.Statement):
19+
pass
20+
21+
22+
class SqrtYdag(ir.Statement):
23+
pass
24+
25+
1826
# (theta, phi, lam)
1927
U3_HALF_PI_ANGLE_TO_GATES: dict[
2028
tuple[int, int, int], list[type[ir.Statement]] | list[None]
@@ -27,21 +35,21 @@ class Sdag(ir.Statement):
2735
(1, 0, 1): [gate.stmts.S, gate.stmts.SqrtY],
2836
(1, 0, 2): [gate.stmts.H],
2937
(1, 0, 3): [Sdag, gate.stmts.SqrtY],
30-
(1, 1, 0): [gate.stmts.SqrtY, gate.stmts.S],
31-
(1, 1, 1): [gate.stmts.S, gate.stmts.SqrtY, gate.stmts.S],
32-
(1, 1, 2): [gate.stmts.Z, gate.stmts.SqrtY, gate.stmts.S],
33-
(1, 1, 3): [Sdag, gate.stmts.SqrtY, gate.stmts.S],
34-
(1, 2, 0): [gate.stmts.SqrtY, gate.stmts.Z],
35-
(1, 2, 1): [gate.stmts.S, gate.stmts.SqrtY, gate.stmts.Z],
36-
(1, 2, 2): [gate.stmts.Z, gate.stmts.SqrtY, gate.stmts.Z],
37-
(1, 2, 3): [Sdag, gate.stmts.SqrtY, gate.stmts.Z],
38-
(1, 3, 0): [gate.stmts.SqrtY, Sdag],
39-
(1, 3, 1): [gate.stmts.S, gate.stmts.SqrtY, Sdag],
40-
(1, 3, 2): [gate.stmts.Z, gate.stmts.SqrtY, Sdag],
41-
(1, 3, 3): [Sdag, gate.stmts.SqrtY, Sdag],
38+
(1, 1, 0): [gate.stmts.S, SqrtXdag],
39+
(1, 1, 1): [gate.stmts.Z, SqrtXdag],
40+
(1, 1, 2): [Sdag, SqrtXdag],
41+
(1, 1, 3): [SqrtXdag],
42+
(1, 2, 0): [gate.stmts.Z, SqrtYdag],
43+
(1, 2, 1): [Sdag, SqrtYdag],
44+
(1, 2, 2): [SqrtYdag],
45+
(1, 2, 3): [gate.stmts.S, SqrtYdag],
46+
(1, 3, 0): [Sdag, gate.stmts.SqrtX],
47+
(1, 3, 1): [gate.stmts.SqrtX],
48+
(1, 3, 2): [gate.stmts.S, gate.stmts.SqrtX],
49+
(1, 3, 3): [gate.stmts.Z, gate.stmts.SqrtX],
4250
(2, 0, 0): [gate.stmts.Y],
4351
(2, 0, 1): [gate.stmts.S, gate.stmts.Y],
44-
(2, 0, 2): [gate.stmts.Z, gate.stmts.Y],
52+
(2, 0, 2): [gate.stmts.X],
4553
(2, 0, 3): [Sdag, gate.stmts.Y],
4654
}
4755

@@ -106,6 +114,10 @@ def rewrite_U3(self, node: gate.stmts.U3) -> RewriteResult:
106114
for gate_stmt in gates:
107115
if gate_stmt is Sdag:
108116
new_stmt = gate.stmts.S(adjoint=True, qubits=node.qubits)
117+
elif gate_stmt is SqrtXdag:
118+
new_stmt = gate.stmts.SqrtX(adjoint=True, qubits=node.qubits)
119+
elif gate_stmt is SqrtYdag:
120+
new_stmt = gate.stmts.SqrtY(adjoint=True, qubits=node.qubits)
109121
else:
110122
new_stmt = gate_stmt(qubits=node.qubits)
111123
new_stmt.insert_before(node)

0 commit comments

Comments
 (0)