Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added MSGate to top level #6466

Merged
merged 9 commits into from
Mar 16, 2024
Next Next commit
add MSGate to top level
  • Loading branch information
prakharb10 committed Feb 15, 2024
commit 638ed831dc7c4a1d0be0fd7af8a29e7b7a28c62a
1 change: 1 addition & 0 deletions cirq-core/cirq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
MatrixGate,
MixedUnitaryChannel,
M,
MSGate,
measure,
measure_each,
measure_paulistring_terms,
Expand Down
1 change: 1 addition & 0 deletions cirq-core/cirq/json_resolver_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def _symmetricalqidpair(qids):
'LineTopology': cirq.LineTopology,
'Linspace': cirq.Linspace,
'ListSweep': cirq.ListSweep,
'MSGate': cirq.MSGate,
'MatrixGate': cirq.MatrixGate,
'MixedUnitaryChannel': cirq.MixedUnitaryChannel,
'MeasurementKey': cirq.MeasurementKey,
Expand Down
4 changes: 2 additions & 2 deletions cirq-core/cirq/ops/parity_gates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_trace_distance():
def test_ms_arguments():
eq_tester = cirq.testing.EqualsTester()
eq_tester.add_equality_group(
cirq.ms(np.pi / 2), cirq.ops.MSGate(rads=np.pi / 2), cirq.XXPowGate(global_shift=-0.5)
cirq.ms(np.pi / 2), cirq.MSGate(rads=np.pi / 2), cirq.XXPowGate(global_shift=-0.5)
)
eq_tester.add_equality_group(
cirq.ms(np.pi / 4), cirq.XXPowGate(exponent=0.5, global_shift=-0.5)
Expand Down Expand Up @@ -325,7 +325,7 @@ def test_ms_diagrams():
def test_json_serialization():
def custom_resolver(cirq_type: str):
if cirq_type == "MSGate":
return cirq.ops.MSGate
return cirq.MSGate
return None

assert cirq.read_json(
Expand Down
4 changes: 4 additions & 0 deletions cirq-core/cirq/protocols/json_test_data/MSGate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cirq_type": "MSGate",
"rads": 1.5707963267948966
}
1 change: 1 addition & 0 deletions cirq-core/cirq/protocols/json_test_data/MSGate.repr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cirq.ms(np.pi/2)
Loading