Skip to main content
Google Quantum AI
Software Discover
  • What is quantum computing?
  • Educational resources
Our Work
  • Roadmap
  • Quantum Computer
  • Research Publications
  • Open Source Tools
  • Cirq Documentation
About
  • Team
  • Lab
Careers
Sign in
  • Cirq
Overview Start Build Simulate Transform Hardware Noise Experiments Contribute Reference
Google Quantum AI
  • Software
    • Overview
    • Start
    • Build
    • Simulate
    • Transform
    • Hardware
    • Noise
    • Experiments
    • Contribute
    • Reference
  • Discover
    • More
  • Our Work
    • More
  • About
    • More
  • Careers
  • cirq
  • All symbols
  • cirq
    • Overview
    • ABCMetaImplementAnyOneOf
    • AbstractCircuit
    • AbstractInitialMapper
    • Alignment
    • AmplitudeDampingChannel
    • AnyIntegerPowerGateFamily
    • AnyUnitaryGateFamily
    • ApplyChannelArgs
    • ApplyMixtureArgs
    • ApplyUnitaryArgs
    • ArithmeticGate
    • AsymmetricDepolarizingChannel
    • AxisAngleDecomposition
    • BaseDensePauliString
    • BitFlipChannel
    • BitMaskKeyCondition
    • BooleanHamiltonianGate
    • CCNOT
    • CCNotPowGate
    • CCZ
    • CCZPowGate
    • CIRCUIT_LIKE
    • CNOT
    • CNotPowGate
    • CSWAP
    • CSwapGate
    • CXSWAP
    • CZ
    • CZPowGate
    • CZSWAP
    • CZTargetGateset
    • Circuit
    • CircuitDiagramInfo
    • CircuitDiagramInfoArgs
    • CircuitOperation
    • CircuitSampleJob
    • ClassicalDataDictionaryStore
    • ClassicalDataStore
    • ClassicalDataStoreReader
    • ClassicalStateSimulator
    • ClassicallyControlledOperation
    • CliffordGate
    • CliffordSimulator
    • CliffordSimulatorStepResult
    • CliffordState
    • CliffordTableau
    • CliffordTableauSimulationState
    • CliffordTrialResult
    • Collector
    • CompilationTargetGateset
    • Concat
    • Condition
    • ConstantQubitNoiseModel
    • ControlledGate
    • ControlledOperation
    • DURATION_LIKE
    • DecompositionContext
    • DensePauliString
    • DensityMatrixSimulationState
    • DensityMatrixSimulator
    • DensityMatrixStepResult
    • DensityMatrixTrialResult
    • DepolarizingChannel
    • Device
    • DeviceMetadata
    • DiagonalGate
    • Duration
    • EigenGate
    • ExpressionMap
    • FSimGate
    • FrozenCircuit
    • Gate
    • GateFamily
    • GateOperation
    • Gateset
    • GeneralizedAmplitudeDampingChannel
    • GlobalPhaseGate
    • GreedyQubitManager
    • GridDeviceMetadata
    • GridQid
    • GridQubit
    • H
    • HPowGate
    • HardCodedInitialMapper
    • HasJSONNamespace
    • Heatmap
    • I
    • ISWAP
    • ISWAP_INV
    • ISwapPowGate
    • IdentityGate
    • InsertStrategy
    • InterchangeableQubitsGate
    • JsonResolver
    • KET_IMAG
    • KET_MINUS
    • KET_MINUS_IMAG
    • KET_ONE
    • KET_PLUS
    • KET_ZERO
    • KakDecomposition
    • KeyCondition
    • KrausChannel
    • LabelEntity
    • LineInitialMapper
    • LineQid
    • LineQubit
    • LineTopology
    • LinearCombinationOfGates
    • LinearCombinationOfOperations
    • LinearDict
    • Linspace
    • ListSweep
    • M
    • MSGate
    • MappingManager
    • MatrixGate
    • MeasurementGate
    • MeasurementKey
    • MeasurementType
    • MixedUnitaryChannel
    • Moment
    • MutableDensePauliString
    • MutablePauliString
    • NOISE_MODEL_LIKE
    • NamedQid
    • NamedQubit
    • NamedTopology
    • NoiseModel
    • NoiseModelFromNoiseProperties
    • NoiseProperties
    • OP_TREE
    • OpIdentifier
    • Operation
    • PAULI_GATE_LIKE
    • PAULI_STRING_LIKE
    • ParallelGate
    • ParallelGateFamily
    • ParamDictType
    • ParamMappingType
    • ParamResolver
    • ParamResolverOrSimilarType
    • Pauli
    • PauliInteractionGate
    • PauliMeasurementGate
    • PauliString
    • PauliStringGateOperation
    • PauliStringPhasor
    • PauliStringPhasorGate
    • PauliSum
    • PauliSumCollector
    • PauliSumExponential
    • PauliSumLike
    • PeriodicValue
    • PhaseDampingChannel
    • PhaseFlipChannel
    • PhaseGradientGate
    • PhasedFSimGate
    • PhasedISwapPowGate
    • PhasedXPowGate
    • PhasedXZGate
    • PointOptimizationSummary
    • PointOptimizer
    • Points
    • Product
    • ProductOfSums
    • ProductState
    • ProjectorString
    • ProjectorSum
    • QUANTUM_STATE_LIKE
    • QasmArgs
    • QasmOutput
    • Qid
    • QuantumFourierTransformGate
    • QuantumState
    • QuantumStateRepresentation
    • QubitManager
    • QubitOrder
    • QubitOrderOrList
    • QubitPermutationGate
    • R
    • RandomGateChannel
    • ResetChannel
    • Result
    • ResultDict
    • RouteCQC
    • RoutingSwapTag
    • Rx
    • Ry
    • Rz
    • S
    • SQRT_ISWAP
    • SQRT_ISWAP_INV
    • STATE_VECTOR_LIKE
    • SWAP
    • Sampler
    • SerializableByKey
    • SimpleQubitManager
    • SimulatesAmplitudes
    • SimulatesExpectationValues
    • SimulatesFinalState
    • SimulatesIntermediateState
    • SimulatesIntermediateStateVector
    • SimulatesSamples
    • SimulationProductState
    • SimulationState
    • SimulationStateBase
    • SimulationTrialResult
    • SimulationTrialResultBase
    • Simulator
    • SimulatorBase
    • SingleQubitCliffordGate
    • SingleQubitPauliStringGateOperation
    • SparseSimulatorStep
    • SqrtIswapTargetGateset
    • StabilizerChFormSimulationState
    • StabilizerSampler
    • StabilizerSimulationState
    • StabilizerState
    • StabilizerStateChForm
    • StatePreparationChannel
    • StateVectorMixin
    • StateVectorSimulationState
    • StateVectorStepResult
    • StateVectorTrialResult
    • StepResult
    • StepResultBase
    • SumOfProducts
    • SuperconductingQubitsNoiseProperties
    • SupportsActOn
    • SupportsActOnQubits
    • SupportsApplyChannel
    • SupportsApplyMixture
    • SupportsApproximateEquality
    • SupportsCircuitDiagramInfo
    • SupportsCommutes
    • SupportsConsistentApplyUnitary
    • SupportsControlKey
    • SupportsDecompose
    • SupportsDecomposeWithQubits
    • SupportsEqualUpToGlobalPhase
    • SupportsExplicitHasUnitary
    • SupportsExplicitNumQubits
    • SupportsExplicitQidShape
    • SupportsJSON
    • SupportsKraus
    • SupportsMeasurementKey
    • SupportsMixture
    • SupportsParameterization
    • SupportsPauliExpansion
    • SupportsPhase
    • SupportsQasm
    • SupportsQasmWithArgs
    • SupportsQasmWithArgsAndQubits
    • SupportsTraceDistanceBound
    • SupportsUnitary
    • SwapPowGate
    • Sweep
    • Sweepable
    • SympyCondition
    • T
    • TRANSFORMER
    • TaggedOperation
    • TensoredConfusionMatrices
    • TextDiagramDrawer
    • ThreeQubitDiagonalGate
    • TiltedSquareLattice
    • Timestamp
    • TransformerContext
    • TransformerLogger
    • TwoQubitCompilationTargetGateset
    • TwoQubitDiagonalGate
    • TwoQubitGateTabulation
    • TwoQubitGateTabulationResult
    • TwoQubitInteractionHeatmap
    • UniformSuperpositionGate
    • VirtualTag
    • WaitGate
    • X
    • XPowGate
    • XX
    • XXPowGate
    • Y
    • YPowGate
    • YY
    • YYPowGate
    • Z
    • ZPowGate
    • ZZ
    • ZZPowGate
    • ZerosSampler
    • Zip
    • ZipLongest
    • act_on
    • add_dynamical_decoupling
    • align_left
    • align_right
    • all_near_zero
    • all_near_zero_mod
    • allclose_up_to_global_phase
    • alternative
    • amplitude_damp
    • apply_channel
    • apply_matrix_to_slices
    • apply_mixture
    • apply_unitaries
    • apply_unitary
    • approx_eq
    • asymmetric_depolarize
    • axis_angle
    • bidiagonalize_real_matrix_pair_with_symmetric_products
    • bidiagonalize_unitary_with_special_orthogonals
    • big_endian_bits_to_int
    • big_endian_digits_to_int
    • big_endian_int_to_bits
    • big_endian_int_to_digits
    • bit_flip
    • bloch_vector_from_state_vector
    • block_diag
    • canonicalize_half_turns
    • choi_to_kraus
    • choi_to_superoperator
    • chosen_angle_to_canonical_half_turns
    • chosen_angle_to_half_turns
    • circuit_diagram_info
    • cirq_type_from_json
    • commutes
    • compute_cphase_exponents_for_fsim_decomposition
    • control_keys
    • cphase
    • create_transformer_with_kwargs
    • dataclass_json_dict
    • decompose
    • decompose_clifford_tableau_to_operations
    • decompose_cphase_into_two_fsim
    • decompose_multi_controlled_rotation
    • decompose_multi_controlled_x
    • decompose_once
    • decompose_once_with_qubits
    • decompose_two_qubit_interaction_into_four_fsim_gates
    • deconstruct_single_qubit_matrix_into_angles
    • defer_measurements
    • definitely_commutes
    • density_matrix
    • density_matrix_from_state_vector
    • density_matrix_kronecker_product
    • dephase_measurements
    • depolarize
    • diagonalize_real_symmetric_and_sorted_diagonal_matrices
    • diagonalize_real_symmetric_matrix
    • dict_to_product_sweep
    • dict_to_zip_sweep
    • dirac_notation
    • dot
    • draw_gridlike
    • draw_placements
    • drop_empty_moments
    • drop_negligible_operations
    • drop_terminal_measurements
    • eject_phased_paulis
    • eject_z
    • entanglement_fidelity
    • equal_up_to_global_phase
    • estimate_parallel_single_qubit_readout_errors
    • estimate_single_qubit_readout_errors
    • expand_composite
    • expand_matrix_in_orthogonal_basis
    • eye_tensor
    • fidelity
    • final_density_matrix
    • final_state_vector
    • flatten
    • flatten_op_tree
    • flatten_to_ops
    • flatten_to_ops_or_moments
    • flatten_with_params
    • flatten_with_sweep
    • freeze_op_tree
    • generalized_amplitude_damp
    • get_placements
    • get_state_histogram
    • givens
    • global_phase_operation
    • has_kraus
    • has_mixture
    • has_stabilizer_effect
    • has_unitary
    • hilbert_schmidt_inner_product
    • hog_score_xeb_fidelity_from_probabilities
    • identity_each
    • index_tags
    • integrated_histogram
    • inverse
    • is_cptp
    • is_diagonal
    • is_hermitian
    • is_measurement
    • is_native_neutral_atom_gate
    • is_native_neutral_atom_op
    • is_negligible_turn
    • is_normal
    • is_orthogonal
    • is_parameterized
    • is_special_orthogonal
    • is_special_unitary
    • is_unitary
    • is_valid_placement
    • json_cirq_type
    • json_namespace
    • kak_canonicalize_vector
    • kak_decomposition
    • kak_vector
    • kraus
    • kraus_to_choi
    • kraus_to_superoperator
    • kron
    • kron_bases
    • kron_factor_4x4_to_2x2s
    • kron_with_controls
    • linear_xeb_fidelity
    • linear_xeb_fidelity_from_probabilities
    • log_xeb_fidelity
    • log_xeb_fidelity_from_probabilities
    • map_clean_and_borrowable_qubits
    • map_eigenvalues
    • map_moments
    • map_operations
    • map_operations_and_unroll
    • match_global_phase
    • matrix_commutes
    • matrix_from_basis_coefficients
    • measure_confusion_matrix
    • measure_density_matrix
    • measure_each
    • measure_paulistring_terms
    • measure_single_paulistring
    • measure_state_vector
    • measurement_key_name
    • measurement_key_names
    • measurement_key_obj
    • measurement_key_objs
    • measurement_keys_touched
    • merge_k_qubit_unitaries
    • merge_k_qubit_unitaries_to_circuit_op
    • merge_moments
    • merge_operations
    • merge_operations_to_circuit_op
    • merge_single_qubit_gates_to_phased_x_and_z
    • merge_single_qubit_gates_to_phxz
    • merge_single_qubit_gates_to_phxz_symbolized
    • merge_single_qubit_moments_to_phxz
    • mixture
    • ms
    • mul
    • num_cnots_required
    • num_qubits
    • obj_to_dict_helper
    • one_hot
    • operation_to_choi
    • operation_to_superoperator
    • optimize_for_target_gateset
    • parallel_gate_op
    • parameter_names
    • parameter_symbols
    • parameterized_2q_op_to_sqrt_iswap_operations
    • partial_trace
    • partial_trace_of_state_vector_as_mixture
    • pauli_expansion
    • phase_by
    • phase_damp
    • phase_flip
    • plot_density_matrix
    • plot_state_histogram
    • pow
    • pow_pauli_combination
    • prepare_two_qubit_state_using_cz
    • prepare_two_qubit_state_using_iswap
    • prepare_two_qubit_state_using_sqrt_iswap
    • q
    • qasm
    • qft
    • qid_shape
    • quantum_shannon_decomposition
    • quantum_state
    • quirk_json_to_circuit
    • quirk_url_to_circuit
    • read_json
    • read_json_gzip
    • reflection_matrix_pow
    • remove_tags
    • reset_each
    • resolve_parameters
    • resolve_parameters_once
    • riswap
    • routed_circuit_with_mapping
    • rx
    • ry
    • rz
    • sample
    • sample_density_matrix
    • sample_state_vector
    • sample_sweep
    • scatter_plot_normalized_kak_interaction_coefficients
    • single_qubit_matrix_to_gates
    • single_qubit_matrix_to_pauli_rotations
    • single_qubit_matrix_to_phased_x_z
    • single_qubit_matrix_to_phxz
    • single_qubit_op_to_framed_phase_form
    • slice_for_qubits_equal_to
    • so4_to_magic_su2s
    • state_vector_kronecker_product
    • state_vector_to_probabilities
    • stratified_circuit
    • sub_state_vector
    • superoperator_to_choi
    • superoperator_to_kraus
    • symbolize_single_qubit_gates_by_indexed_tags
    • synchronize_terminal_measurements
    • targeted_conjugate_about
    • targeted_left_multiply
    • three_qubit_matrix_to_operations
    • to_json
    • to_json_gzip
    • to_resolvers
    • to_special
    • to_sweep
    • to_sweeps
    • to_valid_density_matrix
    • to_valid_state_vector
    • toggle_tags
    • trace_distance_bound
    • trace_distance_from_angle_list
    • transform_op_tree
    • transformer
    • two_qubit_gate_product_tabulation
    • two_qubit_matrix_to_cz_isometry
    • two_qubit_matrix_to_cz_operations
    • two_qubit_matrix_to_diagonal_and_cz_operations
    • two_qubit_matrix_to_ion_operations
    • two_qubit_matrix_to_sqrt_iswap_operations
    • unitary
    • unitary_eig
    • unroll_circuit_op
    • unroll_circuit_op_greedy_earliest
    • unroll_circuit_op_greedy_frontier
    • validate_density_matrix
    • validate_indices
    • validate_mixture
    • validate_normalized_state_vector
    • validate_probability
    • validate_qid_shape
    • value_equality
    • von_neumann_entropy
    • wait
    • with_debug
    • with_key_path
    • with_key_path_prefix
    • with_measurement_key_mapping
    • with_rescoped_keys
    • xeb_fidelity
  • cirq.contrib
    • Overview
    • CircuitDag
    • Unique
    • circuit_to_latex_using_qcircuit
    • acquaintance
      • Overview
      • AcquaintanceOperation
      • AcquaintanceOpportunityGate
      • BipartiteGraphType
      • BipartiteSwapNetworkGate
      • CircularShiftGate
      • DECOMPOSE_PERMUTATION_GATES
      • EXPAND_PERMUTATION_GATES
      • GreedyExecutionStrategy
      • LinearPermutationGate
      • PermutationGate
      • ShiftSwapNetworkGate
      • StrategyExecutorTransformer
      • SwapNetworkGate
      • SwapPermutationGate
      • acquaint
      • complete_acquaintance_strategy
      • cubic_acquaintance_strategy
      • display_mapping
      • expose_acquaintance_gates
      • get_acquaintance_size
      • get_logical_acquaintance_opportunities
      • get_logical_operations
      • is_topologically_sorted
      • quartic_paired_acquaintance_strategy
      • random_topological_sort
      • rectify_acquaintance_strategy
      • remove_redundant_acquaintance_opportunities
      • replace_acquaintance_with_swap_network
      • return_to_initial_mapping
      • update_mapping
      • uses_consistent_swap_gate
      • bipartite
        • Overview
      • devices
        • Overview
        • AcquaintanceDevice
      • executor
        • Overview
        • ExecutionStrategy
        • LogicalGates
        • LogicalIndexSequence
        • LogicalMapping
      • gates
        • Overview
        • Layers
        • acquaint_and_shift
        • acquaint_insides
        • new_layers
        • operations_to_part_lens
      • inspection_utils
        • Overview
        • LogicalAnnotator
        • get_acquaintance_dag
      • mutation_utils
        • Overview
        • ExposeAcquaintanceGates
      • optimizers
        • Overview
      • permutation
        • Overview
        • DecomposePermutationGates
        • MappingDisplayGate
      • shift
        • Overview
      • shift_swap_network
        • Overview
      • strategies
        • Overview
        • complete
          • Overview
        • cubic
          • Overview
          • skip_and_wrap_around
        • quartic_paired
          • Overview
          • qubit_pairs_to_qubit_order
      • testing
        • Overview
        • assert_permutation_decomposition_equivalence
      • topological_sort
        • Overview
    • circuitdag
      • Overview
      • circuit_dag
        • Overview
    • graph_device
      • Overview
      • FixedDurationUndirectedGraphDeviceEdge
      • UndirectedGraphDevice
      • UndirectedHypergraph
      • is_crosstalk_graph
      • is_undirected_device_graph
      • uniform_undirected_graph_device
      • uniform_undirected_linear_device
      • graph_device
        • Overview
        • UndirectedGraphDeviceEdge
        • raise_crosstalk_error
      • hypergraph
        • Overview
        • AdjacencyList
      • uniform_graph_device
        • Overview
    • json
      • Overview
      • ObjectFactory
      • contrib_class_resolver
    • qcircuit
      • Overview
      • escape_text_for_latex
      • get_multigate_parameters
      • get_qcircuit_diagram_info
      • qcircuit_diagram
        • Overview
        • qcircuit_qubit_namer
      • qcircuit_diagram_info
        • Overview
        • convert_text_diagram_info_to_qcircuit_diagram_info
        • fallback_qcircuit_diagram_info
        • hardcoded_qcircuit_diagram_info
        • multigate_qcircuit_diagram_info
    • quirk
      • Overview
      • circuit_to_quirk_url
      • export_to_quirk
        • Overview
      • linearize_circuit
        • Overview
        • QubitMapper
        • linearize_circuit_qubits
      • quirk_gate
        • Overview
        • QuirkOp
        • angle_to_exponent_key
        • ccx_to_quirk_op
        • ccz_to_quirk_op
        • cnot_to_quirk_op
        • controlled_unwrap
        • cswap_to_quirk_op
        • cz_to_quirk_op
        • h_to_quirk_op
        • known_quirk_op_for_operation
        • same_half_turns
        • single_qubit_matrix_gate
        • swap_to_quirk_op
        • x_to_quirk_op
        • xyz_to_quirk_op
        • y_to_quirk_op
        • z_to_quirk_op
  • cirq.testing
    • Overview
    • DoesNotSupportSerializationGate
    • EqualsTester
    • FakePrinter
    • NoIdentifierQubit
    • OrderTester
    • PhaseUsingCleanAncilla
    • PhaseUsingDirtyAncilla
    • RoutingTestingDevice
    • SingleQubitGate
    • ThreeQubitGate
    • TwoQubitGate
    • ValidatingTestDevice
    • assert_all_implemented_act_on_effects_match_unitary
    • assert_allclose_up_to_global_phase
    • assert_circuits_have_same_unitary_given_final_permutation
    • assert_circuits_with_terminal_measurements_are_equivalent
    • assert_commutes_magic_method_consistent_with_unitaries
    • assert_consistent_channel
    • assert_consistent_mixture
    • assert_consistent_resolve_parameters
    • assert_controlled_and_controlled_by_identical
    • assert_controlled_unitary_consistent
    • assert_decompose_ends_at_default_gateset
    • assert_decompose_is_consistent_with_unitary
    • assert_deprecated
    • assert_eigengate_implements_consistent_protocols
    • assert_equivalent_computational_basis_map
    • assert_equivalent_op_tree
    • assert_equivalent_repr
    • assert_has_consistent_apply_channel
    • assert_has_consistent_apply_unitary
    • assert_has_consistent_apply_unitary_for_various_exponents
    • assert_has_consistent_qid_shape
    • assert_has_consistent_trace_distance_bound
    • assert_has_diagram
    • assert_implements_consistent_protocols
    • assert_json_roundtrip_works
    • assert_logs
    • assert_pauli_expansion_is_consistent_with_unitary
    • assert_phase_by_is_consistent_with_unitary
    • assert_qasm_is_consistent_with_unitary
    • assert_repr_pretty
    • assert_repr_pretty_contains
    • assert_same_circuits
    • assert_specifies_has_unitary_if_unitary
    • assert_unitary_is_consistent
    • construct_grid_device
    • construct_ring_device
    • highlight_text_differences
    • nonoptimal_toffoli_circuit
    • random_circuit