Skip to content

Commit

Permalink
Add newly serializable gates to supported grid device gates (#6499)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Mar 20, 2024
1 parent 1a6c16a commit 527af77
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cirq-google/cirq_google/devices/grid_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,24 @@ class _GateRepresentations:
),
_GateRepresentations(
gate_spec_name='phased_xz',
deserialized_forms=[cirq.PhasedXZGate, cirq.XPowGate, cirq.YPowGate, cirq.PhasedXPowGate],
deserialized_forms=[
cirq.PhasedXZGate,
cirq.XPowGate,
cirq.YPowGate,
cirq.PhasedXPowGate,
cirq.HPowGate,
cirq.GateFamily(cirq.I),
cirq.ops.SingleQubitCliffordGate,
],
serializable_forms=[
# TODO: Extend support to cirq.IdentityGate.
cirq.GateFamily(cirq.I),
cirq.GateFamily(cirq.PhasedXZGate),
cirq.GateFamily(cirq.XPowGate),
cirq.GateFamily(cirq.YPowGate),
cirq.GateFamily(cirq.HPowGate),
cirq.GateFamily(cirq.PhasedXPowGate),
cirq.GateFamily(cirq.ops.SingleQubitCliffordGate),
],
),
_GateRepresentations(
Expand Down Expand Up @@ -263,7 +275,6 @@ def _deserialize_gateset_and_gate_durations(
g = cirq.GateFamily(g)
gate_durations[g] = cirq.Duration(picos=gate_spec.gate_duration_picos)

# TODO(#4833) Add identity gate support
# TODO(#5050) Add GlobalPhaseGate support

return cirq.Gateset(*gates_list), gate_durations
Expand Down
12 changes: 12 additions & 0 deletions cirq-google/cirq_google/devices/grid_device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def _create_device_spec_with_horizontal_couplings():
cirq.ops.phased_x_z_gate.PhasedXZGate,
cirq.ops.common_gates.XPowGate,
cirq.ops.common_gates.YPowGate,
cirq.GateFamily(cirq.I),
cirq.ops.SingleQubitCliffordGate,
cirq.ops.HPowGate,
cirq.ops.phased_x_gate.PhasedXPowGate,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand All @@ -113,6 +116,9 @@ def _create_device_spec_with_horizontal_couplings():
cirq.GateFamily(cirq.ops.phased_x_z_gate.PhasedXZGate): base_duration * 4,
cirq.GateFamily(cirq.ops.common_gates.XPowGate): base_duration * 4,
cirq.GateFamily(cirq.ops.common_gates.YPowGate): base_duration * 4,
cirq.GateFamily(cirq.ops.common_gates.HPowGate): base_duration * 4,
cirq.GateFamily(cirq.I): base_duration * 4,
cirq.GateFamily(cirq.ops.SingleQubitCliffordGate): base_duration * 4,
cirq.GateFamily(cirq.ops.phased_x_gate.PhasedXPowGate): base_duration * 4,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand All @@ -135,6 +141,9 @@ def _create_device_spec_with_horizontal_couplings():
cirq_google.FSimGateFamily(gates_to_accept=[cirq.SQRT_ISWAP_INV]),
cirq.ops.common_gates.XPowGate,
cirq.ops.common_gates.YPowGate,
cirq.ops.common_gates.HPowGate,
cirq.GateFamily(cirq.I),
cirq.ops.SingleQubitCliffordGate,
cirq.ops.phased_x_gate.PhasedXPowGate,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand All @@ -154,6 +163,9 @@ def _create_device_spec_with_horizontal_couplings():
cirq_google.FSimGateFamily(gates_to_accept=[cirq.CZ]),
cirq.ops.common_gates.XPowGate,
cirq.ops.common_gates.YPowGate,
cirq.ops.common_gates.HPowGate,
cirq.GateFamily(cirq.I),
cirq.ops.SingleQubitCliffordGate,
cirq.ops.phased_x_gate.PhasedXPowGate,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand Down

0 comments on commit 527af77

Please sign in to comment.