Skip to content

Add Quantum Engine support for cirq.CZPowGate #6562

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

Merged
merged 21 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cirq-google/cirq_google/api/v2/device.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ message GateSpecification {
Measurement meas = 10;
Wait wait = 11;
FSimViaModel fsim_via_model = 12;
CZPowGate cz_pow_gate = 13;
}

// Gate types available to Google devices.
Expand All @@ -74,6 +75,7 @@ message GateSpecification {
message Measurement {}
message Wait {}
message FSimViaModel {}
message CZPowGate {}
}

message GateSet {
Expand Down
82 changes: 42 additions & 40 deletions cirq-google/cirq_google/api/v2/device_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions cirq-google/cirq_google/api/v2/device_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cirq-google/cirq_google/devices/grid_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
_SYC_GATE_FAMILY = cirq.GateFamily(ops.SYC)
_SQRT_ISWAP_GATE_FAMILY = cirq.GateFamily(cirq.SQRT_ISWAP)
_SQRT_ISWAP_INV_GATE_FAMILY = cirq.GateFamily(cirq.SQRT_ISWAP_INV)
_CZ_GATE_FAMILY = cirq.GateFamily(cirq.CZ)
_CZ_GATE_FAMILY = cirq.GateFamily(cirq.CZPowGate)


# TODO(#5050) Add GlobalPhaseGate
Expand Down
12 changes: 6 additions & 6 deletions cirq-google/cirq_google/devices/grid_device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _create_device_spec_with_horizontal_couplings():
cirq.GateFamily(cirq_google.SYC),
cirq.GateFamily(cirq.SQRT_ISWAP),
cirq.GateFamily(cirq.SQRT_ISWAP_INV),
cirq.GateFamily(cirq.CZ),
cirq.GateFamily(cirq.CZPowGate),
cirq.GateFamily(cirq.ops.phased_x_z_gate.PhasedXZGate),
cirq.GateFamily(cirq.ops.common_gates.XPowGate),
cirq.GateFamily(cirq.ops.common_gates.YPowGate),
Expand Down Expand Up @@ -122,7 +122,7 @@ def _create_device_spec_with_horizontal_couplings():
cirq.GateFamily(cirq_google.SYC): base_duration * 0,
cirq.GateFamily(cirq.SQRT_ISWAP): base_duration * 1,
cirq.GateFamily(cirq.SQRT_ISWAP_INV): base_duration * 2,
cirq.GateFamily(cirq.CZ): base_duration * 3,
cirq.GateFamily(cirq.CZPowGate): base_duration * 3,
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,
Expand Down Expand Up @@ -181,7 +181,7 @@ def _create_device_spec_with_horizontal_couplings():
cirq_google.FSimGateFamily(gates_to_accept=[cirq.CZ]),
cirq.GateFamily(cirq_google.SYC),
cirq.GateFamily(cirq.SQRT_ISWAP_INV),
cirq.GateFamily(cirq.CZ),
cirq.GateFamily(cirq.CZPowGate),
cirq.ops.common_gates.XPowGate,
cirq.ops.common_gates.YPowGate,
cirq.ops.common_gates.HPowGate,
Expand Down Expand Up @@ -502,7 +502,7 @@ def test_device_from_device_information_equals_device_from_proto():
cirq_google.SYC,
cirq.SQRT_ISWAP,
cirq.SQRT_ISWAP_INV,
cirq.CZ,
cirq.GateFamily(cirq.CZPowGate),
cirq.ops.phased_x_z_gate.PhasedXZGate,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand All @@ -521,7 +521,7 @@ def test_device_from_device_information_equals_device_from_proto():
cirq.GateFamily(cirq_google.SYC): base_duration * 0,
cirq.GateFamily(cirq.SQRT_ISWAP): base_duration * 1,
cirq.GateFamily(cirq.SQRT_ISWAP_INV): base_duration * 2,
cirq.GateFamily(cirq.CZ): base_duration * 3,
cirq.GateFamily(cirq.CZPowGate): base_duration * 3,
cirq.GateFamily(cirq.ops.phased_x_z_gate.PhasedXZGate): base_duration * 4,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand Down Expand Up @@ -627,7 +627,7 @@ def test_to_proto():
cirq.GateFamily(cirq_google.SYC): base_duration * 0,
cirq.GateFamily(cirq.SQRT_ISWAP): base_duration * 1,
cirq.GateFamily(cirq.SQRT_ISWAP_INV): base_duration * 2,
cirq.GateFamily(cirq.CZ): base_duration * 3,
cirq.GateFamily(cirq.CZPowGate): base_duration * 3,
cirq.GateFamily(cirq.ops.phased_x_z_gate.PhasedXZGate): base_duration * 4,
cirq.GateFamily(
cirq.ops.common_gates.ZPowGate, tags_to_ignore=[cirq_google.PhysicalZTag()]
Expand Down