|
6 | 6 | - [ ] multi qubit gates via MPO for MPS simulation
|
7 | 7 | """
|
8 | 8 |
|
| 9 | +import cmath |
9 | 10 | import functools
|
10 | 11 | import itertools
|
11 | 12 | import math
|
@@ -419,6 +420,8 @@ def register_special_gate(name, fn, num_qubits, tag=None, array=None):
|
419 | 420 | register_constant_gate("SDG", qu.S_gate().H, 1)
|
420 | 421 | register_constant_gate("T", qu.T_gate(), 1)
|
421 | 422 | register_constant_gate("TDG", qu.T_gate().H, 1)
|
| 423 | +register_constant_gate("SX", cmath.rect(1, 0.25 * math.pi) * qu.Xsqrt(), 1) |
| 424 | +register_constant_gate("SXDG", cmath.rect(1, -0.25 * math.pi) * qu.Xsqrt().H, 1) |
422 | 425 | register_constant_gate("X_1_2", qu.Xsqrt(), 1, "X_1/2")
|
423 | 426 | register_constant_gate("Y_1_2", qu.Ysqrt(), 1, "Y_1/2")
|
424 | 427 | register_constant_gate("Z_1_2", qu.Zsqrt(), 1, "Z_1/2")
|
@@ -2038,6 +2041,12 @@ def t(self, i, gate_round=None, **kwargs):
|
2038 | 2041 | def tdg(self, i, gate_round=None, **kwargs):
|
2039 | 2042 | self.apply_gate("TDG", i, gate_round=gate_round, **kwargs)
|
2040 | 2043 |
|
| 2044 | + def sx(self, i, gate_round=None, **kwargs): |
| 2045 | + self.apply_gate("SX", i, gate_round=gate_round, **kwargs) |
| 2046 | + |
| 2047 | + def sxdg(self, i, gate_round=None, **kwargs): |
| 2048 | + self.apply_gate("SXDG", i, gate_round=gate_round, **kwargs) |
| 2049 | + |
2041 | 2050 | def x_1_2(self, i, gate_round=None, **kwargs):
|
2042 | 2051 | self.apply_gate("X_1_2", i, gate_round=gate_round, **kwargs)
|
2043 | 2052 |
|
|
0 commit comments