Module: cirq.optimizers

Circuit transformation utilities.

Modules

align_left module: An optimization pass that aligns gates to the left of the circuit.

align_right module: An optimization pass that aligns gates to the right of the circuit.

controlled_gate_decomposition module

convert_to_cz_and_single_gates module

cphase_to_fsim module

decompositions module: Utility methods related to optimizing quantum circuits.

drop_empty_moments module: An optimization pass that removes empty moments from a circuit.

drop_negligible module: An optimization pass that removes operations with tiny effects.

eject_phased_paulis module: Pushes 180 degree rotations around axes in the XY plane later in the circuit.

eject_z module: An optimization pass that pushes Z gates later and later in the circuit.

expand_composite module: An optimizer that expands composite operations via cirq.decompose.

merge_interactions module: An optimization pass that combines adjacent single-qubit rotations.

merge_single_qubit_gates module: An optimization pass that combines adjacent single-qubit rotations.

stratify module

synchronize_terminal_measurements module: An optimization pass to put as many measurements possible at the end.

three_qubit_decomposition module

two_qubit_decompositions module: Utility methods related to optimizing quantum circuits.

two_qubit_to_fsim module

Classes

class AlignLeft: Aligns gates to the left of the circuit.

class AlignRight: Aligns gates to the right of the circuit.

class ConvertToCzAndSingleGates: Attempts to convert strange multi-qubit gates into CZ and single qubit

class DropEmptyMoments: Removes empty moments from a circuit.

class DropNegligible: An optimization pass that removes operations with tiny effects.

class EjectPhasedPaulis: Pushes X, Y, and PhasedX gates towards the end of the circuit.

class EjectZ: Pushes Z gates towards the end of the circuit.

class ExpandComposite: An optimizer that expands composite operations via cirq.decompose.

class MergeInteractions: Combines series of adjacent one and two-qubit gates operating on a pair

class MergeSingleQubitGates: Optimizes runs of adjacent unitary 1-qubit operations.

class SynchronizeTerminalMeasurements: Move measurements to the end of the circuit.

Functions

compute_cphase_exponents_for_fsim_decomposition(...): Returns intervals of CZPowGate exponents valid for FSim decomposition.

decompose_cphase_into_two_fsim(...): Decomposes CZPowGate into two FSimGates.

decompose_multi_controlled_rotation(...): Implements action of multi-controlled unitary gate.

decompose_multi_controlled_x(...): Implements action of multi-controlled Pauli X gate.

decompose_two_qubit_interaction_into_four_fsim_gates(...): Decomposes operations into an FSimGate near theta=pi/2, phi=0.

is_negligible_turn(...)

merge_single_qubit_gates_into_phased_x_z(...): Canonicalizes runs of single-qubit rotations in a circuit.

merge_single_qubit_gates_into_phxz(...): Canonicalizes runs of single-qubit rotations in a circuit.

single_qubit_matrix_to_gates(...): Implements a single-qubit operation with few gates.

single_qubit_matrix_to_pauli_rotations(...): Implements a single-qubit operation with few rotations.

single_qubit_matrix_to_phased_x_z(...): Implements a single-qubit operation with a PhasedX and Z gate.

single_qubit_matrix_to_phxz(...): Implements a single-qubit operation with a PhasedXZ gate.

single_qubit_op_to_framed_phase_form(...): Decomposes a 2x2 unitary M into U^-1 * diag(1, r) * U * diag(g, g).

stratified_circuit(...): Repacks avoiding simultaneous operations with different classes.

three_qubit_matrix_to_operations(...): Returns operations for a 3 qubit unitary.

two_qubit_matrix_to_diagonal_and_operations(...): Decomposes a 2-qubit unitary to a diagonal and the remaining operations.

two_qubit_matrix_to_operations(...): Decomposes a two-qubit operation into Z/XY/CZ gates.