diff --git a/cirq-core/cirq/__init__.py b/cirq-core/cirq/__init__.py index 9753de507be..001486e2b23 100644 --- a/cirq-core/cirq/__init__.py +++ b/cirq-core/cirq/__init__.py @@ -352,9 +352,11 @@ align_left as align_left, align_right as align_right, CompilationTargetGateset as CompilationTargetGateset, - CZTargetGateset as CZTargetGateset, compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition, # noqa: E501 + CPhaseGaugeTransformerMM as CPhaseGaugeTransformerMM, create_transformer_with_kwargs as create_transformer_with_kwargs, + CZGaugeTransformer as CZGaugeTransformer, + CZTargetGateset as CZTargetGateset, decompose_clifford_tableau_to_operations as decompose_clifford_tableau_to_operations, decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim, decompose_multi_controlled_x as decompose_multi_controlled_x, @@ -372,6 +374,7 @@ HardCodedInitialMapper as HardCodedInitialMapper, index_tags as index_tags, is_negligible_turn as is_negligible_turn, + ISWAPGaugeTransformer as ISWAPGaugeTransformer, LineInitialMapper as LineInitialMapper, MappingManager as MappingManager, map_clean_and_borrowable_qubits as map_clean_and_borrowable_qubits, @@ -402,6 +405,9 @@ single_qubit_matrix_to_phased_x_z as single_qubit_matrix_to_phased_x_z, single_qubit_matrix_to_phxz as single_qubit_matrix_to_phxz, single_qubit_op_to_framed_phase_form as single_qubit_op_to_framed_phase_form, + SpinInversionGaugeTransformer as SpinInversionGaugeTransformer, + SqrtCZGaugeTransformer as SqrtCZGaugeTransformer, + SqrtISWAPGaugeTransformer as SqrtISWAPGaugeTransformer, stratified_circuit as stratified_circuit, symbolize_single_qubit_gates_by_indexed_tags as symbolize_single_qubit_gates_by_indexed_tags, synchronize_terminal_measurements as synchronize_terminal_measurements, diff --git a/cirq-core/cirq/transformers/gauge_compiling/cz_gauge.py b/cirq-core/cirq/transformers/gauge_compiling/cz_gauge.py index 8c66850ea4d..d25dcf8eb17 100644 --- a/cirq-core/cirq/transformers/gauge_compiling/cz_gauge.py +++ b/cirq-core/cirq/transformers/gauge_compiling/cz_gauge.py @@ -17,6 +17,7 @@ from __future__ import annotations from cirq import ops +from cirq._doc import document from cirq.ops.common_gates import CZ from cirq.transformers.gauge_compiling.gauge_compiling import ( ConstantGauge, @@ -46,3 +47,10 @@ ) CZGaugeTransformer = GaugeTransformer(target=CZ, gauge_selector=CZGaugeSelector) +document( + CZGaugeTransformer, + r"""A GaugeTransformer that gauges CZ gates. + + Usage: `CZGaugeTransformer(circuit)` will return a new circuit with all CZ gates gauged by the CZGaugeSelector gauge. + """, +) diff --git a/cirq-core/cirq/transformers/gauge_compiling/iswap_gauge.py b/cirq-core/cirq/transformers/gauge_compiling/iswap_gauge.py index c4898f952ca..717de7135d4 100644 --- a/cirq-core/cirq/transformers/gauge_compiling/iswap_gauge.py +++ b/cirq-core/cirq/transformers/gauge_compiling/iswap_gauge.py @@ -19,6 +19,7 @@ import numpy as np from cirq import ops +from cirq._doc import document from cirq.transformers.gauge_compiling.gauge_compiling import ( ConstantGauge, Gauge, @@ -105,3 +106,10 @@ def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge: ISWAPGaugeTransformer = GaugeTransformer( target=ops.ISWAP, gauge_selector=GaugeSelector(gauges=[RZRotation(), XYRotation()]) ) +document( + ISWAPGaugeTransformer, + r"""A GaugeTransformer that gauges ISWAP gates. + + Usage: `ISWAPGaugeTransformer(circuit)` will return a new circuit with all ISWAP gates gauged by either the RZRotation gauge or the XYRotation gauge. + """, +) diff --git a/cirq-core/cirq/transformers/gauge_compiling/spin_inversion_gauge.py b/cirq-core/cirq/transformers/gauge_compiling/spin_inversion_gauge.py index 29700163c8d..5856676e583 100644 --- a/cirq-core/cirq/transformers/gauge_compiling/spin_inversion_gauge.py +++ b/cirq-core/cirq/transformers/gauge_compiling/spin_inversion_gauge.py @@ -17,6 +17,7 @@ from __future__ import annotations from cirq import ops +from cirq._doc import document from cirq.transformers.gauge_compiling.gauge_compiling import ( GaugeSelector, GaugeTransformer, @@ -33,3 +34,10 @@ SpinInversionGaugeTransformer = GaugeTransformer( target=ops.GateFamily(ops.ZZPowGate), gauge_selector=SpinInversionGaugeSelector ) +document( + SpinInversionGaugeTransformer, + 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. + + Usage: `SpinInversionGaugeTransformer(circuit)` will return a new circuit with all gates in the ZZPowGate family gauged by the gauges. + """, +) diff --git a/cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py b/cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py index 71b73a69657..d5f00448dd6 100644 --- a/cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py +++ b/cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py @@ -20,6 +20,7 @@ from numbers import Real from typing import TYPE_CHECKING +from cirq._doc import document from cirq.ops import CZ, CZPowGate, Gate, Gateset, S, X from cirq.transformers.gauge_compiling.gauge_compiling import ( ConstantGauge, @@ -82,3 +83,10 @@ def _symbolize_as_cz_pow( symbolizer_fn=_symbolize_as_cz_pow, n_symbols=1 ), ) +document( + SqrtCZGaugeTransformer, + r"""A GaugeTransformer that gauges CZ**0.5 and CZ**-0.5 gates. + + Usage: `SqrtCZGaugeTransformer(circuit)` will return a new circuit with all CZ**0.5 and CZ**-0.5 gates gauged by the SqrtCZGauge gauge. + """, +) diff --git a/cirq-core/cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py b/cirq-core/cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py index 1c775546229..991faca26d1 100644 --- a/cirq-core/cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py +++ b/cirq-core/cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py @@ -19,6 +19,7 @@ import numpy as np from cirq import ops +from cirq._doc import document from cirq.transformers.gauge_compiling.gauge_compiling import ( ConstantGauge, Gauge, @@ -95,3 +96,10 @@ def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge: SqrtISWAPGaugeTransformer = GaugeTransformer( target=ops.SQRT_ISWAP, gauge_selector=SqrtISWAPGaugeSelector ) +document( + SqrtISWAPGaugeTransformer, + r"""A GaugeTransformer that gauges SQRT_ISWAP gates. + + Usage: `SqrtISWAPGaugeTransformer(circuit)` will return a new circuit with all SQRT_ISWAP gates gauged by either the RZRotation gauge or the XYRotation gauge. + """, +)