qiskit 1.3.0__cp39-abi3-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qiskit/VERSION.txt +1 -0
- qiskit/__init__.py +146 -0
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/_numpy_compat.py +73 -0
- qiskit/assembler/__init__.py +42 -0
- qiskit/assembler/assemble_circuits.py +451 -0
- qiskit/assembler/assemble_schedules.py +367 -0
- qiskit/assembler/disassemble.py +310 -0
- qiskit/assembler/run_config.py +77 -0
- qiskit/circuit/__init__.py +1313 -0
- qiskit/circuit/_classical_resource_map.py +148 -0
- qiskit/circuit/_standard_gates_commutations.py +3849 -0
- qiskit/circuit/_utils.py +167 -0
- qiskit/circuit/add_control.py +274 -0
- qiskit/circuit/annotated_operation.py +279 -0
- qiskit/circuit/barrier.py +50 -0
- qiskit/circuit/bit.py +94 -0
- qiskit/circuit/classical/__init__.py +41 -0
- qiskit/circuit/classical/expr/__init__.py +238 -0
- qiskit/circuit/classical/expr/constructors.py +556 -0
- qiskit/circuit/classical/expr/expr.py +397 -0
- qiskit/circuit/classical/expr/visitors.py +300 -0
- qiskit/circuit/classical/types/__init__.py +109 -0
- qiskit/circuit/classical/types/ordering.py +222 -0
- qiskit/circuit/classical/types/types.py +117 -0
- qiskit/circuit/classicalfunction/__init__.py +140 -0
- qiskit/circuit/classicalfunction/boolean_expression.py +129 -0
- qiskit/circuit/classicalfunction/classical_element.py +54 -0
- qiskit/circuit/classicalfunction/classical_function_visitor.py +155 -0
- qiskit/circuit/classicalfunction/classicalfunction.py +173 -0
- qiskit/circuit/classicalfunction/exceptions.py +35 -0
- qiskit/circuit/classicalfunction/types.py +18 -0
- qiskit/circuit/classicalfunction/utils.py +91 -0
- qiskit/circuit/classicalregister.py +57 -0
- qiskit/circuit/commutation_checker.py +106 -0
- qiskit/circuit/commutation_library.py +20 -0
- qiskit/circuit/controlflow/__init__.py +28 -0
- qiskit/circuit/controlflow/_builder_utils.py +207 -0
- qiskit/circuit/controlflow/break_loop.py +56 -0
- qiskit/circuit/controlflow/builder.py +691 -0
- qiskit/circuit/controlflow/continue_loop.py +58 -0
- qiskit/circuit/controlflow/control_flow.py +84 -0
- qiskit/circuit/controlflow/for_loop.py +217 -0
- qiskit/circuit/controlflow/if_else.py +511 -0
- qiskit/circuit/controlflow/switch_case.py +417 -0
- qiskit/circuit/controlflow/while_loop.py +171 -0
- qiskit/circuit/controlledgate.py +274 -0
- qiskit/circuit/delay.py +123 -0
- qiskit/circuit/duration.py +95 -0
- qiskit/circuit/equivalence.py +94 -0
- qiskit/circuit/equivalence_library.py +18 -0
- qiskit/circuit/exceptions.py +19 -0
- qiskit/circuit/gate.py +263 -0
- qiskit/circuit/instruction.py +697 -0
- qiskit/circuit/instructionset.py +179 -0
- qiskit/circuit/library/__init__.py +668 -0
- qiskit/circuit/library/arithmetic/__init__.py +34 -0
- qiskit/circuit/library/arithmetic/adders/__init__.py +18 -0
- qiskit/circuit/library/arithmetic/adders/adder.py +210 -0
- qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py +123 -0
- qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py +129 -0
- qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py +95 -0
- qiskit/circuit/library/arithmetic/exact_reciprocal.py +88 -0
- qiskit/circuit/library/arithmetic/functional_pauli_rotations.py +114 -0
- qiskit/circuit/library/arithmetic/integer_comparator.py +243 -0
- qiskit/circuit/library/arithmetic/linear_amplitude_function.py +196 -0
- qiskit/circuit/library/arithmetic/linear_pauli_rotations.py +189 -0
- qiskit/circuit/library/arithmetic/multipliers/__init__.py +17 -0
- qiskit/circuit/library/arithmetic/multipliers/hrs_cumulative_multiplier.py +145 -0
- qiskit/circuit/library/arithmetic/multipliers/multiplier.py +192 -0
- qiskit/circuit/library/arithmetic/multipliers/rg_qft_multiplier.py +108 -0
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +353 -0
- qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py +277 -0
- qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py +317 -0
- qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py +335 -0
- qiskit/circuit/library/arithmetic/quadratic_form.py +198 -0
- qiskit/circuit/library/arithmetic/weighted_adder.py +337 -0
- qiskit/circuit/library/basis_change/__init__.py +15 -0
- qiskit/circuit/library/basis_change/qft.py +313 -0
- qiskit/circuit/library/blueprintcircuit.py +280 -0
- qiskit/circuit/library/boolean_logic/__init__.py +18 -0
- qiskit/circuit/library/boolean_logic/inner_product.py +155 -0
- qiskit/circuit/library/boolean_logic/quantum_and.py +200 -0
- qiskit/circuit/library/boolean_logic/quantum_or.py +202 -0
- qiskit/circuit/library/boolean_logic/quantum_xor.py +165 -0
- qiskit/circuit/library/data_preparation/__init__.py +57 -0
- qiskit/circuit/library/data_preparation/_z_feature_map.py +115 -0
- qiskit/circuit/library/data_preparation/_zz_feature_map.py +150 -0
- qiskit/circuit/library/data_preparation/initializer.py +107 -0
- qiskit/circuit/library/data_preparation/pauli_feature_map.py +656 -0
- qiskit/circuit/library/data_preparation/state_preparation.py +336 -0
- qiskit/circuit/library/fourier_checking.py +158 -0
- qiskit/circuit/library/generalized_gates/__init__.py +30 -0
- qiskit/circuit/library/generalized_gates/diagonal.py +159 -0
- qiskit/circuit/library/generalized_gates/gms.py +174 -0
- qiskit/circuit/library/generalized_gates/gr.py +215 -0
- qiskit/circuit/library/generalized_gates/isometry.py +370 -0
- qiskit/circuit/library/generalized_gates/linear_function.py +318 -0
- qiskit/circuit/library/generalized_gates/mcg_up_to_diagonal.py +143 -0
- qiskit/circuit/library/generalized_gates/mcmt.py +316 -0
- qiskit/circuit/library/generalized_gates/pauli.py +85 -0
- qiskit/circuit/library/generalized_gates/permutation.py +194 -0
- qiskit/circuit/library/generalized_gates/rv.py +96 -0
- qiskit/circuit/library/generalized_gates/uc.py +213 -0
- qiskit/circuit/library/generalized_gates/uc_pauli_rot.py +164 -0
- qiskit/circuit/library/generalized_gates/ucrx.py +32 -0
- qiskit/circuit/library/generalized_gates/ucry.py +32 -0
- qiskit/circuit/library/generalized_gates/ucrz.py +32 -0
- qiskit/circuit/library/generalized_gates/unitary.py +215 -0
- qiskit/circuit/library/graph_state.py +169 -0
- qiskit/circuit/library/grover_operator.py +579 -0
- qiskit/circuit/library/hamiltonian_gate.py +142 -0
- qiskit/circuit/library/hidden_linear_function.py +161 -0
- qiskit/circuit/library/iqp.py +175 -0
- qiskit/circuit/library/n_local/__init__.py +45 -0
- qiskit/circuit/library/n_local/efficient_su2.py +277 -0
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +515 -0
- qiskit/circuit/library/n_local/excitation_preserving.py +297 -0
- qiskit/circuit/library/n_local/n_local.py +1472 -0
- qiskit/circuit/library/n_local/pauli_two_design.py +243 -0
- qiskit/circuit/library/n_local/qaoa_ansatz.py +366 -0
- qiskit/circuit/library/n_local/real_amplitudes.py +306 -0
- qiskit/circuit/library/n_local/two_local.py +289 -0
- qiskit/circuit/library/overlap.py +182 -0
- qiskit/circuit/library/pauli_evolution.py +186 -0
- qiskit/circuit/library/phase_estimation.py +175 -0
- qiskit/circuit/library/phase_oracle.py +153 -0
- qiskit/circuit/library/quantum_volume.py +167 -0
- qiskit/circuit/library/standard_gates/__init__.py +142 -0
- qiskit/circuit/library/standard_gates/dcx.py +78 -0
- qiskit/circuit/library/standard_gates/ecr.py +130 -0
- qiskit/circuit/library/standard_gates/equivalence_library.py +1800 -0
- qiskit/circuit/library/standard_gates/global_phase.py +85 -0
- qiskit/circuit/library/standard_gates/h.py +258 -0
- qiskit/circuit/library/standard_gates/i.py +76 -0
- qiskit/circuit/library/standard_gates/iswap.py +134 -0
- qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py +405 -0
- qiskit/circuit/library/standard_gates/p.py +441 -0
- qiskit/circuit/library/standard_gates/r.py +117 -0
- qiskit/circuit/library/standard_gates/rx.py +303 -0
- qiskit/circuit/library/standard_gates/rxx.py +183 -0
- qiskit/circuit/library/standard_gates/ry.py +298 -0
- qiskit/circuit/library/standard_gates/ryy.py +183 -0
- qiskit/circuit/library/standard_gates/rz.py +319 -0
- qiskit/circuit/library/standard_gates/rzx.py +229 -0
- qiskit/circuit/library/standard_gates/rzz.py +196 -0
- qiskit/circuit/library/standard_gates/s.py +428 -0
- qiskit/circuit/library/standard_gates/swap.py +288 -0
- qiskit/circuit/library/standard_gates/sx.py +315 -0
- qiskit/circuit/library/standard_gates/t.py +179 -0
- qiskit/circuit/library/standard_gates/u.py +403 -0
- qiskit/circuit/library/standard_gates/u1.py +501 -0
- qiskit/circuit/library/standard_gates/u2.py +149 -0
- qiskit/circuit/library/standard_gates/u3.py +436 -0
- qiskit/circuit/library/standard_gates/x.py +1529 -0
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +235 -0
- qiskit/circuit/library/standard_gates/xx_plus_yy.py +239 -0
- qiskit/circuit/library/standard_gates/y.py +262 -0
- qiskit/circuit/library/standard_gates/z.py +348 -0
- qiskit/circuit/library/templates/__init__.py +92 -0
- qiskit/circuit/library/templates/clifford/__init__.py +33 -0
- qiskit/circuit/library/templates/clifford/clifford_2_1.py +34 -0
- qiskit/circuit/library/templates/clifford/clifford_2_2.py +35 -0
- qiskit/circuit/library/templates/clifford/clifford_2_3.py +34 -0
- qiskit/circuit/library/templates/clifford/clifford_2_4.py +34 -0
- qiskit/circuit/library/templates/clifford/clifford_3_1.py +35 -0
- qiskit/circuit/library/templates/clifford/clifford_4_1.py +38 -0
- qiskit/circuit/library/templates/clifford/clifford_4_2.py +37 -0
- qiskit/circuit/library/templates/clifford/clifford_4_3.py +38 -0
- qiskit/circuit/library/templates/clifford/clifford_4_4.py +37 -0
- qiskit/circuit/library/templates/clifford/clifford_5_1.py +40 -0
- qiskit/circuit/library/templates/clifford/clifford_6_1.py +40 -0
- qiskit/circuit/library/templates/clifford/clifford_6_2.py +40 -0
- qiskit/circuit/library/templates/clifford/clifford_6_3.py +40 -0
- qiskit/circuit/library/templates/clifford/clifford_6_4.py +38 -0
- qiskit/circuit/library/templates/clifford/clifford_6_5.py +40 -0
- qiskit/circuit/library/templates/clifford/clifford_8_1.py +42 -0
- qiskit/circuit/library/templates/clifford/clifford_8_2.py +42 -0
- qiskit/circuit/library/templates/clifford/clifford_8_3.py +41 -0
- qiskit/circuit/library/templates/nct/__init__.py +67 -0
- qiskit/circuit/library/templates/nct/template_nct_2a_1.py +34 -0
- qiskit/circuit/library/templates/nct/template_nct_2a_2.py +35 -0
- qiskit/circuit/library/templates/nct/template_nct_2a_3.py +37 -0
- qiskit/circuit/library/templates/nct/template_nct_4a_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_4a_2.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_4a_3.py +39 -0
- qiskit/circuit/library/templates/nct/template_nct_4b_1.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_4b_2.py +39 -0
- qiskit/circuit/library/templates/nct/template_nct_5a_1.py +40 -0
- qiskit/circuit/library/templates/nct/template_nct_5a_2.py +40 -0
- qiskit/circuit/library/templates/nct/template_nct_5a_3.py +40 -0
- qiskit/circuit/library/templates/nct/template_nct_5a_4.py +39 -0
- qiskit/circuit/library/templates/nct/template_nct_6a_1.py +40 -0
- qiskit/circuit/library/templates/nct/template_nct_6a_2.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_6a_3.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_6a_4.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_6b_1.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_6b_2.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_6c_1.py +41 -0
- qiskit/circuit/library/templates/nct/template_nct_7a_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_7b_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_7c_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_7d_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_7e_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_9a_1.py +45 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_10.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_11.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_12.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_2.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_3.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_4.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_5.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_6.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_7.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_8.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9c_9.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_1.py +43 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_10.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_2.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_3.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_4.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_5.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_6.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_7.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_8.py +44 -0
- qiskit/circuit/library/templates/nct/template_nct_9d_9.py +44 -0
- qiskit/circuit/library/templates/rzx/__init__.py +25 -0
- qiskit/circuit/library/templates/rzx/rzx_cy.py +47 -0
- qiskit/circuit/library/templates/rzx/rzx_xz.py +54 -0
- qiskit/circuit/library/templates/rzx/rzx_yz.py +45 -0
- qiskit/circuit/library/templates/rzx/rzx_zz1.py +69 -0
- qiskit/circuit/library/templates/rzx/rzx_zz2.py +59 -0
- qiskit/circuit/library/templates/rzx/rzx_zz3.py +59 -0
- qiskit/circuit/measure.py +44 -0
- qiskit/circuit/operation.py +67 -0
- qiskit/circuit/parameter.py +178 -0
- qiskit/circuit/parameterexpression.py +692 -0
- qiskit/circuit/parametertable.py +119 -0
- qiskit/circuit/parametervector.py +120 -0
- qiskit/circuit/quantumcircuit.py +6829 -0
- qiskit/circuit/quantumcircuitdata.py +136 -0
- qiskit/circuit/quantumregister.py +75 -0
- qiskit/circuit/random/__init__.py +15 -0
- qiskit/circuit/random/utils.py +358 -0
- qiskit/circuit/register.py +233 -0
- qiskit/circuit/reset.py +34 -0
- qiskit/circuit/singleton.py +606 -0
- qiskit/circuit/store.py +97 -0
- qiskit/circuit/tools/__init__.py +16 -0
- qiskit/circuit/tools/pi_check.py +190 -0
- qiskit/circuit/twirling.py +145 -0
- qiskit/compiler/__init__.py +33 -0
- qiskit/compiler/assembler.py +681 -0
- qiskit/compiler/scheduler.py +109 -0
- qiskit/compiler/sequencer.py +71 -0
- qiskit/compiler/transpiler.py +533 -0
- qiskit/converters/__init__.py +74 -0
- qiskit/converters/circuit_to_dag.py +78 -0
- qiskit/converters/circuit_to_dagdependency.py +51 -0
- qiskit/converters/circuit_to_dagdependency_v2.py +47 -0
- qiskit/converters/circuit_to_gate.py +107 -0
- qiskit/converters/circuit_to_instruction.py +155 -0
- qiskit/converters/dag_to_circuit.py +79 -0
- qiskit/converters/dag_to_dagdependency.py +55 -0
- qiskit/converters/dag_to_dagdependency_v2.py +44 -0
- qiskit/converters/dagdependency_to_circuit.py +46 -0
- qiskit/converters/dagdependency_to_dag.py +54 -0
- qiskit/dagcircuit/__init__.py +44 -0
- qiskit/dagcircuit/collect_blocks.py +391 -0
- qiskit/dagcircuit/dagcircuit.py +24 -0
- qiskit/dagcircuit/dagdependency.py +646 -0
- qiskit/dagcircuit/dagdependency_v2.py +641 -0
- qiskit/dagcircuit/dagdepnode.py +160 -0
- qiskit/dagcircuit/dagnode.py +176 -0
- qiskit/dagcircuit/exceptions.py +42 -0
- qiskit/exceptions.py +153 -0
- qiskit/passmanager/__init__.py +240 -0
- qiskit/passmanager/base_tasks.py +230 -0
- qiskit/passmanager/compilation_status.py +74 -0
- qiskit/passmanager/exceptions.py +19 -0
- qiskit/passmanager/flow_controllers.py +116 -0
- qiskit/passmanager/passmanager.py +333 -0
- qiskit/primitives/__init__.py +481 -0
- qiskit/primitives/backend_estimator.py +486 -0
- qiskit/primitives/backend_estimator_v2.py +434 -0
- qiskit/primitives/backend_sampler.py +222 -0
- qiskit/primitives/backend_sampler_v2.py +339 -0
- qiskit/primitives/base/__init__.py +20 -0
- qiskit/primitives/base/base_estimator.py +252 -0
- qiskit/primitives/base/base_primitive.py +45 -0
- qiskit/primitives/base/base_primitive_job.py +78 -0
- qiskit/primitives/base/base_result.py +65 -0
- qiskit/primitives/base/base_sampler.py +204 -0
- qiskit/primitives/base/estimator_result.py +46 -0
- qiskit/primitives/base/sampler_result.py +45 -0
- qiskit/primitives/base/validation.py +231 -0
- qiskit/primitives/containers/__init__.py +26 -0
- qiskit/primitives/containers/bindings_array.py +389 -0
- qiskit/primitives/containers/bit_array.py +741 -0
- qiskit/primitives/containers/data_bin.py +173 -0
- qiskit/primitives/containers/estimator_pub.py +222 -0
- qiskit/primitives/containers/object_array.py +94 -0
- qiskit/primitives/containers/observables_array.py +279 -0
- qiskit/primitives/containers/primitive_result.py +53 -0
- qiskit/primitives/containers/pub_result.py +51 -0
- qiskit/primitives/containers/sampler_pub.py +193 -0
- qiskit/primitives/containers/sampler_pub_result.py +74 -0
- qiskit/primitives/containers/shape.py +129 -0
- qiskit/primitives/estimator.py +172 -0
- qiskit/primitives/primitive_job.py +81 -0
- qiskit/primitives/sampler.py +162 -0
- qiskit/primitives/statevector_estimator.py +174 -0
- qiskit/primitives/statevector_sampler.py +292 -0
- qiskit/primitives/utils.py +247 -0
- qiskit/providers/__init__.py +803 -0
- qiskit/providers/backend.py +667 -0
- qiskit/providers/backend_compat.py +472 -0
- qiskit/providers/basic_provider/__init__.py +45 -0
- qiskit/providers/basic_provider/basic_provider.py +101 -0
- qiskit/providers/basic_provider/basic_provider_job.py +65 -0
- qiskit/providers/basic_provider/basic_provider_tools.py +218 -0
- qiskit/providers/basic_provider/basic_simulator.py +821 -0
- qiskit/providers/basic_provider/exceptions.py +30 -0
- qiskit/providers/exceptions.py +45 -0
- qiskit/providers/fake_provider/__init__.py +105 -0
- qiskit/providers/fake_provider/backends_v1/__init__.py +22 -0
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/__init__.py +18 -0
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/conf_washington.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/defs_washington.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/fake_127q_pulse_v1.py +37 -0
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/props_washington.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_20q/__init__.py +18 -0
- qiskit/providers/fake_provider/backends_v1/fake_20q/conf_singapore.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_20q/fake_20q.py +43 -0
- qiskit/providers/fake_provider/backends_v1/fake_20q/props_singapore.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/__init__.py +18 -0
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/conf_hanoi.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/defs_hanoi.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/fake_27q_pulse_v1.py +50 -0
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/props_hanoi.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_5q/__init__.py +18 -0
- qiskit/providers/fake_provider/backends_v1/fake_5q/conf_yorktown.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_5q/fake_5q_v1.py +41 -0
- qiskit/providers/fake_provider/backends_v1/fake_5q/props_yorktown.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/__init__.py +18 -0
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/conf_nairobi.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/defs_nairobi.json +1 -0
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/fake_7q_pulse_v1.py +44 -0
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/props_nairobi.json +1 -0
- qiskit/providers/fake_provider/fake_1q.py +91 -0
- qiskit/providers/fake_provider/fake_backend.py +165 -0
- qiskit/providers/fake_provider/fake_openpulse_2q.py +391 -0
- qiskit/providers/fake_provider/fake_openpulse_3q.py +340 -0
- qiskit/providers/fake_provider/fake_pulse_backend.py +49 -0
- qiskit/providers/fake_provider/fake_qasm_backend.py +77 -0
- qiskit/providers/fake_provider/generic_backend_v2.py +1035 -0
- qiskit/providers/fake_provider/utils/__init__.py +15 -0
- qiskit/providers/fake_provider/utils/backend_converter.py +150 -0
- qiskit/providers/fake_provider/utils/json_decoder.py +109 -0
- qiskit/providers/job.py +147 -0
- qiskit/providers/jobstatus.py +30 -0
- qiskit/providers/models/__init__.py +89 -0
- qiskit/providers/models/backendconfiguration.py +1040 -0
- qiskit/providers/models/backendproperties.py +517 -0
- qiskit/providers/models/backendstatus.py +94 -0
- qiskit/providers/models/jobstatus.py +66 -0
- qiskit/providers/models/pulsedefaults.py +305 -0
- qiskit/providers/options.py +273 -0
- qiskit/providers/provider.py +95 -0
- qiskit/providers/providerutils.py +110 -0
- qiskit/pulse/__init__.py +158 -0
- qiskit/pulse/builder.py +2254 -0
- qiskit/pulse/calibration_entries.py +381 -0
- qiskit/pulse/channels.py +227 -0
- qiskit/pulse/configuration.py +245 -0
- qiskit/pulse/exceptions.py +45 -0
- qiskit/pulse/filters.py +309 -0
- qiskit/pulse/instruction_schedule_map.py +424 -0
- qiskit/pulse/instructions/__init__.py +67 -0
- qiskit/pulse/instructions/acquire.py +150 -0
- qiskit/pulse/instructions/delay.py +71 -0
- qiskit/pulse/instructions/directives.py +154 -0
- qiskit/pulse/instructions/frequency.py +135 -0
- qiskit/pulse/instructions/instruction.py +270 -0
- qiskit/pulse/instructions/phase.py +152 -0
- qiskit/pulse/instructions/play.py +99 -0
- qiskit/pulse/instructions/reference.py +100 -0
- qiskit/pulse/instructions/snapshot.py +82 -0
- qiskit/pulse/library/__init__.py +97 -0
- qiskit/pulse/library/continuous.py +430 -0
- qiskit/pulse/library/pulse.py +148 -0
- qiskit/pulse/library/samplers/__init__.py +15 -0
- qiskit/pulse/library/samplers/decorators.py +295 -0
- qiskit/pulse/library/samplers/strategies.py +71 -0
- qiskit/pulse/library/symbolic_pulses.py +1988 -0
- qiskit/pulse/library/waveform.py +136 -0
- qiskit/pulse/macros.py +262 -0
- qiskit/pulse/parameter_manager.py +445 -0
- qiskit/pulse/parser.py +314 -0
- qiskit/pulse/reference_manager.py +58 -0
- qiskit/pulse/schedule.py +1854 -0
- qiskit/pulse/transforms/__init__.py +106 -0
- qiskit/pulse/transforms/alignments.py +406 -0
- qiskit/pulse/transforms/base_transforms.py +71 -0
- qiskit/pulse/transforms/canonicalization.py +498 -0
- qiskit/pulse/transforms/dag.py +122 -0
- qiskit/pulse/utils.py +149 -0
- qiskit/qasm/libs/dummy/stdgates.inc +75 -0
- qiskit/qasm/libs/qelib1.inc +266 -0
- qiskit/qasm/libs/stdgates.inc +82 -0
- qiskit/qasm2/__init__.py +654 -0
- qiskit/qasm2/exceptions.py +27 -0
- qiskit/qasm2/export.py +372 -0
- qiskit/qasm2/parse.py +452 -0
- qiskit/qasm3/__init__.py +367 -0
- qiskit/qasm3/ast.py +738 -0
- qiskit/qasm3/exceptions.py +27 -0
- qiskit/qasm3/experimental.py +70 -0
- qiskit/qasm3/exporter.py +1299 -0
- qiskit/qasm3/printer.py +577 -0
- qiskit/qobj/__init__.py +75 -0
- qiskit/qobj/common.py +81 -0
- qiskit/qobj/converters/__init__.py +18 -0
- qiskit/qobj/converters/lo_config.py +177 -0
- qiskit/qobj/converters/pulse_instruction.py +897 -0
- qiskit/qobj/pulse_qobj.py +709 -0
- qiskit/qobj/qasm_qobj.py +708 -0
- qiskit/qobj/utils.py +46 -0
- qiskit/qpy/__init__.py +1822 -0
- qiskit/qpy/binary_io/__init__.py +36 -0
- qiskit/qpy/binary_io/circuits.py +1475 -0
- qiskit/qpy/binary_io/schedules.py +635 -0
- qiskit/qpy/binary_io/value.py +1025 -0
- qiskit/qpy/common.py +350 -0
- qiskit/qpy/exceptions.py +53 -0
- qiskit/qpy/formats.py +401 -0
- qiskit/qpy/interface.py +377 -0
- qiskit/qpy/type_keys.py +572 -0
- qiskit/quantum_info/__init__.py +162 -0
- qiskit/quantum_info/analysis/__init__.py +17 -0
- qiskit/quantum_info/analysis/average.py +47 -0
- qiskit/quantum_info/analysis/distance.py +102 -0
- qiskit/quantum_info/analysis/make_observable.py +44 -0
- qiskit/quantum_info/analysis/z2_symmetries.py +484 -0
- qiskit/quantum_info/operators/__init__.py +28 -0
- qiskit/quantum_info/operators/base_operator.py +145 -0
- qiskit/quantum_info/operators/channel/__init__.py +29 -0
- qiskit/quantum_info/operators/channel/chi.py +191 -0
- qiskit/quantum_info/operators/channel/choi.py +218 -0
- qiskit/quantum_info/operators/channel/kraus.py +337 -0
- qiskit/quantum_info/operators/channel/ptm.py +204 -0
- qiskit/quantum_info/operators/channel/quantum_channel.py +348 -0
- qiskit/quantum_info/operators/channel/stinespring.py +296 -0
- qiskit/quantum_info/operators/channel/superop.py +377 -0
- qiskit/quantum_info/operators/channel/transformations.py +475 -0
- qiskit/quantum_info/operators/custom_iterator.py +48 -0
- qiskit/quantum_info/operators/dihedral/__init__.py +18 -0
- qiskit/quantum_info/operators/dihedral/dihedral.py +509 -0
- qiskit/quantum_info/operators/dihedral/dihedral_circuits.py +216 -0
- qiskit/quantum_info/operators/dihedral/polynomial.py +313 -0
- qiskit/quantum_info/operators/dihedral/random.py +64 -0
- qiskit/quantum_info/operators/linear_op.py +25 -0
- qiskit/quantum_info/operators/measures.py +418 -0
- qiskit/quantum_info/operators/mixins/__init__.py +52 -0
- qiskit/quantum_info/operators/mixins/adjoint.py +52 -0
- qiskit/quantum_info/operators/mixins/group.py +171 -0
- qiskit/quantum_info/operators/mixins/linear.py +84 -0
- qiskit/quantum_info/operators/mixins/multiply.py +62 -0
- qiskit/quantum_info/operators/mixins/tolerances.py +72 -0
- qiskit/quantum_info/operators/op_shape.py +525 -0
- qiskit/quantum_info/operators/operator.py +865 -0
- qiskit/quantum_info/operators/operator_utils.py +76 -0
- qiskit/quantum_info/operators/predicates.py +183 -0
- qiskit/quantum_info/operators/random.py +154 -0
- qiskit/quantum_info/operators/scalar_op.py +254 -0
- qiskit/quantum_info/operators/symplectic/__init__.py +23 -0
- qiskit/quantum_info/operators/symplectic/base_pauli.py +719 -0
- qiskit/quantum_info/operators/symplectic/clifford.py +1030 -0
- qiskit/quantum_info/operators/symplectic/clifford_circuits.py +558 -0
- qiskit/quantum_info/operators/symplectic/pauli.py +753 -0
- qiskit/quantum_info/operators/symplectic/pauli_list.py +1230 -0
- qiskit/quantum_info/operators/symplectic/pauli_utils.py +40 -0
- qiskit/quantum_info/operators/symplectic/random.py +117 -0
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +1196 -0
- qiskit/quantum_info/operators/utils/__init__.py +20 -0
- qiskit/quantum_info/operators/utils/anti_commutator.py +36 -0
- qiskit/quantum_info/operators/utils/commutator.py +36 -0
- qiskit/quantum_info/operators/utils/double_commutator.py +76 -0
- qiskit/quantum_info/quaternion.py +156 -0
- qiskit/quantum_info/random.py +26 -0
- qiskit/quantum_info/states/__init__.py +28 -0
- qiskit/quantum_info/states/densitymatrix.py +845 -0
- qiskit/quantum_info/states/measures.py +288 -0
- qiskit/quantum_info/states/quantum_state.py +503 -0
- qiskit/quantum_info/states/random.py +157 -0
- qiskit/quantum_info/states/stabilizerstate.py +773 -0
- qiskit/quantum_info/states/statevector.py +958 -0
- qiskit/quantum_info/states/utils.py +247 -0
- qiskit/result/__init__.py +73 -0
- qiskit/result/counts.py +189 -0
- qiskit/result/distributions/__init__.py +17 -0
- qiskit/result/distributions/probability.py +100 -0
- qiskit/result/distributions/quasi.py +154 -0
- qiskit/result/exceptions.py +40 -0
- qiskit/result/mitigation/__init__.py +13 -0
- qiskit/result/mitigation/base_readout_mitigator.py +79 -0
- qiskit/result/mitigation/correlated_readout_mitigator.py +277 -0
- qiskit/result/mitigation/local_readout_mitigator.py +328 -0
- qiskit/result/mitigation/utils.py +217 -0
- qiskit/result/models.py +234 -0
- qiskit/result/postprocess.py +239 -0
- qiskit/result/result.py +392 -0
- qiskit/result/sampled_expval.py +75 -0
- qiskit/result/utils.py +295 -0
- qiskit/scheduler/__init__.py +40 -0
- qiskit/scheduler/config.py +37 -0
- qiskit/scheduler/lowering.py +187 -0
- qiskit/scheduler/methods/__init__.py +15 -0
- qiskit/scheduler/methods/basic.py +140 -0
- qiskit/scheduler/schedule_circuit.py +69 -0
- qiskit/scheduler/sequence.py +104 -0
- qiskit/synthesis/__init__.py +220 -0
- qiskit/synthesis/arithmetic/__init__.py +16 -0
- qiskit/synthesis/arithmetic/adders/__init__.py +17 -0
- qiskit/synthesis/arithmetic/adders/cdkm_ripple_carry_adder.py +154 -0
- qiskit/synthesis/arithmetic/adders/draper_qft_adder.py +103 -0
- qiskit/synthesis/arithmetic/adders/vbe_ripple_carry_adder.py +161 -0
- qiskit/synthesis/arithmetic/multipliers/__init__.py +16 -0
- qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +102 -0
- qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +99 -0
- qiskit/synthesis/clifford/__init__.py +19 -0
- qiskit/synthesis/clifford/clifford_decompose_ag.py +178 -0
- qiskit/synthesis/clifford/clifford_decompose_bm.py +46 -0
- qiskit/synthesis/clifford/clifford_decompose_full.py +64 -0
- qiskit/synthesis/clifford/clifford_decompose_greedy.py +58 -0
- qiskit/synthesis/clifford/clifford_decompose_layers.py +447 -0
- qiskit/synthesis/cnotdihedral/__init__.py +17 -0
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_full.py +52 -0
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_general.py +141 -0
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_two_qubits.py +266 -0
- qiskit/synthesis/discrete_basis/__init__.py +16 -0
- qiskit/synthesis/discrete_basis/commutator_decompose.py +241 -0
- qiskit/synthesis/discrete_basis/gate_sequence.py +415 -0
- qiskit/synthesis/discrete_basis/generate_basis_approximations.py +163 -0
- qiskit/synthesis/discrete_basis/solovay_kitaev.py +217 -0
- qiskit/synthesis/evolution/__init__.py +21 -0
- qiskit/synthesis/evolution/evolution_synthesis.py +48 -0
- qiskit/synthesis/evolution/lie_trotter.py +117 -0
- qiskit/synthesis/evolution/matrix_synthesis.py +47 -0
- qiskit/synthesis/evolution/pauli_network.py +80 -0
- qiskit/synthesis/evolution/product_formula.py +311 -0
- qiskit/synthesis/evolution/qdrift.py +138 -0
- qiskit/synthesis/evolution/suzuki_trotter.py +215 -0
- qiskit/synthesis/linear/__init__.py +26 -0
- qiskit/synthesis/linear/cnot_synth.py +69 -0
- qiskit/synthesis/linear/linear_circuits_utils.py +128 -0
- qiskit/synthesis/linear/linear_depth_lnn.py +276 -0
- qiskit/synthesis/linear/linear_matrix_utils.py +27 -0
- qiskit/synthesis/linear_phase/__init__.py +17 -0
- qiskit/synthesis/linear_phase/cnot_phase_synth.py +206 -0
- qiskit/synthesis/linear_phase/cx_cz_depth_lnn.py +262 -0
- qiskit/synthesis/linear_phase/cz_depth_lnn.py +58 -0
- qiskit/synthesis/multi_controlled/__init__.py +24 -0
- qiskit/synthesis/multi_controlled/mcmt_vchain.py +52 -0
- qiskit/synthesis/multi_controlled/mcx_synthesis.py +356 -0
- qiskit/synthesis/one_qubit/__init__.py +15 -0
- qiskit/synthesis/one_qubit/one_qubit_decompose.py +288 -0
- qiskit/synthesis/permutation/__init__.py +18 -0
- qiskit/synthesis/permutation/permutation_full.py +78 -0
- qiskit/synthesis/permutation/permutation_lnn.py +54 -0
- qiskit/synthesis/permutation/permutation_reverse_lnn.py +93 -0
- qiskit/synthesis/permutation/permutation_utils.py +16 -0
- qiskit/synthesis/qft/__init__.py +16 -0
- qiskit/synthesis/qft/qft_decompose_full.py +97 -0
- qiskit/synthesis/qft/qft_decompose_lnn.py +79 -0
- qiskit/synthesis/stabilizer/__init__.py +16 -0
- qiskit/synthesis/stabilizer/stabilizer_circuit.py +149 -0
- qiskit/synthesis/stabilizer/stabilizer_decompose.py +194 -0
- qiskit/synthesis/two_qubit/__init__.py +19 -0
- qiskit/synthesis/two_qubit/local_invariance.py +63 -0
- qiskit/synthesis/two_qubit/two_qubit_decompose.py +700 -0
- qiskit/synthesis/two_qubit/xx_decompose/__init__.py +19 -0
- qiskit/synthesis/two_qubit/xx_decompose/circuits.py +300 -0
- qiskit/synthesis/two_qubit/xx_decompose/decomposer.py +324 -0
- qiskit/synthesis/two_qubit/xx_decompose/embodiments.py +163 -0
- qiskit/synthesis/two_qubit/xx_decompose/paths.py +412 -0
- qiskit/synthesis/two_qubit/xx_decompose/polytopes.py +262 -0
- qiskit/synthesis/two_qubit/xx_decompose/utilities.py +40 -0
- qiskit/synthesis/two_qubit/xx_decompose/weyl.py +133 -0
- qiskit/synthesis/unitary/__init__.py +13 -0
- qiskit/synthesis/unitary/aqc/__init__.py +177 -0
- qiskit/synthesis/unitary/aqc/approximate.py +116 -0
- qiskit/synthesis/unitary/aqc/aqc.py +175 -0
- qiskit/synthesis/unitary/aqc/cnot_structures.py +300 -0
- qiskit/synthesis/unitary/aqc/cnot_unit_circuit.py +103 -0
- qiskit/synthesis/unitary/aqc/cnot_unit_objective.py +299 -0
- qiskit/synthesis/unitary/aqc/elementary_operations.py +108 -0
- qiskit/synthesis/unitary/aqc/fast_gradient/__init__.py +164 -0
- qiskit/synthesis/unitary/aqc/fast_gradient/fast_grad_utils.py +237 -0
- qiskit/synthesis/unitary/aqc/fast_gradient/fast_gradient.py +226 -0
- qiskit/synthesis/unitary/aqc/fast_gradient/layer.py +370 -0
- qiskit/synthesis/unitary/aqc/fast_gradient/pmatrix.py +312 -0
- qiskit/synthesis/unitary/qsd.py +288 -0
- qiskit/transpiler/__init__.py +1290 -0
- qiskit/transpiler/basepasses.py +221 -0
- qiskit/transpiler/coupling.py +500 -0
- qiskit/transpiler/exceptions.py +59 -0
- qiskit/transpiler/instruction_durations.py +281 -0
- qiskit/transpiler/layout.py +737 -0
- qiskit/transpiler/passes/__init__.py +312 -0
- qiskit/transpiler/passes/analysis/__init__.py +23 -0
- qiskit/transpiler/passes/analysis/count_ops.py +30 -0
- qiskit/transpiler/passes/analysis/count_ops_longest_path.py +26 -0
- qiskit/transpiler/passes/analysis/dag_longest_path.py +24 -0
- qiskit/transpiler/passes/analysis/depth.py +33 -0
- qiskit/transpiler/passes/analysis/num_qubits.py +26 -0
- qiskit/transpiler/passes/analysis/num_tensor_factors.py +26 -0
- qiskit/transpiler/passes/analysis/resource_estimation.py +41 -0
- qiskit/transpiler/passes/analysis/size.py +36 -0
- qiskit/transpiler/passes/analysis/width.py +27 -0
- qiskit/transpiler/passes/basis/__init__.py +19 -0
- qiskit/transpiler/passes/basis/basis_translator.py +137 -0
- qiskit/transpiler/passes/basis/decompose.py +131 -0
- qiskit/transpiler/passes/basis/translate_parameterized.py +175 -0
- qiskit/transpiler/passes/basis/unroll_3q_or_more.py +88 -0
- qiskit/transpiler/passes/basis/unroll_custom_definitions.py +109 -0
- qiskit/transpiler/passes/calibration/__init__.py +17 -0
- qiskit/transpiler/passes/calibration/base_builder.py +79 -0
- qiskit/transpiler/passes/calibration/builders.py +20 -0
- qiskit/transpiler/passes/calibration/exceptions.py +22 -0
- qiskit/transpiler/passes/calibration/pulse_gate.py +100 -0
- qiskit/transpiler/passes/calibration/rx_builder.py +164 -0
- qiskit/transpiler/passes/calibration/rzx_builder.py +411 -0
- qiskit/transpiler/passes/calibration/rzx_templates.py +51 -0
- qiskit/transpiler/passes/layout/__init__.py +26 -0
- qiskit/transpiler/passes/layout/_csp_custom_solver.py +65 -0
- qiskit/transpiler/passes/layout/apply_layout.py +123 -0
- qiskit/transpiler/passes/layout/csp_layout.py +132 -0
- qiskit/transpiler/passes/layout/dense_layout.py +202 -0
- qiskit/transpiler/passes/layout/disjoint_utils.py +219 -0
- qiskit/transpiler/passes/layout/enlarge_with_ancilla.py +49 -0
- qiskit/transpiler/passes/layout/full_ancilla_allocation.py +117 -0
- qiskit/transpiler/passes/layout/layout_2q_distance.py +77 -0
- qiskit/transpiler/passes/layout/sabre_layout.py +487 -0
- qiskit/transpiler/passes/layout/sabre_pre_layout.py +225 -0
- qiskit/transpiler/passes/layout/set_layout.py +69 -0
- qiskit/transpiler/passes/layout/trivial_layout.py +66 -0
- qiskit/transpiler/passes/layout/vf2_layout.py +263 -0
- qiskit/transpiler/passes/layout/vf2_post_layout.py +419 -0
- qiskit/transpiler/passes/layout/vf2_utils.py +260 -0
- qiskit/transpiler/passes/optimization/__init__.py +43 -0
- qiskit/transpiler/passes/optimization/_gate_extension.py +80 -0
- qiskit/transpiler/passes/optimization/collect_1q_runs.py +31 -0
- qiskit/transpiler/passes/optimization/collect_2q_blocks.py +35 -0
- qiskit/transpiler/passes/optimization/collect_and_collapse.py +115 -0
- qiskit/transpiler/passes/optimization/collect_cliffords.py +104 -0
- qiskit/transpiler/passes/optimization/collect_linear_functions.py +80 -0
- qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +227 -0
- qiskit/transpiler/passes/optimization/commutation_analysis.py +44 -0
- qiskit/transpiler/passes/optimization/commutative_cancellation.py +82 -0
- qiskit/transpiler/passes/optimization/commutative_inverse_cancellation.py +140 -0
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +149 -0
- qiskit/transpiler/passes/optimization/cx_cancellation.py +65 -0
- qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py +162 -0
- qiskit/transpiler/passes/optimization/elide_permutations.py +91 -0
- qiskit/transpiler/passes/optimization/hoare_opt.py +420 -0
- qiskit/transpiler/passes/optimization/inverse_cancellation.py +95 -0
- qiskit/transpiler/passes/optimization/normalize_rx_angle.py +149 -0
- qiskit/transpiler/passes/optimization/optimize_1q_commutation.py +268 -0
- qiskit/transpiler/passes/optimization/optimize_1q_decomposition.py +254 -0
- qiskit/transpiler/passes/optimization/optimize_1q_gates.py +384 -0
- qiskit/transpiler/passes/optimization/optimize_annotated.py +448 -0
- qiskit/transpiler/passes/optimization/optimize_cliffords.py +89 -0
- qiskit/transpiler/passes/optimization/optimize_swap_before_measure.py +71 -0
- qiskit/transpiler/passes/optimization/remove_diagonal_gates_before_measure.py +41 -0
- qiskit/transpiler/passes/optimization/remove_final_reset.py +37 -0
- qiskit/transpiler/passes/optimization/remove_identity_equiv.py +69 -0
- qiskit/transpiler/passes/optimization/remove_reset_in_zero_state.py +37 -0
- qiskit/transpiler/passes/optimization/reset_after_measure_simplification.py +47 -0
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +40 -0
- qiskit/transpiler/passes/optimization/template_matching/__init__.py +19 -0
- qiskit/transpiler/passes/optimization/template_matching/backward_match.py +749 -0
- qiskit/transpiler/passes/optimization/template_matching/forward_match.py +452 -0
- qiskit/transpiler/passes/optimization/template_matching/maximal_matches.py +77 -0
- qiskit/transpiler/passes/optimization/template_matching/template_matching.py +370 -0
- qiskit/transpiler/passes/optimization/template_matching/template_substitution.py +638 -0
- qiskit/transpiler/passes/optimization/template_optimization.py +158 -0
- qiskit/transpiler/passes/routing/__init__.py +22 -0
- qiskit/transpiler/passes/routing/algorithms/__init__.py +33 -0
- qiskit/transpiler/passes/routing/algorithms/token_swapper.py +105 -0
- qiskit/transpiler/passes/routing/algorithms/types.py +46 -0
- qiskit/transpiler/passes/routing/algorithms/util.py +103 -0
- qiskit/transpiler/passes/routing/basic_swap.py +166 -0
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/__init__.py +25 -0
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_block.py +60 -0
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +395 -0
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/pauli_2q_evolution_commutation.py +145 -0
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/swap_strategy.py +306 -0
- qiskit/transpiler/passes/routing/layout_transformation.py +119 -0
- qiskit/transpiler/passes/routing/lookahead_swap.py +390 -0
- qiskit/transpiler/passes/routing/sabre_swap.py +447 -0
- qiskit/transpiler/passes/routing/star_prerouting.py +392 -0
- qiskit/transpiler/passes/routing/stochastic_swap.py +532 -0
- qiskit/transpiler/passes/routing/utils.py +35 -0
- qiskit/transpiler/passes/scheduling/__init__.py +27 -0
- qiskit/transpiler/passes/scheduling/alap.py +153 -0
- qiskit/transpiler/passes/scheduling/alignments/__init__.py +81 -0
- qiskit/transpiler/passes/scheduling/alignments/align_measures.py +255 -0
- qiskit/transpiler/passes/scheduling/alignments/check_durations.py +78 -0
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +107 -0
- qiskit/transpiler/passes/scheduling/alignments/reschedule.py +250 -0
- qiskit/transpiler/passes/scheduling/asap.py +175 -0
- qiskit/transpiler/passes/scheduling/base_scheduler.py +310 -0
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +312 -0
- qiskit/transpiler/passes/scheduling/padding/__init__.py +16 -0
- qiskit/transpiler/passes/scheduling/padding/base_padding.py +256 -0
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +452 -0
- qiskit/transpiler/passes/scheduling/padding/pad_delay.py +82 -0
- qiskit/transpiler/passes/scheduling/scheduling/__init__.py +17 -0
- qiskit/transpiler/passes/scheduling/scheduling/alap.py +127 -0
- qiskit/transpiler/passes/scheduling/scheduling/asap.py +131 -0
- qiskit/transpiler/passes/scheduling/scheduling/base_scheduler.py +94 -0
- qiskit/transpiler/passes/scheduling/scheduling/set_io_latency.py +64 -0
- qiskit/transpiler/passes/scheduling/time_unit_conversion.py +165 -0
- qiskit/transpiler/passes/synthesis/__init__.py +20 -0
- qiskit/transpiler/passes/synthesis/aqc_plugin.py +153 -0
- qiskit/transpiler/passes/synthesis/high_level_synthesis.py +854 -0
- qiskit/transpiler/passes/synthesis/hls_plugins.py +1559 -0
- qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py +41 -0
- qiskit/transpiler/passes/synthesis/plugin.py +734 -0
- qiskit/transpiler/passes/synthesis/solovay_kitaev_synthesis.py +297 -0
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +1076 -0
- qiskit/transpiler/passes/utils/__init__.py +33 -0
- qiskit/transpiler/passes/utils/barrier_before_final_measurements.py +41 -0
- qiskit/transpiler/passes/utils/check_gate_direction.py +52 -0
- qiskit/transpiler/passes/utils/check_map.py +78 -0
- qiskit/transpiler/passes/utils/contains_instruction.py +45 -0
- qiskit/transpiler/passes/utils/control_flow.py +65 -0
- qiskit/transpiler/passes/utils/convert_conditions_to_if_ops.py +93 -0
- qiskit/transpiler/passes/utils/dag_fixed_point.py +36 -0
- qiskit/transpiler/passes/utils/error.py +69 -0
- qiskit/transpiler/passes/utils/filter_op_nodes.py +65 -0
- qiskit/transpiler/passes/utils/fixed_point.py +48 -0
- qiskit/transpiler/passes/utils/gate_direction.py +86 -0
- qiskit/transpiler/passes/utils/gates_basis.py +51 -0
- qiskit/transpiler/passes/utils/merge_adjacent_barriers.py +163 -0
- qiskit/transpiler/passes/utils/minimum_point.py +118 -0
- qiskit/transpiler/passes/utils/remove_barriers.py +49 -0
- qiskit/transpiler/passes/utils/remove_final_measurements.py +114 -0
- qiskit/transpiler/passes/utils/unroll_forloops.py +81 -0
- qiskit/transpiler/passmanager.py +490 -0
- qiskit/transpiler/passmanager_config.py +216 -0
- qiskit/transpiler/preset_passmanagers/__init__.py +73 -0
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +1045 -0
- qiskit/transpiler/preset_passmanagers/common.py +649 -0
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +626 -0
- qiskit/transpiler/preset_passmanagers/level0.py +113 -0
- qiskit/transpiler/preset_passmanagers/level1.py +120 -0
- qiskit/transpiler/preset_passmanagers/level2.py +119 -0
- qiskit/transpiler/preset_passmanagers/level3.py +119 -0
- qiskit/transpiler/preset_passmanagers/plugin.py +353 -0
- qiskit/transpiler/target.py +1319 -0
- qiskit/transpiler/timing_constraints.py +59 -0
- qiskit/user_config.py +262 -0
- qiskit/utils/__init__.py +89 -0
- qiskit/utils/classtools.py +146 -0
- qiskit/utils/deprecate_pulse.py +119 -0
- qiskit/utils/deprecation.py +490 -0
- qiskit/utils/lazy_tester.py +363 -0
- qiskit/utils/multiprocessing.py +56 -0
- qiskit/utils/optionals.py +347 -0
- qiskit/utils/parallel.py +191 -0
- qiskit/utils/units.py +143 -0
- qiskit/version.py +84 -0
- qiskit/visualization/__init__.py +288 -0
- qiskit/visualization/array.py +204 -0
- qiskit/visualization/bloch.py +778 -0
- qiskit/visualization/circuit/__init__.py +15 -0
- qiskit/visualization/circuit/_utils.py +675 -0
- qiskit/visualization/circuit/circuit_visualization.py +727 -0
- qiskit/visualization/circuit/latex.py +661 -0
- qiskit/visualization/circuit/matplotlib.py +2029 -0
- qiskit/visualization/circuit/qcstyle.py +278 -0
- qiskit/visualization/circuit/styles/__init__.py +13 -0
- qiskit/visualization/circuit/styles/bw.json +202 -0
- qiskit/visualization/circuit/styles/clifford.json +202 -0
- qiskit/visualization/circuit/styles/iqp-dark.json +214 -0
- qiskit/visualization/circuit/styles/iqp.json +214 -0
- qiskit/visualization/circuit/styles/textbook.json +202 -0
- qiskit/visualization/circuit/text.py +1844 -0
- qiskit/visualization/circuit_visualization.py +19 -0
- qiskit/visualization/counts_visualization.py +481 -0
- qiskit/visualization/dag_visualization.py +316 -0
- qiskit/visualization/exceptions.py +21 -0
- qiskit/visualization/gate_map.py +1485 -0
- qiskit/visualization/library.py +37 -0
- qiskit/visualization/pass_manager_visualization.py +308 -0
- qiskit/visualization/pulse_v2/__init__.py +21 -0
- qiskit/visualization/pulse_v2/core.py +901 -0
- qiskit/visualization/pulse_v2/device_info.py +173 -0
- qiskit/visualization/pulse_v2/drawings.py +253 -0
- qiskit/visualization/pulse_v2/events.py +254 -0
- qiskit/visualization/pulse_v2/generators/__init__.py +40 -0
- qiskit/visualization/pulse_v2/generators/barrier.py +76 -0
- qiskit/visualization/pulse_v2/generators/chart.py +208 -0
- qiskit/visualization/pulse_v2/generators/frame.py +436 -0
- qiskit/visualization/pulse_v2/generators/snapshot.py +133 -0
- qiskit/visualization/pulse_v2/generators/waveform.py +645 -0
- qiskit/visualization/pulse_v2/interface.py +458 -0
- qiskit/visualization/pulse_v2/layouts.py +387 -0
- qiskit/visualization/pulse_v2/plotters/__init__.py +17 -0
- qiskit/visualization/pulse_v2/plotters/base_plotter.py +53 -0
- qiskit/visualization/pulse_v2/plotters/matplotlib.py +201 -0
- qiskit/visualization/pulse_v2/stylesheet.py +312 -0
- qiskit/visualization/pulse_v2/types.py +242 -0
- qiskit/visualization/state_visualization.py +1518 -0
- qiskit/visualization/timeline/__init__.py +21 -0
- qiskit/visualization/timeline/core.py +480 -0
- qiskit/visualization/timeline/drawings.py +260 -0
- qiskit/visualization/timeline/generators.py +506 -0
- qiskit/visualization/timeline/interface.py +436 -0
- qiskit/visualization/timeline/layouts.py +115 -0
- qiskit/visualization/timeline/plotters/__init__.py +16 -0
- qiskit/visualization/timeline/plotters/base_plotter.py +58 -0
- qiskit/visualization/timeline/plotters/matplotlib.py +192 -0
- qiskit/visualization/timeline/stylesheet.py +301 -0
- qiskit/visualization/timeline/types.py +148 -0
- qiskit/visualization/transition_visualization.py +369 -0
- qiskit/visualization/utils.py +49 -0
- qiskit-1.3.0.dist-info/LICENSE.txt +203 -0
- qiskit-1.3.0.dist-info/METADATA +222 -0
- qiskit-1.3.0.dist-info/RECORD +836 -0
- qiskit-1.3.0.dist-info/WHEEL +5 -0
- qiskit-1.3.0.dist-info/entry_points.txt +76 -0
- qiskit-1.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1290 @@
|
|
1
|
+
# This code is part of Qiskit.
|
2
|
+
#
|
3
|
+
# (C) Copyright IBM 2017, 2018.
|
4
|
+
#
|
5
|
+
# This code is licensed under the Apache License, Version 2.0. You may
|
6
|
+
# obtain a copy of this license in the LICENSE.txt file in the root directory
|
7
|
+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
|
8
|
+
#
|
9
|
+
# Any modifications or derivative works of this code must retain this
|
10
|
+
# copyright notice, and modified files need to carry a notice indicating
|
11
|
+
# that they have been altered from the originals.
|
12
|
+
|
13
|
+
"""
|
14
|
+
=====================================
|
15
|
+
Transpiler (:mod:`qiskit.transpiler`)
|
16
|
+
=====================================
|
17
|
+
|
18
|
+
.. currentmodule:: qiskit.transpiler
|
19
|
+
|
20
|
+
Overview
|
21
|
+
========
|
22
|
+
|
23
|
+
Transpilation is the process of rewriting a given input circuit to match
|
24
|
+
the topology of a specific quantum device, and/or to optimize the circuit
|
25
|
+
for execution on present day noisy quantum systems.
|
26
|
+
|
27
|
+
Most circuits must undergo a series of transformations that make them compatible with
|
28
|
+
a given target device, and optimize them to reduce the effects of noise on the
|
29
|
+
resulting outcomes. Rewriting quantum circuits to match hardware constraints and
|
30
|
+
optimizing for performance can be far from trivial. The flow of logic in the rewriting
|
31
|
+
tool chain need not be linear, and can often have iterative sub-loops, conditional
|
32
|
+
branches, and other complex behaviors. That being said, the standard
|
33
|
+
compilation flow follows the structure given below:
|
34
|
+
|
35
|
+
.. image:: /source_images/transpiling_core_steps.png
|
36
|
+
|
37
|
+
.. raw:: html
|
38
|
+
|
39
|
+
<br>
|
40
|
+
|
41
|
+
Qiskit has four pre-built transpilation pipelines available here:
|
42
|
+
:mod:`qiskit.transpiler.preset_passmanagers`. Unless the reader is familiar with
|
43
|
+
quantum circuit optimization methods and their usage, it is best to use one of
|
44
|
+
these ready-made routines. By default the preset pass managers are composed
|
45
|
+
of six stages:
|
46
|
+
|
47
|
+
#. ``init`` - This stage runs any initial passes that are required before we start embedding the
|
48
|
+
circuit to the backend. This typically involves unrolling custom instructions and converting
|
49
|
+
the circuit to all 1 and 2 qubit gates.
|
50
|
+
#. ``layout`` - This stage applies a layout, mapping the virtual qubits in the circuit to the
|
51
|
+
physical qubits on a backend. See :ref:`layout_stage` for more details.
|
52
|
+
#. ``routing`` - This stage runs after a layout has been applied and will inject
|
53
|
+
gates (i.e. swaps) into the original circuit to make it compatible
|
54
|
+
with the backend's connectivity. See :ref:`routing_stage` for more details.
|
55
|
+
#. ``translation`` - This stage translates the gates in the circuit to the target backend's basis set.
|
56
|
+
See :ref:`translation_stage` for more details.
|
57
|
+
#. ``optimization`` - This stage runs the main optimization loop repeatedly
|
58
|
+
until a condition (such as fixed depth) is reached. See :ref:`optimization_stage` for more details.
|
59
|
+
#. ``scheduling`` - This stage is for any hardware-aware scheduling passes. See
|
60
|
+
:ref:`scheduling_stage` for more details.
|
61
|
+
|
62
|
+
When using :func:`~.transpile`, the implementation of each stage can be modified with the ``*_method``
|
63
|
+
arguments (e.g. ``layout_method``). These can be set to one of the built-in methods and
|
64
|
+
can also refer to available external plugins. See
|
65
|
+
:mod:`qiskit.transpiler.preset_passmanagers.plugin` for details on this plugin interface.
|
66
|
+
|
67
|
+
.. _working_with_preset_pass_managers:
|
68
|
+
|
69
|
+
Working with Preset Pass Managers
|
70
|
+
=================================
|
71
|
+
|
72
|
+
Qiskit includes functions to build preset :class:`~.PassManager` objects.
|
73
|
+
These preset passmanagers are used by the :func:`~.transpile` function
|
74
|
+
for each optimization level. There are 4 optimization levels ranging from 0 to 3, where higher
|
75
|
+
optimization levels take more time and computational effort but may yield a
|
76
|
+
more optimal circuit.
|
77
|
+
Optimization level 0 is intended for device characterization experiments and, as such, only
|
78
|
+
maps the input circuit to the constraints of the target backend, without
|
79
|
+
performing any optimizations. Optimization level 3 spends the most effort to optimize the circuit.
|
80
|
+
However, as many of the optimization techniques in the transpiler are heuristic based, spending more
|
81
|
+
computational effort does not always result in an improvement in the quality of the output
|
82
|
+
circuit.
|
83
|
+
|
84
|
+
If you'd like to work directly with a
|
85
|
+
preset pass manager you can use the :func:`~.generate_preset_pass_manager`
|
86
|
+
function to easily generate one. For example:
|
87
|
+
|
88
|
+
.. code-block:: python
|
89
|
+
|
90
|
+
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
|
91
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
92
|
+
|
93
|
+
backend = GenericBackendV2(num_qubits=5)
|
94
|
+
pass_manager = generate_preset_pass_manager(3, backend)
|
95
|
+
|
96
|
+
which will generate a :class:`~.StagedPassManager` object for optimization level 3
|
97
|
+
targeting the :class:`~.GenericBackendV2` backend (equivalent to what is used internally
|
98
|
+
by :func:`~.transpile` with ``backend=GenericBackendV2(5)`` and ``optimization_level=3``).
|
99
|
+
You can use this just like you would any other :class:`~.PassManager`. However,
|
100
|
+
because it is a :class:`~.StagedPassManager` it also makes it easy to compose and/or
|
101
|
+
replace stages of the pipeline. For example, if you wanted to run a custom scheduling
|
102
|
+
stage using dynamical decoupling (via the :class:`~.PadDynamicalDecoupling` pass) and
|
103
|
+
also add initial logical optimization prior to routing, you would do something like
|
104
|
+
(building off the previous example):
|
105
|
+
|
106
|
+
.. code-block:: python
|
107
|
+
|
108
|
+
import numpy as np
|
109
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
110
|
+
from qiskit.circuit.library import HGate, PhaseGate, RXGate, TdgGate, TGate, XGate
|
111
|
+
from qiskit.transpiler import PassManager, generate_preset_pass_manager
|
112
|
+
from qiskit.transpiler.passes import (
|
113
|
+
ALAPScheduleAnalysis,
|
114
|
+
CXCancellation,
|
115
|
+
InverseCancellation,
|
116
|
+
PadDynamicalDecoupling,
|
117
|
+
)
|
118
|
+
|
119
|
+
backend = GenericBackendV2(num_qubits=5)
|
120
|
+
dd_sequence = [XGate(), XGate()]
|
121
|
+
scheduling_pm = PassManager(
|
122
|
+
[
|
123
|
+
ALAPScheduleAnalysis(target=backend.target),
|
124
|
+
PadDynamicalDecoupling(target=backend.target, dd_sequence=dd_sequence),
|
125
|
+
]
|
126
|
+
)
|
127
|
+
inverse_gate_list = [
|
128
|
+
HGate(),
|
129
|
+
(RXGate(np.pi / 4), RXGate(-np.pi / 4)),
|
130
|
+
(PhaseGate(np.pi / 4), PhaseGate(-np.pi / 4)),
|
131
|
+
(TGate(), TdgGate()),
|
132
|
+
]
|
133
|
+
logical_opt = PassManager(
|
134
|
+
[
|
135
|
+
CXCancellation(),
|
136
|
+
InverseCancellation(inverse_gate_list),
|
137
|
+
]
|
138
|
+
)
|
139
|
+
|
140
|
+
pass_manager = generate_preset_pass_manager(
|
141
|
+
optimization_level=0
|
142
|
+
)
|
143
|
+
|
144
|
+
# Add pre-layout stage to run extra logical optimization
|
145
|
+
pass_manager.pre_layout = logical_opt
|
146
|
+
# Set scheduling stage to custom pass manager
|
147
|
+
pass_manager.scheduling = scheduling_pm
|
148
|
+
|
149
|
+
Now, when the staged pass manager is run via the :meth:`~.StagedPassManager.run` method,
|
150
|
+
the ``logical_opt`` pass manager will be called before the ``layout`` stage, and the
|
151
|
+
``scheduling_pm`` pass manager will be used for the ``scheduling`` stage instead of the default.
|
152
|
+
|
153
|
+
Custom Pass Managers
|
154
|
+
====================
|
155
|
+
|
156
|
+
In addition to modifying preset pass managers, it is also possible to construct a pass
|
157
|
+
manager to build an entirely custom pipeline for transforming input
|
158
|
+
circuits. You can use the :class:`~.StagedPassManager` class directly to do
|
159
|
+
this. You can define arbitrary stage names and populate them with a :class:`~.PassManager`
|
160
|
+
instance. For example, the following code creates a new :class:`~.StagedPassManager`
|
161
|
+
that has 2 stages, ``init`` and ``translation``.::
|
162
|
+
|
163
|
+
from qiskit.transpiler.passes import (
|
164
|
+
UnitarySynthesis,
|
165
|
+
Collect2qBlocks,
|
166
|
+
ConsolidateBlocks,
|
167
|
+
UnitarySynthesis,
|
168
|
+
Unroll3qOrMore,
|
169
|
+
)
|
170
|
+
from qiskit.transpiler import PassManager, StagedPassManager
|
171
|
+
|
172
|
+
basis_gates = ["rx", "ry", "rxx"]
|
173
|
+
init = PassManager([UnitarySynthesis(basis_gates, min_qubits=3), Unroll3qOrMore()])
|
174
|
+
translate = PassManager(
|
175
|
+
[
|
176
|
+
Collect2qBlocks(),
|
177
|
+
ConsolidateBlocks(basis_gates=basis_gates),
|
178
|
+
UnitarySynthesis(basis_gates),
|
179
|
+
]
|
180
|
+
)
|
181
|
+
|
182
|
+
staged_pm = StagedPassManager(
|
183
|
+
stages=["init", "translation"], init=init, translation=translate
|
184
|
+
)
|
185
|
+
|
186
|
+
There is no limit on the number of stages you can put in a :class:`~.StagedPassManager`.
|
187
|
+
|
188
|
+
The :ref:`stage_generators` may be useful for the construction of custom :class:`~.StagedPassManager`s.
|
189
|
+
They generate pass managers which provide common functionality used in many stages.
|
190
|
+
For example, :func:`~.generate_embed_passmanager` generates a :class:`~.PassManager`
|
191
|
+
to "embed" a selected initial :class:`~.Layout` from a layout pass to the specified target device.
|
192
|
+
|
193
|
+
Representing Quantum Computers
|
194
|
+
==============================
|
195
|
+
|
196
|
+
To be able to compile a :class:`~.QuantumCircuit` for a specific backend, the transpiler needs a
|
197
|
+
specialized representation of that backend, including its constraints, instruction set, qubit
|
198
|
+
properties, and more, to be able to compile and optimize effectively. While the
|
199
|
+
:class:`~.BackendV2` class defines an interface for querying and interacting
|
200
|
+
with backends, its scope is larger than just the transpiler's needs including
|
201
|
+
managing job submission and potentially interfacing with remote services.
|
202
|
+
The specific information needed by the transpiler is described by the
|
203
|
+
:class:`~.Target` class
|
204
|
+
|
205
|
+
For example, to construct a simple :class:`~.Target` object, one can iteratively add
|
206
|
+
descriptions of the instructions it supports:
|
207
|
+
|
208
|
+
.. code-block::
|
209
|
+
|
210
|
+
from qiskit.circuit import Parameter, Measure
|
211
|
+
from qiskit.transpiler import Target, InstructionProperties
|
212
|
+
from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate
|
213
|
+
|
214
|
+
target = Target(num_qubits=3)
|
215
|
+
target.add_instruction(CXGate(), {(0, 1): InstructionProperties(error=.0001, duration=5e-7)})
|
216
|
+
target.add_instruction(
|
217
|
+
UGate(Parameter('theta'), Parameter('phi'), Parameter('lam')),
|
218
|
+
{
|
219
|
+
(0,): InstructionProperties(error=.00001, duration=5e-8),
|
220
|
+
(1,): InstructionProperties(error=.00002, duration=6e-8)
|
221
|
+
}
|
222
|
+
)
|
223
|
+
target.add_instruction(
|
224
|
+
RZGate(Parameter('theta')),
|
225
|
+
{
|
226
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
227
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
228
|
+
}
|
229
|
+
)
|
230
|
+
target.add_instruction(
|
231
|
+
RYGate(Parameter('theta')),
|
232
|
+
{
|
233
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
234
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
235
|
+
}
|
236
|
+
)
|
237
|
+
target.add_instruction(
|
238
|
+
RXGate(Parameter('theta')),
|
239
|
+
{
|
240
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
241
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
242
|
+
}
|
243
|
+
)
|
244
|
+
target.add_instruction(
|
245
|
+
CZGate(),
|
246
|
+
{
|
247
|
+
(1, 2): InstructionProperties(error=.0001, duration=5e-7),
|
248
|
+
(2, 0): InstructionProperties(error=.0001, duration=5e-7)
|
249
|
+
}
|
250
|
+
)
|
251
|
+
target.add_instruction(
|
252
|
+
Measure(),
|
253
|
+
{
|
254
|
+
(0,): InstructionProperties(error=.001, duration=5e-5),
|
255
|
+
(1,): InstructionProperties(error=.002, duration=6e-5),
|
256
|
+
(2,): InstructionProperties(error=.2, duration=5e-7)
|
257
|
+
}
|
258
|
+
)
|
259
|
+
print(target)
|
260
|
+
|
261
|
+
.. code-block:: text
|
262
|
+
|
263
|
+
Target
|
264
|
+
Number of qubits: 3
|
265
|
+
Instructions:
|
266
|
+
cx
|
267
|
+
(0, 1):
|
268
|
+
Duration: 5e-07 sec.
|
269
|
+
Error Rate: 0.0001
|
270
|
+
u
|
271
|
+
(0,):
|
272
|
+
Duration: 5e-08 sec.
|
273
|
+
Error Rate: 1e-05
|
274
|
+
(1,):
|
275
|
+
Duration: 6e-08 sec.
|
276
|
+
Error Rate: 2e-05
|
277
|
+
rz
|
278
|
+
(1,):
|
279
|
+
Duration: 5e-08 sec.
|
280
|
+
Error Rate: 1e-05
|
281
|
+
(2,):
|
282
|
+
Duration: 6e-08 sec.
|
283
|
+
Error Rate: 2e-05
|
284
|
+
ry
|
285
|
+
(1,):
|
286
|
+
Duration: 5e-08 sec.
|
287
|
+
Error Rate: 1e-05
|
288
|
+
(2,):
|
289
|
+
Duration: 6e-08 sec.
|
290
|
+
Error Rate: 2e-05
|
291
|
+
rx
|
292
|
+
(1,):
|
293
|
+
Duration: 5e-08 sec.
|
294
|
+
Error Rate: 1e-05
|
295
|
+
(2,):
|
296
|
+
Duration: 6e-08 sec.
|
297
|
+
Error Rate: 2e-05
|
298
|
+
cz
|
299
|
+
(1, 2):
|
300
|
+
Duration: 5e-07 sec.
|
301
|
+
Error Rate: 0.0001
|
302
|
+
(2, 0):
|
303
|
+
Duration: 5e-07 sec.
|
304
|
+
Error Rate: 0.0001
|
305
|
+
measure
|
306
|
+
(0,):
|
307
|
+
Duration: 5e-05 sec.
|
308
|
+
Error Rate: 0.001
|
309
|
+
(1,):
|
310
|
+
Duration: 6e-05 sec.
|
311
|
+
Error Rate: 0.002
|
312
|
+
(2,):
|
313
|
+
Duration: 5e-07 sec.
|
314
|
+
Error Rate: 0.2
|
315
|
+
|
316
|
+
This :class:`~.Target` represents a 3 qubit backend that supports :class:`~.CXGate` between qubits
|
317
|
+
0 and 1, :class:`~.UGate` on qubits 0 and 1, :class:`~.RZGate`, :class:`~.RXGate`,
|
318
|
+
and :class:`~.RYGate` on qubits 1 and 2, :class:`~.CZGate` between qubits 1 and 2, and qubits
|
319
|
+
2 and 0, and :class:`~.Measure` on all qubits.
|
320
|
+
|
321
|
+
There are also specific data structures to represent a specific subset of information from the
|
322
|
+
:class:`~.Target`. For example, the :class:`~.CouplingMap` class is used to solely represent the
|
323
|
+
connectivity constraints of a backend as a directed graph. A coupling map can be generated from
|
324
|
+
a :class:`~.Target` using the :meth:`.Target.build_coupling_map` method. These data structures
|
325
|
+
typically pre-date the :class:`~.Target` class but are still used by some transpiler passes that do
|
326
|
+
not work natively with a :class:`~.Target` instance yet or when dealing with backends that aren't
|
327
|
+
using the latest :class:`~.BackendV2` interface.
|
328
|
+
|
329
|
+
For example, if we wanted to visualize the :class:`~.CouplingMap` for the
|
330
|
+
example 3 qubit :class:`~.Target` above:
|
331
|
+
|
332
|
+
.. plot::
|
333
|
+
:include-source:
|
334
|
+
|
335
|
+
from qiskit.circuit import Parameter, Measure
|
336
|
+
from qiskit.transpiler import Target, InstructionProperties
|
337
|
+
from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate
|
338
|
+
|
339
|
+
target = Target(num_qubits=3)
|
340
|
+
target.add_instruction(CXGate(), {(0, 1): InstructionProperties(error=.0001, duration=5e-7)})
|
341
|
+
target.add_instruction(
|
342
|
+
UGate(Parameter('theta'), Parameter('phi'), Parameter('lam')),
|
343
|
+
{
|
344
|
+
(0,): InstructionProperties(error=.00001, duration=5e-8),
|
345
|
+
(1,): InstructionProperties(error=.00002, duration=6e-8)
|
346
|
+
}
|
347
|
+
)
|
348
|
+
target.add_instruction(
|
349
|
+
RZGate(Parameter('theta')),
|
350
|
+
{
|
351
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
352
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
353
|
+
}
|
354
|
+
)
|
355
|
+
target.add_instruction(
|
356
|
+
RYGate(Parameter('theta')),
|
357
|
+
{
|
358
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
359
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
360
|
+
}
|
361
|
+
)
|
362
|
+
target.add_instruction(
|
363
|
+
RXGate(Parameter('theta')),
|
364
|
+
{
|
365
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
366
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
367
|
+
}
|
368
|
+
)
|
369
|
+
target.add_instruction(
|
370
|
+
CZGate(),
|
371
|
+
{
|
372
|
+
(1, 2): InstructionProperties(error=.0001, duration=5e-7),
|
373
|
+
(2, 0): InstructionProperties(error=.0001, duration=5e-7)
|
374
|
+
}
|
375
|
+
)
|
376
|
+
target.add_instruction(
|
377
|
+
Measure(),
|
378
|
+
{
|
379
|
+
(0,): InstructionProperties(error=.001, duration=5e-5),
|
380
|
+
(1,): InstructionProperties(error=.002, duration=6e-5),
|
381
|
+
(2,): InstructionProperties(error=.2, duration=5e-7)
|
382
|
+
}
|
383
|
+
)
|
384
|
+
|
385
|
+
target.build_coupling_map().draw()
|
386
|
+
|
387
|
+
This shows the global connectivity of the :class:`~.Target` which is the
|
388
|
+
combination of the supported qubits for :class:`~.CXGate` and :class:`~.CZGate`. To
|
389
|
+
see the individual connectivity, you can pass the operation name to
|
390
|
+
:meth:`.CouplingMap.build_coupling_map`:
|
391
|
+
|
392
|
+
.. plot::
|
393
|
+
:include-source:
|
394
|
+
|
395
|
+
from qiskit.circuit import Parameter, Measure
|
396
|
+
from qiskit.transpiler import Target, InstructionProperties
|
397
|
+
from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate
|
398
|
+
|
399
|
+
target = Target(num_qubits=3)
|
400
|
+
target.add_instruction(CXGate(), {(0, 1): InstructionProperties(error=.0001, duration=5e-7)})
|
401
|
+
target.add_instruction(
|
402
|
+
UGate(Parameter('theta'), Parameter('phi'), Parameter('lam')),
|
403
|
+
{
|
404
|
+
(0,): InstructionProperties(error=.00001, duration=5e-8),
|
405
|
+
(1,): InstructionProperties(error=.00002, duration=6e-8)
|
406
|
+
}
|
407
|
+
)
|
408
|
+
target.add_instruction(
|
409
|
+
RZGate(Parameter('theta')),
|
410
|
+
{
|
411
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
412
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
413
|
+
}
|
414
|
+
)
|
415
|
+
target.add_instruction(
|
416
|
+
RYGate(Parameter('theta')),
|
417
|
+
{
|
418
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
419
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
420
|
+
}
|
421
|
+
)
|
422
|
+
target.add_instruction(
|
423
|
+
RXGate(Parameter('theta')),
|
424
|
+
{
|
425
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
426
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
427
|
+
}
|
428
|
+
)
|
429
|
+
target.add_instruction(
|
430
|
+
CZGate(),
|
431
|
+
{
|
432
|
+
(1, 2): InstructionProperties(error=.0001, duration=5e-7),
|
433
|
+
(2, 0): InstructionProperties(error=.0001, duration=5e-7)
|
434
|
+
}
|
435
|
+
)
|
436
|
+
target.add_instruction(
|
437
|
+
Measure(),
|
438
|
+
{
|
439
|
+
(0,): InstructionProperties(error=.001, duration=5e-5),
|
440
|
+
(1,): InstructionProperties(error=.002, duration=6e-5),
|
441
|
+
(2,): InstructionProperties(error=.2, duration=5e-7)
|
442
|
+
}
|
443
|
+
)
|
444
|
+
|
445
|
+
target.build_coupling_map('cx').draw()
|
446
|
+
|
447
|
+
.. plot::
|
448
|
+
:include-source:
|
449
|
+
|
450
|
+
from qiskit.circuit import Parameter, Measure
|
451
|
+
from qiskit.transpiler import Target, InstructionProperties
|
452
|
+
from qiskit.circuit.library import UGate, RZGate, RXGate, RYGate, CXGate, CZGate
|
453
|
+
|
454
|
+
target = Target(num_qubits=3)
|
455
|
+
target.add_instruction(CXGate(), {(0, 1): InstructionProperties(error=.0001, duration=5e-7)})
|
456
|
+
target.add_instruction(
|
457
|
+
UGate(Parameter('theta'), Parameter('phi'), Parameter('lam')),
|
458
|
+
{
|
459
|
+
(0,): InstructionProperties(error=.00001, duration=5e-8),
|
460
|
+
(1,): InstructionProperties(error=.00002, duration=6e-8)
|
461
|
+
}
|
462
|
+
)
|
463
|
+
target.add_instruction(
|
464
|
+
RZGate(Parameter('theta')),
|
465
|
+
{
|
466
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
467
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
468
|
+
}
|
469
|
+
)
|
470
|
+
target.add_instruction(
|
471
|
+
RYGate(Parameter('theta')),
|
472
|
+
{
|
473
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
474
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
475
|
+
}
|
476
|
+
)
|
477
|
+
target.add_instruction(
|
478
|
+
RXGate(Parameter('theta')),
|
479
|
+
{
|
480
|
+
(1,): InstructionProperties(error=.00001, duration=5e-8),
|
481
|
+
(2,): InstructionProperties(error=.00002, duration=6e-8)
|
482
|
+
}
|
483
|
+
)
|
484
|
+
target.add_instruction(
|
485
|
+
CZGate(),
|
486
|
+
{
|
487
|
+
(1, 2): InstructionProperties(error=.0001, duration=5e-7),
|
488
|
+
(2, 0): InstructionProperties(error=.0001, duration=5e-7)
|
489
|
+
}
|
490
|
+
)
|
491
|
+
target.add_instruction(
|
492
|
+
Measure(),
|
493
|
+
{
|
494
|
+
(0,): InstructionProperties(error=.001, duration=5e-5),
|
495
|
+
(1,): InstructionProperties(error=.002, duration=6e-5),
|
496
|
+
(2,): InstructionProperties(error=.2, duration=5e-7)
|
497
|
+
}
|
498
|
+
)
|
499
|
+
|
500
|
+
target.build_coupling_map('cz').draw()
|
501
|
+
|
502
|
+
.. _transpiler_stage_descriptions:
|
503
|
+
|
504
|
+
Transpiler Stage Details
|
505
|
+
========================
|
506
|
+
|
507
|
+
Below are a description of the default transpiler stages and the problems
|
508
|
+
they solve. The default passes used for each stage are described, but
|
509
|
+
the specifics are configurable via the ``*_method`` keyword arguments for
|
510
|
+
the :func:`~.transpile` and :func:`~.generate_preset_pass_manager` functions
|
511
|
+
which can be used to override the methods described in this section.
|
512
|
+
|
513
|
+
.. _translation_stage:
|
514
|
+
|
515
|
+
Translation Stage
|
516
|
+
-----------------
|
517
|
+
|
518
|
+
When writing a quantum circuit you are free to use any quantum gate (unitary operator) that
|
519
|
+
you like, along with a collection of non-gate operations such as qubit measurements and
|
520
|
+
reset operations. However, most quantum devices only natively support a handful of quantum gates
|
521
|
+
and non-gate operations. The allowed instructions for a given backend can be found by querying the
|
522
|
+
:class:`~.Target` for the devices:
|
523
|
+
|
524
|
+
.. code-block::
|
525
|
+
|
526
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
527
|
+
backend = GenericBackendV2(5)
|
528
|
+
|
529
|
+
print(backend.target)
|
530
|
+
|
531
|
+
Every quantum circuit run on the target device must be expressed using only these instructions.
|
532
|
+
For example, to run a simple phase estimation circuit:
|
533
|
+
|
534
|
+
.. plot::
|
535
|
+
:include-source:
|
536
|
+
|
537
|
+
import numpy as np
|
538
|
+
from qiskit import QuantumCircuit
|
539
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
540
|
+
|
541
|
+
backend = GenericBackendV2(5)
|
542
|
+
|
543
|
+
qc = QuantumCircuit(2, 1)
|
544
|
+
|
545
|
+
qc.h(0)
|
546
|
+
qc.x(1)
|
547
|
+
qc.cp(np.pi/4, 0, 1)
|
548
|
+
qc.h(0)
|
549
|
+
qc.measure([0], [0])
|
550
|
+
qc.draw(output='mpl')
|
551
|
+
|
552
|
+
We have :math:`H`, :math:`X`, and controlled-:math:`P` gates, none of which are
|
553
|
+
in our device's basis gate set, and thus must be translated.
|
554
|
+
We can
|
555
|
+
transpile the circuit to show what it will look like in the native gate set of
|
556
|
+
the target IBM Quantum device (the :class:`~.GenericBackendV2` class generates
|
557
|
+
a fake backend with a specified number of qubits for test purposes):
|
558
|
+
|
559
|
+
.. plot::
|
560
|
+
:include-source:
|
561
|
+
|
562
|
+
from qiskit import transpile
|
563
|
+
from qiskit import QuantumCircuit
|
564
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
565
|
+
|
566
|
+
backend = GenericBackendV2(5)
|
567
|
+
|
568
|
+
qc = QuantumCircuit(2, 1)
|
569
|
+
|
570
|
+
qc.h(0)
|
571
|
+
qc.x(1)
|
572
|
+
qc.cp(np.pi/4, 0, 1)
|
573
|
+
qc.h(0)
|
574
|
+
qc.measure([0], [0])
|
575
|
+
|
576
|
+
qc_basis = transpile(qc, backend)
|
577
|
+
qc_basis.draw(output='mpl')
|
578
|
+
|
579
|
+
A few things to highlight. First, the circuit has gotten longer with respect to the
|
580
|
+
original. This can be verified by checking the depth of both circuits:
|
581
|
+
|
582
|
+
.. code-block::
|
583
|
+
|
584
|
+
print('Original depth:', qc.depth(), 'Decomposed Depth:', qc_basis.depth())
|
585
|
+
|
586
|
+
.. code-block:: text
|
587
|
+
|
588
|
+
Original depth: 4 Decomposed Depth: 10
|
589
|
+
|
590
|
+
Second, although we had a single controlled gate, the fact that it was not in the basis
|
591
|
+
set means that, when expanded, it requires more than a single :class:`~.CXGate` to implement.
|
592
|
+
All said, unrolling to the basis set of gates leads to an increase in the depth of a
|
593
|
+
quantum circuit and the number of gates.
|
594
|
+
|
595
|
+
It is important to highlight two special cases:
|
596
|
+
|
597
|
+
1. If A swap gate is not a native gate and must be decomposed this requires three CNOT gates:
|
598
|
+
|
599
|
+
.. code-block::
|
600
|
+
|
601
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
602
|
+
backend = GenericBackendV2(5)
|
603
|
+
|
604
|
+
print(backend.operation_names)
|
605
|
+
|
606
|
+
.. code-block:: text
|
607
|
+
|
608
|
+
['id', 'rz', 'sx', 'x', 'cx', 'measure', 'delay']
|
609
|
+
|
610
|
+
.. plot:
|
611
|
+
:include-source:
|
612
|
+
|
613
|
+
from qiskit.circuit import QuantumCircuit
|
614
|
+
|
615
|
+
swap_circ = QuantumCircuit(2)
|
616
|
+
swap_circ.swap(0, 1)
|
617
|
+
swap_circ.decompose().draw(output='mpl')
|
618
|
+
|
619
|
+
As a product of three CNOT gates, swap gates are expensive operations to perform on
|
620
|
+
noisy quantum devices. However, such operations are usually necessary for embedding a
|
621
|
+
circuit into the limited gate connectivities of many devices. Thus,
|
622
|
+
minimizing the number of swap gates in a circuit is a primary goal in the
|
623
|
+
transpilation process.
|
624
|
+
|
625
|
+
|
626
|
+
2. A Toffoli, or controlled-controlled-not gate (``ccx``), is a three-qubit gate. Given
|
627
|
+
that our basis gate set includes only single- and two-qubit gates, it is obvious that
|
628
|
+
this gate must be decomposed. This decomposition is quite costly:
|
629
|
+
|
630
|
+
.. plot::
|
631
|
+
:include-source:
|
632
|
+
|
633
|
+
from qiskit.circuit import QuantumCircuit
|
634
|
+
|
635
|
+
ccx_circ = QuantumCircuit(3)
|
636
|
+
ccx_circ.ccx(0, 1, 2)
|
637
|
+
ccx_circ.decompose().draw(output='mpl')
|
638
|
+
|
639
|
+
For every Toffoli gate in a quantum circuit, the hardware may execute up to six CNOT
|
640
|
+
gates, and a handful of single-qubit gates. From this example, it should be
|
641
|
+
clear that any algorithm that makes use of multiple Toffoli gates will end up as a
|
642
|
+
circuit with large depth and will therefore be appreciably affected by noise and gate
|
643
|
+
errors.
|
644
|
+
|
645
|
+
|
646
|
+
.. _layout_stage:
|
647
|
+
|
648
|
+
Layout Stage
|
649
|
+
------------
|
650
|
+
|
651
|
+
Quantum circuits are abstract entities whose qubits are "virtual" representations of actual
|
652
|
+
qubits used in computations. We need to be able to map these virtual qubits in a one-to-one
|
653
|
+
manner to the "physical" qubits in an actual quantum device.
|
654
|
+
|
655
|
+
.. image:: /source_images/mapping.png
|
656
|
+
|
657
|
+
|
658
|
+
By default, qiskit will do this mapping for you. The choice of mapping depends on the
|
659
|
+
properties of the circuit, the particular device you are targeting, and the optimization
|
660
|
+
level that is chosen. The choice of initial layout is extremely important for minimizing the
|
661
|
+
number of swap operations needed to map the input circuit onto the device topology and
|
662
|
+
for minimizing the loss due to non-uniform noise properties across a device. Due to the
|
663
|
+
importance of this stage, the preset pass managers
|
664
|
+
try a few different methods to find the best layout. Typically this involves 2 steps: first,
|
665
|
+
trying to find a "perfect" layout (a layout which does not require any swap operations), and then,
|
666
|
+
a heuristic pass that tries to find the best layout to use if a perfect layout cannot be found.
|
667
|
+
There are 2 passes typically used for the first stage:
|
668
|
+
|
669
|
+
- :class:`~.VF2Layout`: Models layout selection as a subgraph isomorphism problem and tries
|
670
|
+
to find a subgraph of the connectivity graph that is isomorphic to the
|
671
|
+
graph of 2 qubit interactions in the circuit. If more than one isomorphic mapping is found a
|
672
|
+
scoring heuristic is run to select the mapping which would result in the lowest average error
|
673
|
+
when executing the circuit.
|
674
|
+
|
675
|
+
- :class:`~.TrivialLayout`: Maps each virtual qubit to the same numbered physical qubit on the device,
|
676
|
+
i.e. ``[0,1,2,3,4]`` -> ``[0,1,2,3,4]``. This is historical behavior used only in
|
677
|
+
``optimization_level=1`` to try to find a perfect layout. If it fails to do so, :class:`~.VF2Layout`
|
678
|
+
is tried next.
|
679
|
+
|
680
|
+
Next, for the heuristic stage, 2 passes are used by default:
|
681
|
+
|
682
|
+
- :class:`~.SabreLayout`: Selects a layout by starting from an initial random layout and then
|
683
|
+
repeatedly running a routing algorithm (by default :class:`~.SabreSwap`) both forward and
|
684
|
+
backward over the circuit, using the permutation caused by swap insertions to adjust that
|
685
|
+
initial random layout. For more details you can refer to the paper describing the algorithm:
|
686
|
+
`arXiv:1809.02573 <https://arxiv.org/abs/1809.02573>`__
|
687
|
+
:class:`~.SabreLayout` is used to select a layout if a perfect layout isn't found for
|
688
|
+
optimization levels 1, 2, and 3.
|
689
|
+
- :class:`~.TrivialLayout`: Always used for the layout at optimization level 0.
|
690
|
+
|
691
|
+
There are other passes than can be used for the heuristic stage, but are not included in the default
|
692
|
+
pipeline, such as:
|
693
|
+
|
694
|
+
- :class:`~.DenseLayout`: Finds the sub-graph of the device with greatest connectivity
|
695
|
+
that has the same number of qubits as the circuit.
|
696
|
+
|
697
|
+
Let's see what layouts are automatically picked at various optimization levels. The circuits
|
698
|
+
returned by :func:`qiskit.compiler.transpile` are annotated with this initial layout information,
|
699
|
+
and we can view this layout selection graphically using
|
700
|
+
:func:`qiskit.visualization.plot_circuit_layout`:
|
701
|
+
|
702
|
+
.. plot::
|
703
|
+
:include-source:
|
704
|
+
|
705
|
+
from qiskit import QuantumCircuit, transpile
|
706
|
+
from qiskit.visualization import plot_circuit_layout
|
707
|
+
from qiskit.providers.fake_provider import Fake5QV1
|
708
|
+
backend = Fake5QV1()
|
709
|
+
|
710
|
+
ghz = QuantumCircuit(3, 3)
|
711
|
+
ghz.h(0)
|
712
|
+
ghz.cx(0,range(1,3))
|
713
|
+
ghz.barrier()
|
714
|
+
ghz.measure(range(3), range(3))
|
715
|
+
ghz.draw(output='mpl')
|
716
|
+
|
717
|
+
|
718
|
+
- **Layout Using Optimization Level 0**
|
719
|
+
|
720
|
+
.. plot::
|
721
|
+
:include-source:
|
722
|
+
|
723
|
+
from qiskit import QuantumCircuit, transpile
|
724
|
+
from qiskit.visualization import plot_circuit_layout
|
725
|
+
from qiskit.providers.fake_provider import Fake5QV1
|
726
|
+
backend = Fake5QV1()
|
727
|
+
|
728
|
+
ghz = QuantumCircuit(3, 3)
|
729
|
+
ghz.h(0)
|
730
|
+
ghz.cx(0,range(1,3))
|
731
|
+
ghz.barrier()
|
732
|
+
ghz.measure(range(3), range(3))
|
733
|
+
|
734
|
+
new_circ_lv0 = transpile(ghz, backend=backend, optimization_level=0)
|
735
|
+
plot_circuit_layout(new_circ_lv0, backend)
|
736
|
+
|
737
|
+
- **Layout Using Optimization Level 3**
|
738
|
+
|
739
|
+
.. plot::
|
740
|
+
:include-source:
|
741
|
+
|
742
|
+
from qiskit import QuantumCircuit, transpile
|
743
|
+
from qiskit.visualization import plot_circuit_layout
|
744
|
+
from qiskit.providers.fake_provider import Fake5QV1
|
745
|
+
backend = Fake5QV1()
|
746
|
+
|
747
|
+
ghz = QuantumCircuit(3, 3)
|
748
|
+
ghz.h(0)
|
749
|
+
ghz.cx(0,range(1,3))
|
750
|
+
ghz.barrier()
|
751
|
+
ghz.measure(range(3), range(3))
|
752
|
+
|
753
|
+
new_circ_lv3 = transpile(ghz, backend=backend, optimization_level=3)
|
754
|
+
plot_circuit_layout(new_circ_lv3, backend)
|
755
|
+
|
756
|
+
|
757
|
+
It is possible to override automatic layout selection by specifying an initial layout. To do so we can
|
758
|
+
pass a list of integers to :func:`qiskit.compiler.transpile` via the `initial_layout`
|
759
|
+
keyword argument, where the index labels the virtual qubit in the circuit and the
|
760
|
+
corresponding value is the label for the physical qubit to map onto:
|
761
|
+
|
762
|
+
.. plot::
|
763
|
+
:include-source:
|
764
|
+
|
765
|
+
from qiskit import QuantumCircuit, transpile
|
766
|
+
from qiskit.visualization import plot_circuit_layout
|
767
|
+
from qiskit.providers.fake_provider import Fake5QV1
|
768
|
+
backend = Fake5QV1()
|
769
|
+
|
770
|
+
ghz = QuantumCircuit(3, 3)
|
771
|
+
ghz.h(0)
|
772
|
+
ghz.cx(0,range(1,3))
|
773
|
+
ghz.barrier()
|
774
|
+
ghz.measure(range(3), range(3))
|
775
|
+
|
776
|
+
# Virtual -> physical
|
777
|
+
# 0 -> 3
|
778
|
+
# 1 -> 4
|
779
|
+
# 2 -> 2
|
780
|
+
|
781
|
+
my_ghz = transpile(ghz, backend, initial_layout=[3, 4, 2])
|
782
|
+
plot_circuit_layout(my_ghz, backend)
|
783
|
+
|
784
|
+
.. _routing_stage:
|
785
|
+
|
786
|
+
Routing Stage
|
787
|
+
-------------
|
788
|
+
|
789
|
+
In order to implement a 2-qubit gate between qubits in a quantum circuit that are not directly
|
790
|
+
connected on a quantum device, one or more swap gates must be inserted into the circuit to
|
791
|
+
move the qubit states around until they are adjacent on the device gate map. Each swap
|
792
|
+
gate typically represents an expensive and noisy operation to perform. Thus, finding the
|
793
|
+
minimum number of swap gates needed to map a circuit onto a given device, is an important
|
794
|
+
step (if not the most important) in the whole execution process.
|
795
|
+
|
796
|
+
However, as with many important things in life, finding the optimal swap mapping is hard.
|
797
|
+
In fact it is in a class of problems called NP-hard, and is thus prohibitively expensive
|
798
|
+
to compute for all but the smallest quantum devices and input circuits. To get around this,
|
799
|
+
by default Qiskit uses a stochastic heuristic algorithm called :class:`~.SabreSwap` to compute
|
800
|
+
a good, but not necessarily optimal swap mapping. The use of a stochastic method means the
|
801
|
+
circuits generated by :func:`~.transpile`
|
802
|
+
are not guaranteed to be the same over repeated runs. Indeed, running the same
|
803
|
+
circuit repeatedly will in general result in a distribution of circuit depths and gate counts
|
804
|
+
at the output.
|
805
|
+
|
806
|
+
In order to highlight this, we run a GHZ circuit 100 times, using a "bad" (disconnected)
|
807
|
+
``initial_layout`` in a heavy hex coupling map:
|
808
|
+
|
809
|
+
.. plot::
|
810
|
+
|
811
|
+
from qiskit import QuantumCircuit, transpile
|
812
|
+
|
813
|
+
ghz = QuantumCircuit(15)
|
814
|
+
ghz.h(0)
|
815
|
+
ghz.cx(0, range(1, 15))
|
816
|
+
ghz.draw(output='mpl')
|
817
|
+
|
818
|
+
.. plot::
|
819
|
+
:include-source:
|
820
|
+
|
821
|
+
import matplotlib.pyplot as plt
|
822
|
+
from qiskit import QuantumCircuit, transpile
|
823
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
824
|
+
from qiskit.transpiler import CouplingMap
|
825
|
+
|
826
|
+
coupling_map = CouplingMap.from_heavy_hex(3)
|
827
|
+
backend = GenericBackendV2(coupling_map.size(), coupling_map=coupling_map)
|
828
|
+
|
829
|
+
ghz = QuantumCircuit(15)
|
830
|
+
ghz.h(0)
|
831
|
+
ghz.cx(0, range(1, 15))
|
832
|
+
|
833
|
+
depths = []
|
834
|
+
for i in range(100):
|
835
|
+
depths.append(
|
836
|
+
transpile(
|
837
|
+
ghz,
|
838
|
+
backend,
|
839
|
+
seed_transpiler=i,
|
840
|
+
layout_method='trivial' # Fixed layout mapped in circuit order
|
841
|
+
).depth()
|
842
|
+
)
|
843
|
+
|
844
|
+
plt.figure(figsize=(8, 6))
|
845
|
+
plt.hist(depths, align='left', color='#AC557C')
|
846
|
+
plt.xlabel('Depth', fontsize=14)
|
847
|
+
plt.ylabel('Counts', fontsize=14);
|
848
|
+
|
849
|
+
|
850
|
+
This distribution is quite wide, signaling the difficulty the swap mapper is having
|
851
|
+
in computing the best mapping. Most circuits will have a distribution of depths,
|
852
|
+
perhaps not as wide as this one, due to the stochastic nature of the default swap
|
853
|
+
mapper. Of course, we want the best circuit we can get, especially in cases where
|
854
|
+
the depth is critical to success or failure. The :class:`~.SabreSwap` pass will by default by run its
|
855
|
+
algorithm in parallel with multiple seed values and select the output which
|
856
|
+
uses the fewest swaps. If you would like to increase the number of trials
|
857
|
+
:class:`~.SabreSwap` runs you can refer to :ref:`working_with_preset_pass_managers`
|
858
|
+
and modify the ``routing`` stage with a custom instance of :class:`~.SabreSwap`
|
859
|
+
with a larger value for the ``trials`` argument.
|
860
|
+
|
861
|
+
Typically, following the swap mapper, the routing stage in the preset pass managers
|
862
|
+
also includes running the :class:`~.VF2PostLayout` pass. As its name implies,
|
863
|
+
:class:`~.VF2PostLayout` uses the same basic algorithm as :class:`~.VF2Layout`,
|
864
|
+
but instead of using it to find a perfect initial layout, it is designed to run after
|
865
|
+
mapping and try to find a layout on qubits with lower error rates which will
|
866
|
+
result in better output fidelity when running the circuit. The details of this
|
867
|
+
algorithm are described in `arXiv:2209.15512 <https://arxiv.org/abs/2209.15512>`__.
|
868
|
+
|
869
|
+
.. _optimization_stage:
|
870
|
+
|
871
|
+
Optimization Stage
|
872
|
+
------------------
|
873
|
+
|
874
|
+
Decomposing quantum circuits into the basis gate set of the target device,
|
875
|
+
and the addition of swap gates needed to match hardware topology, conspire to
|
876
|
+
increase the depth and gate count of quantum circuits. Fortunately many routines
|
877
|
+
for optimizing circuits by combining or eliminating gates exist. In some cases
|
878
|
+
these methods are so effective the output circuits have lower depth than the inputs.
|
879
|
+
In other cases, not much can be done, and the computation may be difficult to
|
880
|
+
perform on noisy devices. Different gate optimizations are turned on with
|
881
|
+
different ``optimization_level`` values. Below we show the benefits gained from
|
882
|
+
setting the optimization level higher:
|
883
|
+
|
884
|
+
.. important::
|
885
|
+
|
886
|
+
The output from :func:`.transpile` varies due to the stochastic swap mapper.
|
887
|
+
So the numbers below will likely change each time you run the code.
|
888
|
+
|
889
|
+
|
890
|
+
.. plot::
|
891
|
+
|
892
|
+
import matplotlib.pyplot as plt
|
893
|
+
from qiskit import QuantumCircuit, transpile
|
894
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
895
|
+
backend = GenericBackendV2(16)
|
896
|
+
|
897
|
+
ghz = QuantumCircuit(15)
|
898
|
+
ghz.h(0)
|
899
|
+
ghz.cx(0, range(1, 15))
|
900
|
+
ghz.draw(output='mpl')
|
901
|
+
|
902
|
+
.. plot::
|
903
|
+
:include-source:
|
904
|
+
|
905
|
+
import matplotlib.pyplot as plt
|
906
|
+
from qiskit import QuantumCircuit, transpile
|
907
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
908
|
+
backend = GenericBackendV2(16)
|
909
|
+
|
910
|
+
ghz = QuantumCircuit(15)
|
911
|
+
ghz.h(0)
|
912
|
+
ghz.cx(0, range(1, 15))
|
913
|
+
|
914
|
+
depths = []
|
915
|
+
gate_counts = []
|
916
|
+
non_local_gate_counts = []
|
917
|
+
levels = [str(x) for x in range(4)]
|
918
|
+
for level in range(4):
|
919
|
+
circ = transpile(ghz, backend, optimization_level=level)
|
920
|
+
depths.append(circ.depth())
|
921
|
+
gate_counts.append(sum(circ.count_ops().values()))
|
922
|
+
non_local_gate_counts.append(circ.num_nonlocal_gates())
|
923
|
+
fig, (ax1, ax2) = plt.subplots(2, 1)
|
924
|
+
ax1.bar(levels, depths, label='Depth')
|
925
|
+
ax1.set_xlabel("Optimization Level")
|
926
|
+
ax1.set_ylabel("Depth")
|
927
|
+
ax1.set_title("Output Circuit Depth")
|
928
|
+
ax2.bar(levels, gate_counts, label='Number of Circuit Operations')
|
929
|
+
ax2.bar(levels, non_local_gate_counts, label='Number of non-local gates')
|
930
|
+
ax2.set_xlabel("Optimization Level")
|
931
|
+
ax2.set_ylabel("Number of gates")
|
932
|
+
ax2.legend()
|
933
|
+
ax2.set_title("Number of output circuit gates")
|
934
|
+
fig.tight_layout()
|
935
|
+
plt.show()
|
936
|
+
|
937
|
+
.. _scheduling_stage:
|
938
|
+
|
939
|
+
Scheduling Stage
|
940
|
+
----------------
|
941
|
+
|
942
|
+
After the circuit has been translated to the target basis, mapped to the device, and optimized,
|
943
|
+
a scheduling phase can be applied to optionally account for all the idle time in the circuit.
|
944
|
+
At a high level, the scheduling can be thought of as inserting delays into the circuit to account
|
945
|
+
for idle time on the qubits between the execution of instructions. For example, if we start with a
|
946
|
+
circuit such as:
|
947
|
+
|
948
|
+
.. plot::
|
949
|
+
|
950
|
+
from qiskit import QuantumCircuit
|
951
|
+
|
952
|
+
ghz = QuantumCircuit(5)
|
953
|
+
ghz.h(0)
|
954
|
+
ghz.cx(0,range(1,5))
|
955
|
+
ghz.draw(output='mpl')
|
956
|
+
|
957
|
+
we can then call :func:`~.transpile` on it with ``scheduling_method`` set:
|
958
|
+
|
959
|
+
.. plot::
|
960
|
+
:include-source:
|
961
|
+
|
962
|
+
from qiskit import QuantumCircuit, transpile
|
963
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
964
|
+
|
965
|
+
backend = GenericBackendV2(5)
|
966
|
+
|
967
|
+
ghz = QuantumCircuit(5)
|
968
|
+
ghz.h(0)
|
969
|
+
ghz.cx(0,range(1,5))
|
970
|
+
|
971
|
+
circ = transpile(ghz, backend, scheduling_method="asap")
|
972
|
+
circ.draw(output='mpl')
|
973
|
+
|
974
|
+
You can see here that the transpiler inserted :class:`~qiskit.circuit.Delay` instructions to
|
975
|
+
account for idle time on each qubit. To get a better idea of the timing of the circuit we can
|
976
|
+
also look at it with the :func:`.timeline.draw` function:
|
977
|
+
|
978
|
+
.. plot::
|
979
|
+
|
980
|
+
from qiskit.visualization.timeline import draw as timeline_draw
|
981
|
+
|
982
|
+
from qiskit import QuantumCircuit, transpile
|
983
|
+
from qiskit.providers.fake_provider import GenericBackendV2
|
984
|
+
|
985
|
+
backend = GenericBackendV2(5)
|
986
|
+
|
987
|
+
ghz = QuantumCircuit(5)
|
988
|
+
ghz.h(0)
|
989
|
+
ghz.cx(0,range(1,5))
|
990
|
+
|
991
|
+
circ = transpile(ghz, backend, scheduling_method="asap")
|
992
|
+
|
993
|
+
timeline_draw(circ)
|
994
|
+
|
995
|
+
The scheduling of a circuit involves two parts: analysis and constraint mapping, followed by a
|
996
|
+
padding pass. The first part requires running a scheduling analysis pass such as
|
997
|
+
:class:`~.ALAPSchedulingAnalysis` or :class:`~.ASAPSchedulingAnalysis` which analyzes the circuit
|
998
|
+
and records the start time of each instruction in the circuit using a scheduling algorithm ("as late
|
999
|
+
as possible" for :class:`~.ALAPSchedulingAnalysis` and "as soon as possible" for
|
1000
|
+
:class:`~.ASAPSchedulingAnalysis`) in the property set. Once the circuit has an initial scheduling,
|
1001
|
+
additional passes can be run to account for any timing constraints on the target backend, such
|
1002
|
+
as alignment constraints. This is typically done with the
|
1003
|
+
:class:`~.ConstrainedReschedule` pass which will adjust the scheduling
|
1004
|
+
set in the property set to the constraints of the target backend. Once all
|
1005
|
+
the scheduling and adjustments/rescheduling are finished, a padding pass,
|
1006
|
+
such as :class:`~.PadDelay` or :class:`~.PadDynamicalDecoupling` is run
|
1007
|
+
to insert the instructions into the circuit, which completes the scheduling.
|
1008
|
+
|
1009
|
+
Scheduling Analysis with control flow instructions
|
1010
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
1011
|
+
|
1012
|
+
When running scheduling analysis passes on a circuit, you must keep in mind that there
|
1013
|
+
are additional constraints on classical conditions and control flow instructions. This section
|
1014
|
+
covers the details of these additional
|
1015
|
+
constraints that any scheduling pass will need to account for.
|
1016
|
+
|
1017
|
+
Topological node ordering in scheduling
|
1018
|
+
''''''''''''''''''''''''''''''''''''''''
|
1019
|
+
|
1020
|
+
The DAG representation of ``QuantumCircuit`` respects the node ordering in the
|
1021
|
+
classical register wires, though theoretically two conditional instructions
|
1022
|
+
conditioned on the same register could commute, i.e. read-access to the
|
1023
|
+
classical register doesn't change its state.
|
1024
|
+
|
1025
|
+
.. code-block:: text
|
1026
|
+
|
1027
|
+
qc = QuantumCircuit(2, 1)
|
1028
|
+
qc.delay(100, 0)
|
1029
|
+
qc.x(0).c_if(0, True)
|
1030
|
+
qc.x(1).c_if(0, True)
|
1031
|
+
|
1032
|
+
The scheduler SHOULD comply with the above topological ordering policy of the
|
1033
|
+
DAG circuit.
|
1034
|
+
Accordingly, the `asap`-scheduled circuit will become
|
1035
|
+
|
1036
|
+
.. code-block:: text
|
1037
|
+
|
1038
|
+
┌────────────────┐ ┌───┐
|
1039
|
+
q_0: ┤ Delay(100[dt]) ├───┤ X ├──────────────
|
1040
|
+
├────────────────┤ └─╥─┘ ┌───┐
|
1041
|
+
q_1: ┤ Delay(100[dt]) ├─────╫────────┤ X ├───
|
1042
|
+
└────────────────┘ ║ └─╥─┘
|
1043
|
+
┌────╨────┐┌────╨────┐
|
1044
|
+
c: 1/══════════════════╡ c_0=0x1 ╞╡ c_0=0x1 ╞
|
1045
|
+
└─────────┘└─────────┘
|
1046
|
+
|
1047
|
+
Note that this scheduling might be inefficient in some cases,
|
1048
|
+
because the second conditional operation could start without waiting
|
1049
|
+
for the 100 dt delay.
|
1050
|
+
However, any additional optimization should be done in a different pass,
|
1051
|
+
not to break the topological ordering of the original circuit.
|
1052
|
+
|
1053
|
+
Realistic control flow scheduling (respecting microarchitecture)
|
1054
|
+
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
1055
|
+
|
1056
|
+
In the dispersive QND readout scheme, the qubit (Q) is measured by sending
|
1057
|
+
a microwave stimulus, followed by a resonator ring-down (depopulation). This
|
1058
|
+
microwave signal is recorded in the buffer memory (B) with the hardware kernel,
|
1059
|
+
then a discriminated (D) binary value is moved to the classical register (C).
|
1060
|
+
A sequence from t0 to t1 of the measure instruction interval could be
|
1061
|
+
modeled as follows:
|
1062
|
+
|
1063
|
+
.. code-block:: text
|
1064
|
+
|
1065
|
+
Q ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1066
|
+
B ░░▒▒▒▒▒▒▒▒░░░░░░░░░
|
1067
|
+
D ░░░░░░░░░░▒▒▒▒▒▒░░░
|
1068
|
+
C ░░░░░░░░░░░░░░░░▒▒░
|
1069
|
+
|
1070
|
+
However, the :class:`.QuantumCircuit` representation is not accurate enough to represent
|
1071
|
+
this model. In the circuit representation, the corresponding :class:`.circuit.Qubit` is occupied
|
1072
|
+
by the stimulus microwave signal during the first half of the interval,
|
1073
|
+
and the :class:`.Clbit` is only occupied at the very end of the interval.
|
1074
|
+
|
1075
|
+
The lack of precision representing the physical model may induce
|
1076
|
+
edge cases in the scheduling:
|
1077
|
+
|
1078
|
+
.. code-block:: text
|
1079
|
+
|
1080
|
+
┌───┐
|
1081
|
+
q_0: ───┤ X ├──────
|
1082
|
+
└─╥─┘ ┌─┐
|
1083
|
+
q_1: ─────╫─────┤M├
|
1084
|
+
┌────╨────┐└╥┘
|
1085
|
+
c: 1/╡ c_0=0x1 ╞═╩═
|
1086
|
+
└─────────┘ 0
|
1087
|
+
|
1088
|
+
In this example, a user may intend to measure the state of ``q_1`` after the
|
1089
|
+
:class:`.XGate` is applied to ``q_0``. This is the correct interpretation from
|
1090
|
+
the viewpoint of topological node ordering, i.e. The :class:`.XGate` node comes in
|
1091
|
+
front of the :class:`.Measure` node.
|
1092
|
+
However, according to the measurement model above, the data in the register
|
1093
|
+
is unchanged during the application of the stimulus, so two nodes are
|
1094
|
+
simultaneously operated.
|
1095
|
+
If one tries to `alap`-schedule this circuit, it may return following circuit:
|
1096
|
+
|
1097
|
+
.. code-block:: text
|
1098
|
+
|
1099
|
+
┌────────────────┐ ┌───┐
|
1100
|
+
q_0: ┤ Delay(500[dt]) ├───┤ X ├──────
|
1101
|
+
└────────────────┘ └─╥─┘ ┌─┐
|
1102
|
+
q_1: ───────────────────────╫─────┤M├
|
1103
|
+
┌────╨────┐└╥┘
|
1104
|
+
c: 1/══════════════════╡ c_0=0x1 ╞═╩═
|
1105
|
+
└─────────┘ 0
|
1106
|
+
|
1107
|
+
Note that there is no delay on the ``q_1`` wire, and the measure instruction
|
1108
|
+
immediately starts after t=0, while the conditional gate starts after the delay.
|
1109
|
+
It looks like the topological ordering between the nodes is flipped in the
|
1110
|
+
scheduled view.
|
1111
|
+
This behavior can be understood by considering the control flow model described above,
|
1112
|
+
|
1113
|
+
.. code-block:: text
|
1114
|
+
|
1115
|
+
: Quantum Circuit, first-measure
|
1116
|
+
0 ░░░░░░░░░░░░▒▒▒▒▒▒░
|
1117
|
+
1 ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1118
|
+
|
1119
|
+
: In wire q0
|
1120
|
+
Q ░░░░░░░░░░░░░░░▒▒▒░
|
1121
|
+
C ░░░░░░░░░░░░▒▒░░░░░
|
1122
|
+
|
1123
|
+
: In wire q1
|
1124
|
+
Q ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1125
|
+
B ░░▒▒▒▒▒▒▒▒░░░░░░░░░
|
1126
|
+
D ░░░░░░░░░░▒▒▒▒▒▒░░░
|
1127
|
+
C ░░░░░░░░░░░░░░░░▒▒░
|
1128
|
+
|
1129
|
+
Since there is no qubit register overlap between Q0 and Q1, the node ordering is
|
1130
|
+
determined by the shared classical register C. As you can see, the execution order is still
|
1131
|
+
preserved on C, i.e. read C then apply ``XGate``, finally store the measured outcome in C.
|
1132
|
+
But because ``DAGOpNode`` cannot define different durations for the associated registers,
|
1133
|
+
the time ordering of the two nodes is inverted.
|
1134
|
+
|
1135
|
+
This behavior can be controlled by ``clbit_write_latency`` and ``conditional_latency``.
|
1136
|
+
``clbit_write_latency`` determines the delay of the register write-access from
|
1137
|
+
the beginning of the measure instruction (t0), while ``conditional_latency`` determines
|
1138
|
+
the delay of conditional gate operations with respect to t0, which is determined
|
1139
|
+
by the register read-access.
|
1140
|
+
This information is accessible in the backend configuration and should
|
1141
|
+
be copied to the pass manager property set before the pass is called.
|
1142
|
+
|
1143
|
+
Due to default latencies, the `alap`-scheduled circuit of above example may become
|
1144
|
+
|
1145
|
+
.. code-block:: text
|
1146
|
+
|
1147
|
+
┌───┐
|
1148
|
+
q_0: ───┤ X ├──────
|
1149
|
+
└─╥─┘ ┌─┐
|
1150
|
+
q_1: ─────╫─────┤M├
|
1151
|
+
┌────╨────┐└╥┘
|
1152
|
+
c: 1/╡ c_0=0x1 ╞═╩═
|
1153
|
+
└─────────┘ 0
|
1154
|
+
|
1155
|
+
If the backend microarchitecture supports smart scheduling of the control flow
|
1156
|
+
instructions, such as separately scheduling qubits and classical registers,
|
1157
|
+
the insertion of the delay yields an unnecessarily longer total execution time.
|
1158
|
+
|
1159
|
+
.. code-block:: text
|
1160
|
+
|
1161
|
+
: Quantum Circuit, first-XGate
|
1162
|
+
0 ░▒▒▒░░░░░░░░░░░░░░░
|
1163
|
+
1 ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1164
|
+
|
1165
|
+
: In wire q0
|
1166
|
+
Q ░▒▒▒░░░░░░░░░░░░░░░
|
1167
|
+
C ░░░░░░░░░░░░░░░░░░░ (zero latency)
|
1168
|
+
|
1169
|
+
: In wire q1
|
1170
|
+
Q ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1171
|
+
C ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░ (zero latency, scheduled after C0 read-access)
|
1172
|
+
|
1173
|
+
However, this result is much more intuitive in the topological ordering view.
|
1174
|
+
If a finite conditional latency value is provided, for example, 30 dt, the circuit
|
1175
|
+
is scheduled as follows:
|
1176
|
+
|
1177
|
+
.. code-block:: text
|
1178
|
+
|
1179
|
+
┌───────────────┐ ┌───┐
|
1180
|
+
q_0: ┤ Delay(30[dt]) ├───┤ X ├──────
|
1181
|
+
├───────────────┤ └─╥─┘ ┌─┐
|
1182
|
+
q_1: ┤ Delay(30[dt]) ├─────╫─────┤M├
|
1183
|
+
└───────────────┘┌────╨────┐└╥┘
|
1184
|
+
c: 1/═════════════════╡ c_0=0x1 ╞═╩═
|
1185
|
+
└─────────┘ 0
|
1186
|
+
|
1187
|
+
with the timing model:
|
1188
|
+
|
1189
|
+
.. code-block:: text
|
1190
|
+
|
1191
|
+
: Quantum Circuit, first-xgate
|
1192
|
+
0 ░░▒▒▒░░░░░░░░░░░░░░░
|
1193
|
+
1 ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1194
|
+
|
1195
|
+
: In wire q0
|
1196
|
+
Q ░░▒▒▒░░░░░░░░░░░░░░░
|
1197
|
+
C ░▒░░░░░░░░░░░░░░░░░░ (30dt latency)
|
1198
|
+
|
1199
|
+
: In wire q1
|
1200
|
+
Q ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1201
|
+
C ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░
|
1202
|
+
|
1203
|
+
See https://arxiv.org/abs/2102.01682 for more details.
|
1204
|
+
|
1205
|
+
Transpiler API
|
1206
|
+
==============
|
1207
|
+
|
1208
|
+
Transpiler Target
|
1209
|
+
-----------------
|
1210
|
+
|
1211
|
+
.. autosummary::
|
1212
|
+
:toctree: ../stubs/
|
1213
|
+
|
1214
|
+
Target
|
1215
|
+
InstructionProperties
|
1216
|
+
|
1217
|
+
Pass Manager Construction
|
1218
|
+
-------------------------
|
1219
|
+
|
1220
|
+
.. autosummary::
|
1221
|
+
:toctree: ../stubs/
|
1222
|
+
|
1223
|
+
StagedPassManager
|
1224
|
+
PassManager
|
1225
|
+
PassManagerConfig
|
1226
|
+
|
1227
|
+
Layout and Topology
|
1228
|
+
-------------------
|
1229
|
+
|
1230
|
+
.. autosummary::
|
1231
|
+
:toctree: ../stubs/
|
1232
|
+
|
1233
|
+
Layout
|
1234
|
+
CouplingMap
|
1235
|
+
TranspileLayout
|
1236
|
+
|
1237
|
+
Scheduling
|
1238
|
+
----------
|
1239
|
+
|
1240
|
+
.. autosummary::
|
1241
|
+
:toctree: ../stubs/
|
1242
|
+
|
1243
|
+
InstructionDurations
|
1244
|
+
|
1245
|
+
Abstract Passes
|
1246
|
+
---------------
|
1247
|
+
|
1248
|
+
.. autosummary::
|
1249
|
+
:toctree: ../stubs/
|
1250
|
+
|
1251
|
+
TransformationPass
|
1252
|
+
AnalysisPass
|
1253
|
+
|
1254
|
+
Exceptions
|
1255
|
+
----------
|
1256
|
+
|
1257
|
+
.. autoexception:: TranspilerError
|
1258
|
+
.. autoexception:: TranspilerAccessError
|
1259
|
+
.. autoexception:: CouplingError
|
1260
|
+
.. autoexception:: LayoutError
|
1261
|
+
.. autoexception:: CircuitTooWideForTarget
|
1262
|
+
.. autoexception:: InvalidLayoutError
|
1263
|
+
|
1264
|
+
"""
|
1265
|
+
|
1266
|
+
# For backward compatibility
|
1267
|
+
from qiskit.passmanager import (
|
1268
|
+
ConditionalController,
|
1269
|
+
DoWhileController,
|
1270
|
+
)
|
1271
|
+
from qiskit.passmanager.compilation_status import PropertySet
|
1272
|
+
|
1273
|
+
from .passmanager import PassManager, StagedPassManager
|
1274
|
+
from .passmanager_config import PassManagerConfig
|
1275
|
+
from .exceptions import (
|
1276
|
+
TranspilerError,
|
1277
|
+
TranspilerAccessError,
|
1278
|
+
CouplingError,
|
1279
|
+
LayoutError,
|
1280
|
+
CircuitTooWideForTarget,
|
1281
|
+
InvalidLayoutError,
|
1282
|
+
)
|
1283
|
+
from .basepasses import AnalysisPass, TransformationPass
|
1284
|
+
from .coupling import CouplingMap
|
1285
|
+
from .layout import Layout, TranspileLayout
|
1286
|
+
from .instruction_durations import InstructionDurations
|
1287
|
+
from .preset_passmanagers import generate_preset_pass_manager
|
1288
|
+
from .target import Target
|
1289
|
+
from .target import InstructionProperties
|
1290
|
+
from .target import QubitProperties
|