Skip to content

Commit

Permalink
nits from Nour
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg committed Mar 3, 2025
1 parent 44e8ccd commit af0dc36
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
12 changes: 7 additions & 5 deletions cirq-core/cirq/transformers/gauge_compiling/cphase_gauge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The Cirq Developers
# Copyright 2025 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,10 +28,12 @@


class CPhasePauliGauge(Gauge):
"""Gauges for the cphase gate (CZPowGate). We identify 16 distinct gauges, corresponding to the
16 two-qubit Pauli operators that can be inserted before the cphase gate. When an anticommuting
gate is inserted, the cphase angle is negated (or equivalently, the exponent of the CZPowGate
is negated), so both postive and negative angles should be calibrated to use this.
"""Gauges for the cphase gate (CZPowGate).
We identify 16 distinct gauges, corresponding to the 16 two-qubit Pauli operators that can be
inserted before the cphase gate. When an anticommuting gate is inserted, the cphase angle is
negated (or equivalently, the exponent of the CZPowGate is negated), so both postive and
negative angles should be calibrated to use this.
"""

def weight(self) -> float:
Expand Down
26 changes: 25 additions & 1 deletion cirq-core/cirq/transformers/gauge_compiling/cphase_gauge_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The Cirq Developers
# Copyright 2025 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,3 +21,27 @@ class TestCPhaseGauge(GaugeTester):
two_qubit_gate = cirq.CZ**0.3
gauge_transformer = CPhaseGaugeTransformer
sweep_must_pass = True


class TestCPhaseGauge(GaugeTester):
two_qubit_gate = cirq.CZ ** (-0.3)
gauge_transformer = CPhaseGaugeTransformer
sweep_must_pass = True


class TestCPhaseGauge(GaugeTester):
two_qubit_gate = cirq.CZ**0.1
gauge_transformer = CPhaseGaugeTransformer
sweep_must_pass = True


class TestCPhaseGauge(GaugeTester):
two_qubit_gate = cirq.CZ ** (-0.1)
gauge_transformer = CPhaseGaugeTransformer
sweep_must_pass = True


class TestCPhaseGauge(GaugeTester):
two_qubit_gate = cirq.CZ**0.7
gauge_transformer = CPhaseGaugeTransformer
sweep_must_pass = True

0 comments on commit af0dc36

Please sign in to comment.