Skip to content

Commit 69c5e96

Browse files
committed
Add CZGaugeTransformer in the top-level init.
1 parent 336a71f commit 69c5e96

6 files changed

Lines changed: 47 additions & 1 deletion

File tree

cirq-core/cirq/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,11 @@
352352
align_left as align_left,
353353
align_right as align_right,
354354
CompilationTargetGateset as CompilationTargetGateset,
355-
CZTargetGateset as CZTargetGateset,
356355
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition, # noqa: E501
356+
CPhaseGaugeTransformerMM as CPhaseGaugeTransformerMM,
357357
create_transformer_with_kwargs as create_transformer_with_kwargs,
358+
CZGaugeTransformer as CZGaugeTransformer,
359+
CZTargetGateset as CZTargetGateset,
358360
decompose_clifford_tableau_to_operations as decompose_clifford_tableau_to_operations,
359361
decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim,
360362
decompose_multi_controlled_x as decompose_multi_controlled_x,
@@ -372,6 +374,7 @@
372374
HardCodedInitialMapper as HardCodedInitialMapper,
373375
index_tags as index_tags,
374376
is_negligible_turn as is_negligible_turn,
377+
ISWAPGaugeTransformer as ISWAPGaugeTransformer,
375378
LineInitialMapper as LineInitialMapper,
376379
MappingManager as MappingManager,
377380
map_clean_and_borrowable_qubits as map_clean_and_borrowable_qubits,
@@ -402,6 +405,9 @@
402405
single_qubit_matrix_to_phased_x_z as single_qubit_matrix_to_phased_x_z,
403406
single_qubit_matrix_to_phxz as single_qubit_matrix_to_phxz,
404407
single_qubit_op_to_framed_phase_form as single_qubit_op_to_framed_phase_form,
408+
SpinInversionGaugeTransformer as SpinInversionGaugeTransformer,
409+
SqrtCZGaugeTransformer as SqrtCZGaugeTransformer,
410+
SqrtISWAPGaugeTransformer as SqrtISWAPGaugeTransformer,
405411
stratified_circuit as stratified_circuit,
406412
symbolize_single_qubit_gates_by_indexed_tags as symbolize_single_qubit_gates_by_indexed_tags,
407413
synchronize_terminal_measurements as synchronize_terminal_measurements,

cirq-core/cirq/transformers/gauge_compiling/cz_gauge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import annotations
1818

1919
from cirq import ops
20+
from cirq._doc import document
2021
from cirq.ops.common_gates import CZ
2122
from cirq.transformers.gauge_compiling.gauge_compiling import (
2223
ConstantGauge,
@@ -46,3 +47,10 @@
4647
)
4748

4849
CZGaugeTransformer = GaugeTransformer(target=CZ, gauge_selector=CZGaugeSelector)
50+
document(
51+
CZGaugeTransformer,
52+
r"""A GaugeTransformer that gauges CZ gates.
53+
54+
Usage: `CZGaugeTransformer(circuit)` will return a new circuit with all CZ gates gauged by the CZGaugeSelector gauge.
55+
""",
56+
)

cirq-core/cirq/transformers/gauge_compiling/iswap_gauge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import numpy as np
2020

2121
from cirq import ops
22+
from cirq._doc import document
2223
from cirq.transformers.gauge_compiling.gauge_compiling import (
2324
ConstantGauge,
2425
Gauge,
@@ -105,3 +106,10 @@ def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge:
105106
ISWAPGaugeTransformer = GaugeTransformer(
106107
target=ops.ISWAP, gauge_selector=GaugeSelector(gauges=[RZRotation(), XYRotation()])
107108
)
109+
document(
110+
ISWAPGaugeTransformer,
111+
r"""A GaugeTransformer that gauges ISWAP gates.
112+
113+
Usage: `ISWAPGaugeTransformer(circuit)` will return a new circuit with all ISWAP gates gauged by either the RZRotation gauge or the XYRotation gauge.
114+
""",
115+
)

cirq-core/cirq/transformers/gauge_compiling/spin_inversion_gauge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import annotations
1818

1919
from cirq import ops
20+
from cirq._doc import document
2021
from cirq.transformers.gauge_compiling.gauge_compiling import (
2122
GaugeSelector,
2223
GaugeTransformer,
@@ -33,3 +34,10 @@
3334
SpinInversionGaugeTransformer = GaugeTransformer(
3435
target=ops.GateFamily(ops.ZZPowGate), gauge_selector=SpinInversionGaugeSelector
3536
)
37+
document(
38+
SpinInversionGaugeTransformer,
39+
r"""A GaugeTransformer that gauges gates in the ZZPowGate family by either applying an X gate before and after the two qubits or doing nothing.
40+
41+
Usage: `SpinInversionGaugeTransformer(circuit)` will return a new circuit with all gates in the ZZPowGate family gauged by the gauges.
42+
""",
43+
)

cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from numbers import Real
2121
from typing import TYPE_CHECKING
2222

23+
from cirq._doc import document
2324
from cirq.ops import CZ, CZPowGate, Gate, Gateset, S, X
2425
from cirq.transformers.gauge_compiling.gauge_compiling import (
2526
ConstantGauge,
@@ -82,3 +83,10 @@ def _symbolize_as_cz_pow(
8283
symbolizer_fn=_symbolize_as_cz_pow, n_symbols=1
8384
),
8485
)
86+
document(
87+
SqrtCZGaugeTransformer,
88+
r"""A GaugeTransformer that gauges CZ**0.5 and CZ**-0.5 gates.
89+
90+
Usage: `SqrtCZGaugeTransformer(circuit)` will return a new circuit with all CZ**0.5 and CZ**-0.5 gates gauged by the SqrtCZGauge gauge.
91+
""",
92+
)

cirq-core/cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import numpy as np
2020

2121
from cirq import ops
22+
from cirq._doc import document
2223
from cirq.transformers.gauge_compiling.gauge_compiling import (
2324
ConstantGauge,
2425
Gauge,
@@ -95,3 +96,10 @@ def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge:
9596
SqrtISWAPGaugeTransformer = GaugeTransformer(
9697
target=ops.SQRT_ISWAP, gauge_selector=SqrtISWAPGaugeSelector
9798
)
99+
document(
100+
SqrtISWAPGaugeTransformer,
101+
r"""A GaugeTransformer that gauges SQRT_ISWAP gates.
102+
103+
Usage: `SqrtISWAPGaugeTransformer(circuit)` will return a new circuit with all SQRT_ISWAP gates gauged by either the RZRotation gauge or the XYRotation gauge.
104+
""",
105+
)

0 commit comments

Comments
 (0)