Skip to content

Commit a5dceed

Browse files
radumargmhucka
andauthored
Fixing MS gate inverse is not implemented correctly (Issue 7432) (#7466)
Fixing MS gate inverse is not implemented correctly (Issue #7432) The MS gate has a theta entanglement angle parameter in it's signature, with a 0.25 default value. The problems that need to be corrected here is that when implementing the inverse MS gate the theta parameter is not applied, and instead implicitly its default value is being used when specifying inverse of MS in terms of MS. Code and tests were updated. --------- Co-authored-by: Michael Hucka <[email protected]>
1 parent 346c95b commit a5dceed

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cirq-ionq/cirq_ionq/ionq_native_gates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __pow__(self, power):
248248
return self
249249

250250
if power == -1:
251-
return MSGate(phi0=self.phi0 + 0.5, phi1=self.phi1)
251+
return MSGate(phi0=self.phi0 + 0.5, phi1=self.phi1, theta=self.theta)
252252

253253
return NotImplemented
254254

cirq-ionq/cirq_ionq/ionq_native_gates_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def test_zz_unitary(phase):
100100
[
101101
*[ionq.GPIGate(phi=angle) for angle in PARAMS_FOR_ONE_ANGLE_GATE],
102102
*[ionq.GPI2Gate(phi=angle) for angle in PARAMS_FOR_ONE_ANGLE_GATE],
103-
*[ionq.MSGate(phi0=angles[0], phi1=angles[1]) for angles in PARAMS_FOR_TWO_ANGLE_GATE],
103+
*[
104+
ionq.MSGate(phi0=angles[0], phi1=angles[1], theta=0.8)
105+
for angles in PARAMS_FOR_TWO_ANGLE_GATE
106+
],
104107
*[ionq.ZZGate(theta=angle) for angle in PARAMS_FOR_ONE_ANGLE_GATE],
105108
],
106109
)

0 commit comments

Comments
 (0)