File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/bloqade/squin/rewrite/qasm2 Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1111 uop_stmts .Z : squin .z ,
1212 uop_stmts .H : squin .h ,
1313 uop_stmts .S : squin .s ,
14- uop_stmts .T : squin .t ,
14+ uop_stmts .Sdag : squin .s_adj ,
1515 uop_stmts .SX : squin .sqrt_x ,
16+ uop_stmts .SXdag : squin .sqrt_x_adj ,
17+ uop_stmts .Tdag : squin .t_adj ,
18+ uop_stmts .T : squin .t ,
1619}
1720
1821
Original file line number Diff line number Diff line change @@ -71,8 +71,11 @@ def non_parametric_gates():
7171 qasm2 .z (q [0 ])
7272 qasm2 .h (q [0 ])
7373 qasm2 .s (q [0 ])
74+ qasm2 .sdg (q [0 ])
7475 qasm2 .t (q [0 ])
76+ qasm2 .tdg (q [0 ])
7577 qasm2 .sx (q [0 ])
78+ qasm2 .sxdg (q [0 ])
7679
7780 # 2q gates
7881 qasm2 .cx (q [0 ], q [1 ])
@@ -105,15 +108,35 @@ def non_parametric_gates():
105108 squin .gate .stmts .Z ,
106109 squin .gate .stmts .H ,
107110 squin .gate .stmts .S ,
111+ squin .gate .stmts .S , # adjoint=True
108112 squin .gate .stmts .T ,
113+ squin .gate .stmts .T , # adjoint=True
109114 squin .gate .stmts .SqrtX ,
115+ squin .gate .stmts .SqrtX , # adjoint=True
110116 squin .gate .stmts .CX ,
111117 squin .gate .stmts .CY ,
112118 squin .gate .stmts .CZ ,
113119 ]
114120
115121 assert [type (stmt ) for stmt in actual_stmts ] == expected_stmts
116122
123+ has_s_adj = False
124+ has_t_adj = False
125+ has_sqrtx_adj = False
126+
127+ for stmt in actual_stmts :
128+
129+ if type (stmt ) is squin .gate .stmts .S and stmt .adjoint :
130+ has_s_adj = True
131+ elif type (stmt ) is squin .gate .stmts .T and stmt .adjoint :
132+ has_t_adj = True
133+ elif type (stmt ) is squin .gate .stmts .SqrtX and stmt .adjoint :
134+ has_sqrtx_adj = True
135+
136+ assert has_s_adj
137+ assert has_t_adj
138+ assert has_sqrtx_adj
139+
117140
118141def test_parametric_gates ():
119142
You can’t perform that action at this time.
0 commit comments