qiskit 1.4.2__cp39-abi3-macosx_11_0_arm64.whl → 2.0.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 -1
- qiskit/__init__.py +3 -9
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/circuit/__init__.py +35 -10
- qiskit/circuit/{add_control.py → _add_control.py} +32 -12
- qiskit/circuit/_classical_resource_map.py +5 -3
- qiskit/circuit/barrier.py +3 -7
- qiskit/circuit/classical/expr/__init__.py +31 -3
- qiskit/circuit/classical/expr/constructors.py +236 -28
- qiskit/circuit/classical/expr/expr.py +104 -3
- qiskit/circuit/classical/expr/visitors.py +75 -0
- qiskit/circuit/classical/types/__init__.py +12 -8
- qiskit/circuit/classical/types/ordering.py +14 -7
- qiskit/circuit/classical/types/types.py +36 -0
- qiskit/circuit/commutation_checker.py +34 -7
- qiskit/circuit/controlflow/__init__.py +32 -1
- qiskit/circuit/controlflow/_builder_utils.py +9 -5
- qiskit/circuit/controlflow/box.py +163 -0
- qiskit/circuit/controlflow/break_loop.py +1 -1
- qiskit/circuit/controlflow/builder.py +139 -39
- qiskit/circuit/controlflow/continue_loop.py +1 -3
- qiskit/circuit/controlflow/control_flow.py +10 -0
- qiskit/circuit/controlflow/for_loop.py +2 -1
- qiskit/circuit/controlflow/if_else.py +3 -16
- qiskit/circuit/controlflow/switch_case.py +2 -8
- qiskit/circuit/controlflow/while_loop.py +2 -7
- qiskit/circuit/controlledgate.py +2 -4
- qiskit/circuit/delay.py +40 -11
- qiskit/circuit/duration.py +0 -15
- qiskit/circuit/gate.py +2 -4
- qiskit/circuit/instruction.py +2 -141
- qiskit/circuit/instructionset.py +7 -54
- qiskit/circuit/library/__init__.py +469 -154
- qiskit/circuit/library/arithmetic/__init__.py +16 -10
- qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
- qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py +2 -2
- qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py +1 -1
- qiskit/circuit/library/arithmetic/exact_reciprocal.py +64 -21
- qiskit/circuit/library/arithmetic/integer_comparator.py +37 -80
- qiskit/circuit/library/arithmetic/linear_amplitude_function.py +169 -2
- qiskit/circuit/library/arithmetic/linear_pauli_rotations.py +59 -5
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +154 -6
- qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py +114 -4
- qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py +191 -15
- qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py +93 -39
- qiskit/circuit/library/arithmetic/quadratic_form.py +168 -2
- qiskit/circuit/library/arithmetic/weighted_adder.py +73 -1
- qiskit/circuit/library/bit_flip_oracle.py +130 -0
- qiskit/circuit/library/blueprintcircuit.py +52 -16
- qiskit/circuit/library/data_preparation/initializer.py +1 -1
- qiskit/circuit/library/data_preparation/pauli_feature_map.py +4 -4
- qiskit/circuit/library/data_preparation/state_preparation.py +1 -1
- qiskit/circuit/library/generalized_gates/gms.py +1 -1
- qiskit/circuit/library/generalized_gates/isometry.py +1 -1
- qiskit/circuit/library/generalized_gates/pauli.py +1 -2
- qiskit/circuit/library/generalized_gates/uc.py +97 -7
- qiskit/circuit/library/generalized_gates/uc_pauli_rot.py +1 -1
- qiskit/circuit/library/generalized_gates/unitary.py +4 -2
- qiskit/circuit/library/graph_state.py +1 -0
- qiskit/circuit/library/hamiltonian_gate.py +1 -1
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +1 -1
- qiskit/circuit/library/n_local/n_local.py +1 -1
- qiskit/circuit/library/n_local/qaoa_ansatz.py +1 -1
- qiskit/circuit/library/overlap.py +2 -2
- qiskit/circuit/library/pauli_evolution.py +39 -24
- qiskit/circuit/library/phase_oracle.py +130 -51
- qiskit/circuit/library/standard_gates/__init__.py +0 -1
- qiskit/circuit/library/standard_gates/dcx.py +3 -4
- qiskit/circuit/library/standard_gates/ecr.py +3 -4
- qiskit/circuit/library/standard_gates/global_phase.py +5 -6
- qiskit/circuit/library/standard_gates/h.py +4 -9
- qiskit/circuit/library/standard_gates/i.py +2 -2
- qiskit/circuit/library/standard_gates/iswap.py +3 -4
- qiskit/circuit/library/standard_gates/p.py +15 -34
- qiskit/circuit/library/standard_gates/r.py +7 -10
- qiskit/circuit/library/standard_gates/rx.py +5 -15
- qiskit/circuit/library/standard_gates/rxx.py +3 -6
- qiskit/circuit/library/standard_gates/ry.py +5 -17
- qiskit/circuit/library/standard_gates/ryy.py +3 -6
- qiskit/circuit/library/standard_gates/rz.py +5 -17
- qiskit/circuit/library/standard_gates/rzx.py +3 -6
- qiskit/circuit/library/standard_gates/rzz.py +3 -6
- qiskit/circuit/library/standard_gates/s.py +6 -15
- qiskit/circuit/library/standard_gates/swap.py +4 -11
- qiskit/circuit/library/standard_gates/sx.py +7 -12
- qiskit/circuit/library/standard_gates/t.py +6 -7
- qiskit/circuit/library/standard_gates/u.py +2 -10
- qiskit/circuit/library/standard_gates/u1.py +5 -16
- qiskit/circuit/library/standard_gates/u2.py +2 -6
- qiskit/circuit/library/standard_gates/u3.py +3 -11
- qiskit/circuit/library/standard_gates/x.py +14 -62
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +2 -5
- qiskit/circuit/library/standard_gates/xx_plus_yy.py +2 -5
- qiskit/circuit/library/standard_gates/y.py +4 -9
- qiskit/circuit/library/standard_gates/z.py +5 -15
- qiskit/circuit/measure.py +11 -2
- qiskit/circuit/parameterexpression.py +7 -1
- qiskit/circuit/quantumcircuit.py +890 -564
- qiskit/circuit/random/utils.py +12 -6
- qiskit/circuit/reset.py +5 -2
- qiskit/circuit/singleton.py +5 -11
- qiskit/circuit/store.py +0 -8
- qiskit/compiler/__init__.py +1 -7
- qiskit/compiler/transpiler.py +38 -196
- qiskit/converters/circuit_to_dag.py +6 -4
- qiskit/converters/circuit_to_dagdependency.py +0 -2
- qiskit/converters/circuit_to_dagdependency_v2.py +0 -1
- qiskit/converters/circuit_to_gate.py +1 -1
- qiskit/converters/circuit_to_instruction.py +16 -29
- qiskit/converters/dag_to_circuit.py +7 -8
- qiskit/converters/dag_to_dagdependency.py +0 -1
- qiskit/converters/dag_to_dagdependency_v2.py +0 -1
- qiskit/converters/dagdependency_to_circuit.py +0 -6
- qiskit/converters/dagdependency_to_dag.py +0 -6
- qiskit/dagcircuit/collect_blocks.py +32 -20
- qiskit/dagcircuit/dagdependency.py +3 -37
- qiskit/dagcircuit/dagdependency_v2.py +5 -82
- qiskit/dagcircuit/dagnode.py +14 -2
- qiskit/passmanager/__init__.py +24 -6
- qiskit/passmanager/passmanager.py +26 -24
- qiskit/primitives/__init__.py +44 -35
- qiskit/primitives/backend_estimator_v2.py +102 -23
- qiskit/primitives/backend_sampler_v2.py +5 -20
- qiskit/primitives/base/__init__.py +4 -4
- qiskit/primitives/base/base_estimator.py +77 -82
- qiskit/primitives/base/base_primitive_job.py +2 -2
- qiskit/primitives/base/{base_primitive.py → base_primitive_v1.py} +1 -1
- qiskit/primitives/base/{base_result.py → base_result_v1.py} +1 -1
- qiskit/primitives/base/base_sampler.py +52 -60
- qiskit/primitives/base/{estimator_result.py → estimator_result_v1.py} +2 -2
- qiskit/primitives/base/{sampler_result.py → sampler_result_v1.py} +2 -2
- qiskit/primitives/base/{validation.py → validation_v1.py} +34 -15
- qiskit/primitives/containers/bindings_array.py +3 -1
- qiskit/primitives/containers/bit_array.py +23 -0
- qiskit/primitives/containers/data_bin.py +3 -1
- qiskit/primitives/containers/observables_array.py +19 -2
- qiskit/primitives/statevector_sampler.py +6 -8
- qiskit/primitives/utils.py +14 -189
- qiskit/providers/__init__.py +4 -130
- qiskit/providers/backend.py +11 -314
- qiskit/providers/basic_provider/__init__.py +3 -1
- qiskit/providers/basic_provider/basic_provider.py +29 -9
- qiskit/providers/basic_provider/basic_simulator.py +158 -298
- qiskit/providers/exceptions.py +0 -33
- qiskit/providers/fake_provider/__init__.py +0 -37
- qiskit/providers/fake_provider/generic_backend_v2.py +32 -693
- qiskit/qasm2/__init__.py +21 -6
- qiskit/qasm2/export.py +2 -10
- qiskit/qasm2/parse.py +11 -25
- qiskit/qasm3/__init__.py +5 -1
- qiskit/qasm3/ast.py +44 -0
- qiskit/qasm3/exporter.py +65 -27
- qiskit/qasm3/printer.py +35 -4
- qiskit/qpy/__init__.py +162 -19
- qiskit/qpy/binary_io/__init__.py +0 -1
- qiskit/qpy/binary_io/circuits.py +98 -130
- qiskit/qpy/binary_io/schedules.py +69 -439
- qiskit/qpy/binary_io/value.py +154 -31
- qiskit/qpy/common.py +10 -7
- qiskit/qpy/formats.py +41 -0
- qiskit/qpy/interface.py +34 -81
- qiskit/qpy/type_keys.py +58 -221
- qiskit/quantum_info/analysis/distance.py +3 -1
- qiskit/quantum_info/operators/dihedral/dihedral.py +3 -1
- qiskit/quantum_info/operators/operator.py +6 -2
- qiskit/quantum_info/operators/symplectic/clifford.py +3 -1
- qiskit/quantum_info/operators/symplectic/pauli.py +4 -2
- qiskit/quantum_info/operators/symplectic/pauli_list.py +17 -5
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +40 -6
- qiskit/quantum_info/states/densitymatrix.py +16 -6
- qiskit/quantum_info/states/stabilizerstate.py +35 -4
- qiskit/quantum_info/states/statevector.py +16 -6
- qiskit/result/__init__.py +5 -17
- qiskit/result/models.py +18 -11
- qiskit/result/result.py +38 -134
- qiskit/result/sampled_expval.py +1 -2
- qiskit/result/utils.py +3 -4
- qiskit/synthesis/__init__.py +21 -1
- qiskit/synthesis/arithmetic/__init__.py +3 -1
- qiskit/synthesis/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
- qiskit/synthesis/arithmetic/adders/draper_qft_adder.py +1 -1
- qiskit/synthesis/arithmetic/adders/vbe_ripple_carry_adder.py +2 -2
- qiskit/{providers/fake_provider/backends_v1/fake_20q → synthesis/arithmetic/comparators}/__init__.py +4 -6
- qiskit/synthesis/arithmetic/comparators/compare_2s.py +112 -0
- qiskit/synthesis/arithmetic/comparators/compare_greedy.py +66 -0
- qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +1 -1
- qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +1 -1
- qiskit/synthesis/arithmetic/weighted_sum.py +155 -0
- qiskit/{result/mitigation → synthesis/boolean}/__init__.py +2 -2
- qiskit/synthesis/boolean/boolean_expression.py +231 -0
- qiskit/synthesis/boolean/boolean_expression_synth.py +124 -0
- qiskit/synthesis/boolean/boolean_expression_visitor.py +96 -0
- qiskit/synthesis/evolution/lie_trotter.py +10 -7
- qiskit/synthesis/evolution/product_formula.py +44 -35
- qiskit/synthesis/evolution/qdrift.py +17 -24
- qiskit/synthesis/evolution/suzuki_trotter.py +20 -27
- qiskit/synthesis/linear/linear_depth_lnn.py +6 -221
- qiskit/synthesis/linear_phase/cx_cz_depth_lnn.py +4 -205
- qiskit/synthesis/multi_controlled/__init__.py +1 -0
- qiskit/synthesis/multi_controlled/mcx_synthesis.py +5 -2
- qiskit/synthesis/multi_controlled/multi_control_rotation_gates.py +206 -0
- qiskit/synthesis/one_qubit/one_qubit_decompose.py +1 -1
- qiskit/synthesis/two_qubit/__init__.py +1 -0
- qiskit/synthesis/two_qubit/two_qubit_decompose.py +28 -145
- qiskit/transpiler/__init__.py +32 -232
- qiskit/transpiler/basepasses.py +20 -51
- qiskit/transpiler/layout.py +1 -1
- qiskit/transpiler/passes/__init__.py +4 -40
- qiskit/transpiler/passes/basis/basis_translator.py +5 -4
- qiskit/transpiler/passes/basis/decompose.py +1 -15
- qiskit/transpiler/passes/basis/unroll_3q_or_more.py +1 -5
- qiskit/transpiler/passes/basis/unroll_custom_definitions.py +3 -2
- qiskit/transpiler/passes/layout/apply_layout.py +4 -0
- qiskit/transpiler/passes/layout/dense_layout.py +2 -39
- qiskit/transpiler/passes/layout/full_ancilla_allocation.py +3 -4
- qiskit/transpiler/passes/layout/sabre_layout.py +7 -3
- qiskit/transpiler/passes/layout/vf2_layout.py +2 -20
- qiskit/transpiler/passes/layout/vf2_post_layout.py +60 -125
- qiskit/transpiler/passes/layout/vf2_utils.py +2 -26
- qiskit/transpiler/passes/optimization/__init__.py +2 -3
- qiskit/transpiler/passes/optimization/collect_and_collapse.py +2 -0
- qiskit/transpiler/passes/optimization/collect_cliffords.py +5 -0
- qiskit/transpiler/passes/optimization/collect_linear_functions.py +5 -0
- qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +16 -1
- qiskit/transpiler/passes/optimization/commutation_analysis.py +3 -3
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +41 -19
- qiskit/transpiler/passes/optimization/contract_idle_wires_in_control_flow.py +104 -0
- qiskit/transpiler/passes/optimization/light_cone.py +135 -0
- qiskit/transpiler/passes/optimization/optimize_1q_commutation.py +0 -1
- qiskit/transpiler/passes/optimization/optimize_1q_decomposition.py +18 -22
- qiskit/transpiler/passes/optimization/optimize_annotated.py +3 -2
- qiskit/transpiler/passes/optimization/remove_identity_equiv.py +6 -4
- qiskit/transpiler/passes/optimization/reset_after_measure_simplification.py +5 -2
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +26 -3
- qiskit/transpiler/passes/optimization/template_matching/template_substitution.py +1 -0
- qiskit/transpiler/passes/routing/__init__.py +0 -1
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +3 -1
- qiskit/transpiler/passes/routing/sabre_swap.py +14 -6
- qiskit/transpiler/passes/routing/star_prerouting.py +1 -1
- qiskit/transpiler/passes/scheduling/__init__.py +1 -7
- qiskit/transpiler/passes/scheduling/alignments/__init__.py +2 -4
- qiskit/transpiler/passes/scheduling/alignments/check_durations.py +1 -9
- qiskit/transpiler/passes/scheduling/alignments/reschedule.py +17 -16
- qiskit/transpiler/passes/scheduling/padding/base_padding.py +32 -4
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +25 -63
- qiskit/transpiler/passes/scheduling/padding/pad_delay.py +12 -4
- qiskit/transpiler/passes/scheduling/scheduling/alap.py +5 -39
- qiskit/transpiler/passes/scheduling/scheduling/asap.py +4 -35
- qiskit/transpiler/passes/scheduling/scheduling/base_scheduler.py +10 -16
- qiskit/transpiler/passes/scheduling/time_unit_conversion.py +134 -62
- qiskit/transpiler/passes/synthesis/default_unitary_synth_plugin.py +653 -0
- qiskit/transpiler/passes/synthesis/high_level_synthesis.py +176 -601
- qiskit/transpiler/passes/synthesis/hls_plugins.py +294 -1
- qiskit/transpiler/passes/synthesis/plugin.py +4 -0
- qiskit/transpiler/passes/synthesis/solovay_kitaev_synthesis.py +16 -10
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +34 -697
- qiskit/transpiler/passes/utils/__init__.py +0 -1
- qiskit/transpiler/passes/utils/check_gate_direction.py +13 -5
- qiskit/transpiler/passes/utils/control_flow.py +2 -6
- qiskit/transpiler/passes/utils/gate_direction.py +7 -0
- qiskit/transpiler/passes/utils/remove_final_measurements.py +40 -33
- qiskit/transpiler/passmanager.py +13 -0
- qiskit/transpiler/passmanager_config.py +5 -81
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +225 -344
- qiskit/transpiler/preset_passmanagers/common.py +140 -167
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +107 -322
- qiskit/transpiler/preset_passmanagers/level0.py +2 -11
- qiskit/transpiler/preset_passmanagers/level1.py +2 -14
- qiskit/transpiler/preset_passmanagers/level2.py +2 -12
- qiskit/transpiler/preset_passmanagers/level3.py +2 -11
- qiskit/transpiler/preset_passmanagers/plugin.py +5 -3
- qiskit/transpiler/target.py +78 -524
- qiskit/user_config.py +8 -4
- qiskit/utils/__init__.py +13 -12
- qiskit/utils/deprecation.py +4 -112
- qiskit/utils/optionals.py +11 -4
- qiskit/utils/parallel.py +214 -87
- qiskit/utils/units.py +4 -1
- qiskit/visualization/__init__.py +3 -7
- qiskit/visualization/array.py +4 -1
- qiskit/visualization/bloch.py +1 -1
- qiskit/visualization/circuit/_utils.py +19 -19
- qiskit/visualization/circuit/circuit_visualization.py +11 -4
- qiskit/visualization/circuit/matplotlib.py +13 -23
- qiskit/visualization/circuit/text.py +7 -3
- qiskit/visualization/counts_visualization.py +4 -0
- qiskit/visualization/dag_visualization.py +2 -1
- qiskit/visualization/gate_map.py +39 -154
- qiskit/visualization/library.py +4 -1
- qiskit/visualization/pass_manager_visualization.py +6 -2
- qiskit/visualization/state_visualization.py +19 -2
- qiskit/visualization/timeline/core.py +19 -13
- qiskit/visualization/timeline/interface.py +19 -18
- qiskit/visualization/timeline/plotters/matplotlib.py +4 -1
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info}/METADATA +4 -3
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info}/RECORD +300 -447
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info}/WHEEL +2 -1
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info}/entry_points.txt +8 -2
- qiskit/assembler/__init__.py +0 -42
- qiskit/assembler/assemble_circuits.py +0 -451
- qiskit/assembler/assemble_schedules.py +0 -367
- qiskit/assembler/disassemble.py +0 -310
- qiskit/assembler/run_config.py +0 -77
- qiskit/circuit/bit.py +0 -106
- qiskit/circuit/classicalfunction/__init__.py +0 -152
- qiskit/circuit/classicalfunction/boolean_expression.py +0 -138
- qiskit/circuit/classicalfunction/classical_element.py +0 -54
- qiskit/circuit/classicalfunction/classical_function_visitor.py +0 -155
- qiskit/circuit/classicalfunction/classicalfunction.py +0 -182
- qiskit/circuit/classicalfunction/exceptions.py +0 -41
- qiskit/circuit/classicalfunction/types.py +0 -18
- qiskit/circuit/classicalfunction/utils.py +0 -91
- qiskit/circuit/classicalregister.py +0 -57
- qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py +0 -405
- qiskit/circuit/quantumregister.py +0 -75
- qiskit/circuit/register.py +0 -246
- qiskit/compiler/assembler.py +0 -689
- qiskit/compiler/scheduler.py +0 -109
- qiskit/compiler/sequencer.py +0 -71
- qiskit/primitives/backend_estimator.py +0 -486
- qiskit/primitives/backend_sampler.py +0 -222
- qiskit/primitives/estimator.py +0 -172
- qiskit/primitives/sampler.py +0 -162
- qiskit/providers/backend_compat.py +0 -507
- qiskit/providers/fake_provider/backends_v1/__init__.py +0 -22
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/conf_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/defs_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/fake_127q_pulse_v1.py +0 -37
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/props_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_20q/conf_singapore.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_20q/fake_20q.py +0 -43
- qiskit/providers/fake_provider/backends_v1/fake_20q/props_singapore.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/conf_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/defs_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/fake_27q_pulse_v1.py +0 -50
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/props_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_5q/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_5q/conf_yorktown.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_5q/fake_5q_v1.py +0 -41
- qiskit/providers/fake_provider/backends_v1/fake_5q/props_yorktown.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/conf_nairobi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/defs_nairobi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/fake_7q_pulse_v1.py +0 -44
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/props_nairobi.json +0 -1
- qiskit/providers/fake_provider/fake_1q.py +0 -91
- qiskit/providers/fake_provider/fake_backend.py +0 -165
- qiskit/providers/fake_provider/fake_openpulse_2q.py +0 -391
- qiskit/providers/fake_provider/fake_openpulse_3q.py +0 -340
- qiskit/providers/fake_provider/fake_pulse_backend.py +0 -49
- qiskit/providers/fake_provider/fake_qasm_backend.py +0 -77
- qiskit/providers/fake_provider/utils/backend_converter.py +0 -150
- qiskit/providers/fake_provider/utils/json_decoder.py +0 -109
- qiskit/providers/models/__init__.py +0 -89
- qiskit/providers/models/backendconfiguration.py +0 -1040
- qiskit/providers/models/backendproperties.py +0 -535
- qiskit/providers/models/backendstatus.py +0 -104
- qiskit/providers/models/jobstatus.py +0 -77
- qiskit/providers/models/pulsedefaults.py +0 -305
- qiskit/providers/provider.py +0 -95
- qiskit/pulse/__init__.py +0 -158
- qiskit/pulse/builder.py +0 -2262
- qiskit/pulse/calibration_entries.py +0 -381
- qiskit/pulse/channels.py +0 -227
- qiskit/pulse/configuration.py +0 -245
- qiskit/pulse/exceptions.py +0 -45
- qiskit/pulse/filters.py +0 -309
- qiskit/pulse/instruction_schedule_map.py +0 -424
- qiskit/pulse/instructions/__init__.py +0 -67
- qiskit/pulse/instructions/acquire.py +0 -150
- qiskit/pulse/instructions/delay.py +0 -71
- qiskit/pulse/instructions/directives.py +0 -154
- qiskit/pulse/instructions/frequency.py +0 -135
- qiskit/pulse/instructions/instruction.py +0 -270
- qiskit/pulse/instructions/phase.py +0 -152
- qiskit/pulse/instructions/play.py +0 -99
- qiskit/pulse/instructions/reference.py +0 -100
- qiskit/pulse/instructions/snapshot.py +0 -82
- qiskit/pulse/library/__init__.py +0 -97
- qiskit/pulse/library/continuous.py +0 -430
- qiskit/pulse/library/pulse.py +0 -148
- qiskit/pulse/library/samplers/__init__.py +0 -15
- qiskit/pulse/library/samplers/decorators.py +0 -295
- qiskit/pulse/library/samplers/strategies.py +0 -71
- qiskit/pulse/library/symbolic_pulses.py +0 -1989
- qiskit/pulse/library/waveform.py +0 -136
- qiskit/pulse/macros.py +0 -262
- qiskit/pulse/parameter_manager.py +0 -445
- qiskit/pulse/parser.py +0 -314
- qiskit/pulse/reference_manager.py +0 -58
- qiskit/pulse/schedule.py +0 -1854
- qiskit/pulse/transforms/__init__.py +0 -106
- qiskit/pulse/transforms/alignments.py +0 -406
- qiskit/pulse/transforms/base_transforms.py +0 -71
- qiskit/pulse/transforms/canonicalization.py +0 -498
- qiskit/pulse/transforms/dag.py +0 -122
- qiskit/pulse/utils.py +0 -149
- qiskit/qobj/__init__.py +0 -75
- qiskit/qobj/common.py +0 -81
- qiskit/qobj/converters/__init__.py +0 -18
- qiskit/qobj/converters/lo_config.py +0 -177
- qiskit/qobj/converters/pulse_instruction.py +0 -897
- qiskit/qobj/pulse_qobj.py +0 -709
- qiskit/qobj/qasm_qobj.py +0 -708
- qiskit/qobj/utils.py +0 -46
- qiskit/result/mitigation/base_readout_mitigator.py +0 -79
- qiskit/result/mitigation/correlated_readout_mitigator.py +0 -277
- qiskit/result/mitigation/local_readout_mitigator.py +0 -328
- qiskit/result/mitigation/utils.py +0 -217
- qiskit/scheduler/__init__.py +0 -40
- qiskit/scheduler/config.py +0 -37
- qiskit/scheduler/lowering.py +0 -187
- qiskit/scheduler/methods/__init__.py +0 -15
- qiskit/scheduler/methods/basic.py +0 -140
- qiskit/scheduler/schedule_circuit.py +0 -69
- qiskit/scheduler/sequence.py +0 -104
- qiskit/transpiler/passes/calibration/__init__.py +0 -17
- qiskit/transpiler/passes/calibration/base_builder.py +0 -79
- qiskit/transpiler/passes/calibration/builders.py +0 -20
- qiskit/transpiler/passes/calibration/exceptions.py +0 -22
- qiskit/transpiler/passes/calibration/pulse_gate.py +0 -100
- qiskit/transpiler/passes/calibration/rx_builder.py +0 -164
- qiskit/transpiler/passes/calibration/rzx_builder.py +0 -411
- qiskit/transpiler/passes/calibration/rzx_templates.py +0 -58
- qiskit/transpiler/passes/optimization/cx_cancellation.py +0 -65
- qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py +0 -162
- qiskit/transpiler/passes/optimization/normalize_rx_angle.py +0 -157
- qiskit/transpiler/passes/routing/stochastic_swap.py +0 -532
- qiskit/transpiler/passes/scheduling/alap.py +0 -153
- qiskit/transpiler/passes/scheduling/alignments/align_measures.py +0 -255
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +0 -107
- qiskit/transpiler/passes/scheduling/asap.py +0 -175
- qiskit/transpiler/passes/scheduling/base_scheduler.py +0 -310
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +0 -313
- qiskit/transpiler/passes/utils/convert_conditions_to_if_ops.py +0 -93
- qiskit/utils/deprecate_pulse.py +0 -119
- qiskit/utils/multiprocessing.py +0 -56
- qiskit/visualization/pulse_v2/__init__.py +0 -21
- qiskit/visualization/pulse_v2/core.py +0 -901
- qiskit/visualization/pulse_v2/device_info.py +0 -173
- qiskit/visualization/pulse_v2/drawings.py +0 -253
- qiskit/visualization/pulse_v2/events.py +0 -254
- qiskit/visualization/pulse_v2/generators/__init__.py +0 -40
- qiskit/visualization/pulse_v2/generators/barrier.py +0 -76
- qiskit/visualization/pulse_v2/generators/chart.py +0 -208
- qiskit/visualization/pulse_v2/generators/frame.py +0 -436
- qiskit/visualization/pulse_v2/generators/snapshot.py +0 -133
- qiskit/visualization/pulse_v2/generators/waveform.py +0 -645
- qiskit/visualization/pulse_v2/interface.py +0 -459
- qiskit/visualization/pulse_v2/layouts.py +0 -387
- qiskit/visualization/pulse_v2/plotters/__init__.py +0 -17
- qiskit/visualization/pulse_v2/plotters/base_plotter.py +0 -53
- qiskit/visualization/pulse_v2/plotters/matplotlib.py +0 -201
- qiskit/visualization/pulse_v2/stylesheet.py +0 -312
- qiskit/visualization/pulse_v2/types.py +0 -242
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info/licenses}/LICENSE.txt +0 -0
- {qiskit-1.4.2.dist-info → qiskit-2.0.0.dist-info}/top_level.txt +0 -0
@@ -13,30 +13,20 @@
|
|
13
13
|
"""
|
14
14
|
Preset pass manager generation function
|
15
15
|
"""
|
16
|
-
|
17
16
|
import copy
|
18
17
|
import warnings
|
19
18
|
|
20
|
-
from qiskit.circuit.controlflow import
|
21
|
-
CONTROL_FLOW_OP_NAMES,
|
22
|
-
IfElseOp,
|
23
|
-
WhileLoopOp,
|
24
|
-
ForLoopOp,
|
25
|
-
SwitchCaseOp,
|
26
|
-
)
|
19
|
+
from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES, get_control_flow_name_mapping
|
27
20
|
from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping
|
28
|
-
from qiskit.circuit
|
21
|
+
from qiskit.circuit import Qubit
|
29
22
|
from qiskit.providers.backend import Backend
|
30
|
-
from qiskit.providers.backend_compat import BackendV2Converter
|
31
23
|
from qiskit.transpiler.coupling import CouplingMap
|
32
24
|
from qiskit.transpiler.exceptions import TranspilerError
|
33
25
|
from qiskit.transpiler.instruction_durations import InstructionDurations
|
34
26
|
from qiskit.transpiler.layout import Layout
|
35
27
|
from qiskit.transpiler.passmanager_config import PassManagerConfig
|
36
|
-
from qiskit.transpiler.target import Target,
|
28
|
+
from qiskit.transpiler.target import Target, _FakeTarget
|
37
29
|
from qiskit.transpiler.timing_constraints import TimingConstraints
|
38
|
-
from qiskit.utils import deprecate_arg
|
39
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_arg
|
40
30
|
|
41
31
|
from .level0 import level_0_pass_manager
|
42
32
|
from .level1 import level_1_pass_manager
|
@@ -44,43 +34,15 @@ from .level2 import level_2_pass_manager
|
|
44
34
|
from .level3 import level_3_pass_manager
|
45
35
|
|
46
36
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
package_name="Qiskit",
|
51
|
-
removal_timeline="in Qiskit 2.0",
|
52
|
-
additional_msg="The `target` parameter should be used instead. You can build a `Target` instance "
|
53
|
-
"with defined instruction durations with "
|
54
|
-
"`Target.from_configuration(..., instruction_durations=...)`",
|
55
|
-
)
|
56
|
-
@deprecate_arg(
|
57
|
-
name="timing_constraints",
|
58
|
-
since="1.3",
|
59
|
-
package_name="Qiskit",
|
60
|
-
removal_timeline="in Qiskit 2.0",
|
61
|
-
additional_msg="The `target` parameter should be used instead. You can build a `Target` instance "
|
62
|
-
"with defined timing constraints with "
|
63
|
-
"`Target.from_configuration(..., timing_constraints=...)`",
|
64
|
-
)
|
65
|
-
@deprecate_arg(
|
66
|
-
name="backend_properties",
|
67
|
-
since="1.3",
|
68
|
-
package_name="Qiskit",
|
69
|
-
removal_timeline="in Qiskit 2.0",
|
70
|
-
additional_msg="The `target` parameter should be used instead. You can build a `Target` instance "
|
71
|
-
"with defined properties with Target.from_configuration(..., backend_properties=...)",
|
72
|
-
)
|
73
|
-
@deprecate_pulse_arg("inst_map", predicate=lambda inst_map: inst_map is not None)
|
37
|
+
OVER_3Q_GATES = ["ccx", "ccz", "cswap", "rccx", "c3x", "c3sx", "rc3x"]
|
38
|
+
|
39
|
+
|
74
40
|
def generate_preset_pass_manager(
|
75
41
|
optimization_level=2,
|
76
42
|
backend=None,
|
77
43
|
target=None,
|
78
44
|
basis_gates=None,
|
79
|
-
inst_map=None,
|
80
45
|
coupling_map=None,
|
81
|
-
instruction_durations=None,
|
82
|
-
backend_properties=None,
|
83
|
-
timing_constraints=None,
|
84
46
|
initial_layout=None,
|
85
47
|
layout_method=None,
|
86
48
|
routing_method=None,
|
@@ -107,30 +69,24 @@ def generate_preset_pass_manager(
|
|
107
69
|
function internally builds and uses.
|
108
70
|
|
109
71
|
The target constraints for the pass manager construction can be specified through a :class:`.Target`
|
110
|
-
instance, a :class:`.
|
111
|
-
(``basis_gates``, ``
|
112
|
-
``dt`` or ``timing_constraints``).
|
72
|
+
instance, a :class:`.BackendV2` instance, or via loose constraints
|
73
|
+
(``basis_gates``, ``coupling_map``, or ``dt``).
|
113
74
|
The order of priorities for target constraints works as follows: if a ``target``
|
114
75
|
input is provided, it will take priority over any ``backend`` input or loose constraints.
|
115
76
|
If a ``backend`` is provided together with any loose constraint
|
116
77
|
from the list above, the loose constraint will take priority over the corresponding backend
|
117
|
-
constraint. This behavior is
|
118
|
-
:class:`.BackendV1` or :class:`.BackendV2`, as summarized in the table below. The first column
|
78
|
+
constraint. This behavior is summarized in the table below. The first column
|
119
79
|
in the table summarizes the potential user-provided constraints, and each cell shows whether
|
120
80
|
the priority is assigned to that specific constraint input or another input
|
121
81
|
(`target`/`backend(V1)`/`backend(V2)`).
|
122
82
|
|
123
|
-
============================ ========= ========================
|
124
|
-
User Provided target backend(
|
125
|
-
============================ ========= ========================
|
126
|
-
**basis_gates** target basis_gates
|
127
|
-
**coupling_map** target coupling_map
|
128
|
-
**
|
129
|
-
|
130
|
-
**dt** target dt dt
|
131
|
-
**timing_constraints** target timing_constraints timing_constraints
|
132
|
-
**backend_properties** target backend_properties backend_properties
|
133
|
-
============================ ========= ======================== =======================
|
83
|
+
============================ ========= ========================
|
84
|
+
User Provided target backend(V2)
|
85
|
+
============================ ========= ========================
|
86
|
+
**basis_gates** target basis_gates
|
87
|
+
**coupling_map** target coupling_map
|
88
|
+
**dt** target dt
|
89
|
+
============================ ========= ========================
|
134
90
|
|
135
91
|
Args:
|
136
92
|
optimization_level (int): The optimization level to generate a
|
@@ -145,23 +101,15 @@ def generate_preset_pass_manager(
|
|
145
101
|
* 3: even heavier optimization
|
146
102
|
|
147
103
|
backend (Backend): An optional backend object which can be used as the
|
148
|
-
source of the default values for the ``basis_gates``,
|
149
|
-
``coupling_map``, ``
|
150
|
-
``timing_constraints``, and ``target``. If any of those other arguments
|
104
|
+
source of the default values for the ``basis_gates``,
|
105
|
+
``coupling_map``, and ``target``. If any of those other arguments
|
151
106
|
are specified in addition to ``backend`` they will take precedence
|
152
107
|
over the value contained in the backend.
|
153
108
|
target (Target): The :class:`~.Target` representing a backend compilation
|
154
109
|
target. The following attributes will be inferred from this
|
155
|
-
argument if they are not set: ``coupling_map
|
156
|
-
``instruction_durations``, ``inst_map``, ``timing_constraints``
|
157
|
-
and ``backend_properties``.
|
110
|
+
argument if they are not set: ``coupling_map`` and ``basis_gates``.
|
158
111
|
basis_gates (list): List of basis gate names to unroll to
|
159
112
|
(e.g: ``['u1', 'u2', 'u3', 'cx']``).
|
160
|
-
inst_map (InstructionScheduleMap): DEPRECATED. Mapping object that maps gates to schedules.
|
161
|
-
If any user defined calibration is found in the map and this is used in a
|
162
|
-
circuit, transpiler attaches the custom gate definition to the circuit.
|
163
|
-
This enables one to flexibly override the low-level instruction
|
164
|
-
implementation.
|
165
113
|
coupling_map (CouplingMap or list): Directed graph represented a coupling
|
166
114
|
map. Multiple formats are supported:
|
167
115
|
|
@@ -169,45 +117,8 @@ def generate_preset_pass_manager(
|
|
169
117
|
#. List, must be given as an adjacency matrix, where each entry
|
170
118
|
specifies all directed two-qubit interactions supported by backend,
|
171
119
|
e.g: ``[[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]``
|
172
|
-
|
173
|
-
instruction_durations (InstructionDurations or list): Dictionary of duration
|
174
|
-
(in dt) for each instruction. If specified, these durations overwrite the
|
175
|
-
gate lengths in ``backend.properties``. Applicable only if ``scheduling_method``
|
176
|
-
is specified.
|
177
|
-
The format of ``instruction_durations`` must be as follows:
|
178
|
-
They must be given as an :class:`.InstructionDurations` instance or a list of tuples
|
179
|
-
|
180
|
-
```
|
181
|
-
[(instruction_name, qubits, duration, unit), ...].
|
182
|
-
| [('cx', [0, 1], 12.3, 'ns'), ('u3', [0], 4.56, 'ns')]
|
183
|
-
| [('cx', [0, 1], 1000), ('u3', [0], 300)]
|
184
|
-
```
|
185
|
-
|
186
|
-
If ``unit`` is omitted, the default is ``'dt'``, which is a sample time depending on backend.
|
187
|
-
If the time unit is ``'dt'``, the duration must be an integer.
|
188
120
|
dt (float): Backend sample time (resolution) in seconds.
|
189
|
-
If provided, this value will overwrite the ``dt`` value in ``instruction_durations``.
|
190
121
|
If ``None`` (default) and a backend is provided, ``backend.dt`` is used.
|
191
|
-
timing_constraints (TimingConstraints): Hardware time alignment restrictions.
|
192
|
-
A quantum computer backend may report a set of restrictions, namely:
|
193
|
-
|
194
|
-
- granularity: An integer value representing minimum pulse gate
|
195
|
-
resolution in units of ``dt``. A user-defined pulse gate should have
|
196
|
-
duration of a multiple of this granularity value.
|
197
|
-
- min_length: An integer value representing minimum pulse gate
|
198
|
-
length in units of ``dt``. A user-defined pulse gate should be longer
|
199
|
-
than this length.
|
200
|
-
- pulse_alignment: An integer value representing a time resolution of gate
|
201
|
-
instruction starting time. Gate instruction should start at time which
|
202
|
-
is a multiple of the alignment value.
|
203
|
-
- acquire_alignment: An integer value representing a time resolution of measure
|
204
|
-
instruction starting time. Measure instruction should start at time which
|
205
|
-
is a multiple of the alignment value.
|
206
|
-
|
207
|
-
This information will be provided by the backend configuration.
|
208
|
-
If the backend doesn't have any restriction on the instruction time allocation,
|
209
|
-
then ``timing_constraints`` is None and no adjustment will be performed.
|
210
|
-
|
211
122
|
initial_layout (Layout | List[int]): Initial position of virtual qubits on
|
212
123
|
physical qubits.
|
213
124
|
layout_method (str): The :class:`~.Pass` to use for choosing initial qubit
|
@@ -236,9 +147,6 @@ def generate_preset_pass_manager(
|
|
236
147
|
for the ``scheduling`` stage of the output :class:`~.StagedPassManager`. You can
|
237
148
|
see a list of installed plugins by using :func:`~.list_stage_plugins` with
|
238
149
|
``"scheduling"`` for the ``stage_name`` argument.
|
239
|
-
backend_properties (BackendProperties): Properties returned by a
|
240
|
-
backend, including information on gate errors, readout errors,
|
241
|
-
qubit coherence times, etc.
|
242
150
|
approximation_degree (float): Heuristic dial used for circuit approximation
|
243
151
|
(1.0=no approximation, 0.0=maximal approximation).
|
244
152
|
seed_transpiler (int): Sets random seed for the stochastic parts of
|
@@ -289,98 +197,55 @@ def generate_preset_pass_manager(
|
|
289
197
|
backend = optimization_level
|
290
198
|
optimization_level = 2
|
291
199
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
200
|
+
# If there are no loose constraints => use backend target if available
|
201
|
+
_no_loose_constraints = basis_gates is None and coupling_map is None and dt is None
|
202
|
+
|
203
|
+
# If the only loose constraint is dt => use backend target and modify dt
|
204
|
+
_adjust_dt = backend is not None and dt is not None
|
205
|
+
|
206
|
+
# Warn about inconsistencies in backend + loose constraints path (dt shouldn't be a problem)
|
207
|
+
if backend is not None and (coupling_map is not None or basis_gates is not None):
|
296
208
|
warnings.warn(
|
297
|
-
"
|
298
|
-
|
299
|
-
|
300
|
-
"should move to `BackendV2`.",
|
301
|
-
category=DeprecationWarning,
|
209
|
+
"Providing `coupling_map` and/or `basis_gates` along with `backend` is not "
|
210
|
+
"recommended, as this will invalidate the backend's gate durations and error rates.",
|
211
|
+
category=UserWarning,
|
302
212
|
stacklevel=2,
|
303
213
|
)
|
304
|
-
backend = BackendV2Converter(backend)
|
305
|
-
|
306
|
-
# Check if a custom inst_map was specified before overwriting inst_map
|
307
|
-
_given_inst_map = bool(inst_map)
|
308
|
-
# If there are no loose constraints => use backend target if available
|
309
|
-
_no_loose_constraints = (
|
310
|
-
basis_gates is None
|
311
|
-
and coupling_map is None
|
312
|
-
and dt is None
|
313
|
-
and instruction_durations is None
|
314
|
-
and backend_properties is None
|
315
|
-
and timing_constraints is None
|
316
|
-
)
|
317
|
-
# If it's an edge case => do not build target
|
318
|
-
_skip_target = (
|
319
|
-
target is None
|
320
|
-
and backend is None
|
321
|
-
# Note: instruction_durations is deprecated and will be removed in 2.0 (no need for alternative)
|
322
|
-
and (basis_gates is None or coupling_map is None or instruction_durations is not None)
|
323
|
-
)
|
324
214
|
|
325
215
|
# Resolve loose constraints case-by-case against backend constraints.
|
326
216
|
# The order of priority is loose constraints > backend.
|
327
217
|
dt = _parse_dt(dt, backend)
|
328
|
-
instruction_durations = _parse_instruction_durations(backend,
|
329
|
-
timing_constraints = _parse_timing_constraints(backend
|
330
|
-
inst_map = _parse_inst_map(inst_map, backend)
|
331
|
-
# The basis gates parser will set _skip_target to True if a custom basis gate is found
|
332
|
-
# (known edge case).
|
333
|
-
basis_gates, name_mapping, _skip_target = _parse_basis_gates(
|
334
|
-
basis_gates, backend, inst_map, _skip_target
|
335
|
-
)
|
218
|
+
instruction_durations = _parse_instruction_durations(backend, dt)
|
219
|
+
timing_constraints = _parse_timing_constraints(backend)
|
336
220
|
coupling_map = _parse_coupling_map(coupling_map, backend)
|
221
|
+
basis_gates, name_mapping = _parse_basis_gates(basis_gates, backend)
|
222
|
+
|
223
|
+
# Check if coupling map has been provided (either standalone or through backend)
|
224
|
+
# with user-defined basis_gates, and whether these have 3q or more.
|
225
|
+
if coupling_map is not None and basis_gates is not None:
|
226
|
+
for gate in OVER_3Q_GATES:
|
227
|
+
if gate in basis_gates:
|
228
|
+
raise ValueError(
|
229
|
+
f"Gates with 3 or more qubits ({gate}) in `basis_gates` or `backend` are "
|
230
|
+
"incompatible with a custom `coupling_map`. To include 3-qubit or larger "
|
231
|
+
" gates in the transpilation basis, provide a custom `target` instead."
|
232
|
+
)
|
337
233
|
|
338
234
|
if target is None:
|
339
235
|
if backend is not None and _no_loose_constraints:
|
340
236
|
# If a backend is specified without loose constraints, use its target directly.
|
341
237
|
target = backend.target
|
342
|
-
elif
|
343
|
-
#
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
warnings.filterwarnings(
|
349
|
-
"ignore",
|
350
|
-
category=DeprecationWarning,
|
351
|
-
message=".*``inst_map`` is deprecated as of Qiskit 1.3.*",
|
352
|
-
module="qiskit",
|
353
|
-
)
|
354
|
-
warnings.filterwarnings(
|
355
|
-
"ignore",
|
356
|
-
category=DeprecationWarning,
|
357
|
-
message=".* ``backend_properties`` is deprecated as of Qiskit 1.4",
|
358
|
-
module="qiskit",
|
359
|
-
)
|
360
|
-
warnings.filterwarnings(
|
361
|
-
"ignore",
|
362
|
-
category=DeprecationWarning,
|
363
|
-
message=".*``qiskit.providers.exceptions.BackendPropertyError``",
|
364
|
-
)
|
365
|
-
# TODO: This is a temporary usage of deprecated backend_properties in
|
366
|
-
# Target.from_configuration. Probably the logic needs to be restructured
|
367
|
-
# in a more target-centric transpiler
|
368
|
-
# https://github.com/Qiskit/qiskit/issues/9256
|
369
|
-
warnings.filterwarnings(
|
370
|
-
"ignore",
|
371
|
-
category=DeprecationWarning,
|
372
|
-
message=r".+qiskit\.transpiler\.target\.Target\.from_configuration.+",
|
373
|
-
module="qiskit",
|
374
|
-
)
|
238
|
+
elif _adjust_dt:
|
239
|
+
# If a backend is specified with loose dt, use its target and adjust the dt value.
|
240
|
+
target = copy.deepcopy(backend.target)
|
241
|
+
target.dt = dt
|
242
|
+
else:
|
243
|
+
if basis_gates is not None:
|
375
244
|
# Build target from constraints.
|
376
245
|
target = Target.from_configuration(
|
377
246
|
basis_gates=basis_gates,
|
378
247
|
num_qubits=backend.num_qubits if backend is not None else None,
|
379
248
|
coupling_map=coupling_map,
|
380
|
-
# If the instruction map has custom gates, do not give as config, the information
|
381
|
-
# will be added to the target with update_from_instruction_schedule_map
|
382
|
-
inst_map=inst_map if inst_map and not inst_map.has_custom_gate() else None,
|
383
|
-
backend_properties=backend_properties,
|
384
249
|
instruction_durations=instruction_durations,
|
385
250
|
concurrent_measurements=(
|
386
251
|
backend.target.concurrent_measurements if backend is not None else None
|
@@ -389,48 +254,33 @@ def generate_preset_pass_manager(
|
|
389
254
|
timing_constraints=timing_constraints,
|
390
255
|
custom_name_mapping=name_mapping,
|
391
256
|
)
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
target.update_from_instruction_schedule_map(inst_map)
|
398
|
-
|
399
|
-
if target is not None:
|
400
|
-
if coupling_map is None:
|
401
|
-
coupling_map = target.build_coupling_map()
|
402
|
-
if basis_gates is None:
|
403
|
-
basis_gates = target.operation_names
|
404
|
-
if instruction_durations is None:
|
405
|
-
instruction_durations = target.durations()
|
406
|
-
if inst_map is None:
|
407
|
-
inst_map = target._get_instruction_schedule_map()
|
408
|
-
if timing_constraints is None:
|
409
|
-
timing_constraints = target.timing_constraints()
|
410
|
-
if backend_properties is None:
|
411
|
-
with warnings.catch_warnings():
|
412
|
-
# TODO this approach (target-to-properties) is going to be removed soon (1.3) in favor
|
413
|
-
# of backend-to-target approach
|
414
|
-
# https://github.com/Qiskit/qiskit/pull/12850
|
415
|
-
warnings.filterwarnings(
|
416
|
-
"ignore",
|
417
|
-
category=DeprecationWarning,
|
418
|
-
message=r".+qiskit\.transpiler\.target\.target_to_backend_properties.+",
|
419
|
-
module="qiskit",
|
257
|
+
else:
|
258
|
+
target = _FakeTarget.from_configuration(
|
259
|
+
num_qubits=backend.num_qubits if backend is not None else None,
|
260
|
+
coupling_map=coupling_map,
|
261
|
+
dt=dt,
|
420
262
|
)
|
421
|
-
|
263
|
+
|
264
|
+
# Update loose constraints to populate pm options
|
265
|
+
if coupling_map is None:
|
266
|
+
coupling_map = target.build_coupling_map()
|
267
|
+
if basis_gates is None and len(target.operation_names) > 0:
|
268
|
+
basis_gates = target.operation_names
|
269
|
+
if instruction_durations is None:
|
270
|
+
instruction_durations = target.durations()
|
271
|
+
if timing_constraints is None:
|
272
|
+
timing_constraints = target.timing_constraints()
|
422
273
|
|
423
274
|
# Parse non-target dependent pm options
|
424
275
|
initial_layout = _parse_initial_layout(initial_layout)
|
425
276
|
approximation_degree = _parse_approximation_degree(approximation_degree)
|
426
277
|
seed_transpiler = _parse_seed_transpiler(seed_transpiler)
|
278
|
+
|
427
279
|
pm_options = {
|
428
280
|
"target": target,
|
429
281
|
"basis_gates": basis_gates,
|
430
|
-
"inst_map": inst_map,
|
431
282
|
"coupling_map": coupling_map,
|
432
283
|
"instruction_durations": instruction_durations,
|
433
|
-
"backend_properties": backend_properties,
|
434
284
|
"timing_constraints": timing_constraints,
|
435
285
|
"layout_method": layout_method,
|
436
286
|
"routing_method": routing_method,
|
@@ -447,47 +297,29 @@ def generate_preset_pass_manager(
|
|
447
297
|
"qubits_initially_zero": qubits_initially_zero,
|
448
298
|
}
|
449
299
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
)
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
)
|
463
|
-
|
464
|
-
|
465
|
-
pm_config = PassManagerConfig.from_backend(backend, **pm_options)
|
466
|
-
else:
|
467
|
-
pm_config = PassManagerConfig(**pm_options)
|
468
|
-
if optimization_level == 0:
|
469
|
-
pm = level_0_pass_manager(pm_config)
|
470
|
-
elif optimization_level == 1:
|
471
|
-
pm = level_1_pass_manager(pm_config)
|
472
|
-
elif optimization_level == 2:
|
473
|
-
pm = level_2_pass_manager(pm_config)
|
474
|
-
elif optimization_level == 3:
|
475
|
-
pm = level_3_pass_manager(pm_config)
|
476
|
-
else:
|
477
|
-
raise ValueError(f"Invalid optimization level {optimization_level}")
|
300
|
+
if backend is not None:
|
301
|
+
pm_options["_skip_target"] = _skip_target
|
302
|
+
pm_config = PassManagerConfig.from_backend(backend, **pm_options)
|
303
|
+
else:
|
304
|
+
pm_config = PassManagerConfig(**pm_options)
|
305
|
+
if optimization_level == 0:
|
306
|
+
pm = level_0_pass_manager(pm_config)
|
307
|
+
elif optimization_level == 1:
|
308
|
+
pm = level_1_pass_manager(pm_config)
|
309
|
+
elif optimization_level == 2:
|
310
|
+
pm = level_2_pass_manager(pm_config)
|
311
|
+
elif optimization_level == 3:
|
312
|
+
pm = level_3_pass_manager(pm_config)
|
313
|
+
else:
|
314
|
+
raise ValueError(f"Invalid optimization level {optimization_level}")
|
478
315
|
return pm
|
479
316
|
|
480
317
|
|
481
|
-
def _parse_basis_gates(basis_gates, backend
|
318
|
+
def _parse_basis_gates(basis_gates, backend):
|
482
319
|
standard_gates = get_standard_gate_name_mapping()
|
483
320
|
# Add control flow gates by default to basis set and name mapping
|
484
321
|
default_gates = {"measure", "delay", "reset"}.union(CONTROL_FLOW_OP_NAMES)
|
485
|
-
name_mapping =
|
486
|
-
"if_else": IfElseOp,
|
487
|
-
"while_loop": WhileLoopOp,
|
488
|
-
"for_loop": ForLoopOp,
|
489
|
-
"switch_case": SwitchCaseOp,
|
490
|
-
}
|
322
|
+
name_mapping = get_control_flow_name_mapping()
|
491
323
|
try:
|
492
324
|
instructions = set(basis_gates)
|
493
325
|
for name in default_gates:
|
@@ -499,77 +331,38 @@ def _parse_basis_gates(basis_gates, backend, inst_map, skip_target):
|
|
499
331
|
if backend is None:
|
500
332
|
# Check for custom instructions
|
501
333
|
if instructions is None:
|
502
|
-
return None, name_mapping
|
334
|
+
return None, name_mapping
|
503
335
|
|
504
336
|
for inst in instructions:
|
505
337
|
if inst not in standard_gates and inst not in default_gates:
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
"argument is deprecated for both ``transpile`` and ``generate_preset_pass_manager`` "
|
510
|
-
"as of Qiskit 1.3.0. "
|
511
|
-
"It will be removed in Qiskit 2.0. The ``target`` parameter should be used instead. "
|
338
|
+
raise ValueError(
|
339
|
+
f"Providing non-standard gates ({inst}) through the ``basis_gates`` "
|
340
|
+
"argument is not allowed. Use the ``target`` parameter instead. "
|
512
341
|
"You can build a target instance using ``Target.from_configuration()`` and provide "
|
513
|
-
"custom gate definitions with the ``custom_name_mapping`` argument."
|
342
|
+
"custom gate definitions with the ``custom_name_mapping`` argument."
|
514
343
|
)
|
515
|
-
skip_target = True
|
516
|
-
break
|
517
344
|
|
518
|
-
return list(instructions), name_mapping
|
345
|
+
return list(instructions), name_mapping
|
519
346
|
|
520
347
|
instructions = instructions or backend.operation_names
|
521
348
|
name_mapping.update(
|
522
349
|
{name: backend.target.operation_from_name(name) for name in backend.operation_names}
|
523
350
|
)
|
524
351
|
|
525
|
-
# Check for custom instructions
|
352
|
+
# Check for custom instructions
|
526
353
|
for inst in instructions:
|
527
354
|
if inst not in standard_gates and inst not in default_gates:
|
528
355
|
if inst not in backend.operation_names:
|
529
|
-
# do not raise
|
356
|
+
# do not raise error when the custom instruction comes from the backend
|
530
357
|
# (common case with BasicSimulator)
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
"
|
535
|
-
"
|
536
|
-
"You can build a target instance using ``Target.from_configuration()`` and provide"
|
537
|
-
"custom gate definitions with the ``custom_name_mapping`` argument.",
|
358
|
+
raise ValueError(
|
359
|
+
f"Providing non-standard gates ({inst}) through the ``basis_gates`` "
|
360
|
+
"argument is not allowed. Use the ``target`` parameter instead. "
|
361
|
+
"You can build a target instance using ``Target.from_configuration()`` and provide "
|
362
|
+
"custom gate definitions with the ``custom_name_mapping`` argument."
|
538
363
|
)
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
# Remove calibrated instructions, as they will be added later from the instruction schedule map
|
543
|
-
if inst_map is not None and not skip_target:
|
544
|
-
for inst in inst_map.instructions:
|
545
|
-
for qubit in inst_map.qubits_with_instruction(inst):
|
546
|
-
entry = inst_map._get_calibration_entry(inst, qubit)
|
547
|
-
if entry.user_provided and inst in instructions:
|
548
|
-
instructions.remove(inst)
|
549
|
-
|
550
|
-
return list(instructions) if instructions else None, name_mapping, skip_target
|
551
|
-
|
552
|
-
|
553
|
-
def _parse_inst_map(inst_map, backend):
|
554
|
-
# try getting inst_map from user, else backend
|
555
|
-
if inst_map is None and backend is not None:
|
556
|
-
inst_map = backend.target._get_instruction_schedule_map()
|
557
|
-
return inst_map
|
558
|
-
|
559
|
-
|
560
|
-
def _parse_backend_properties(backend_properties, backend):
|
561
|
-
# try getting backend_props from user, else backend
|
562
|
-
if backend_properties is None and backend is not None:
|
563
|
-
with warnings.catch_warnings():
|
564
|
-
# filter target_to_backend_properties warning
|
565
|
-
warnings.filterwarnings(
|
566
|
-
"ignore",
|
567
|
-
category=DeprecationWarning,
|
568
|
-
message=".*``qiskit.transpiler.target.target_to_backend_properties\\(\\)``.*",
|
569
|
-
module="qiskit",
|
570
|
-
)
|
571
|
-
backend_properties = target_to_backend_properties(backend.target)
|
572
|
-
return backend_properties
|
364
|
+
|
365
|
+
return list(instructions) if instructions else None, name_mapping
|
573
366
|
|
574
367
|
|
575
368
|
def _parse_dt(dt, backend):
|
@@ -597,28 +390,20 @@ def _parse_coupling_map(coupling_map, backend):
|
|
597
390
|
)
|
598
391
|
|
599
392
|
|
600
|
-
def _parse_instruction_durations(backend,
|
601
|
-
"""Create a list of ``InstructionDuration``s
|
602
|
-
the backend will be ignored, otherwise, the durations will be populated from the
|
603
|
-
backend.
|
604
|
-
"""
|
393
|
+
def _parse_instruction_durations(backend, dt):
|
394
|
+
"""Create a list of ``InstructionDuration``s populated from the backend."""
|
605
395
|
final_durations = InstructionDurations()
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
final_durations.update(backend_durations, dt or backend_durations.dt)
|
611
|
-
else:
|
612
|
-
final_durations.update(inst_durations, dt or getattr(inst_durations, "dt", None))
|
396
|
+
backend_durations = InstructionDurations()
|
397
|
+
if backend is not None:
|
398
|
+
backend_durations = backend.instruction_durations
|
399
|
+
final_durations.update(backend_durations, dt or backend_durations.dt)
|
613
400
|
return final_durations
|
614
401
|
|
615
402
|
|
616
|
-
def _parse_timing_constraints(backend
|
617
|
-
if
|
618
|
-
return timing_constraints
|
619
|
-
if backend is None and timing_constraints is None:
|
403
|
+
def _parse_timing_constraints(backend):
|
404
|
+
if backend is None:
|
620
405
|
timing_constraints = TimingConstraints()
|
621
|
-
|
406
|
+
else:
|
622
407
|
timing_constraints = backend.target.timing_constraints()
|
623
408
|
return timing_constraints
|
624
409
|
|
@@ -48,8 +48,8 @@ def level_0_pass_manager(pass_manager_config: PassManagerConfig) -> StagedPassMa
|
|
48
48
|
initial_layout = pass_manager_config.initial_layout
|
49
49
|
init_method = pass_manager_config.init_method or "default"
|
50
50
|
layout_method = pass_manager_config.layout_method or "default"
|
51
|
-
routing_method = pass_manager_config.routing_method or "
|
52
|
-
translation_method = pass_manager_config.translation_method or "
|
51
|
+
routing_method = pass_manager_config.routing_method or "default"
|
52
|
+
translation_method = pass_manager_config.translation_method or "default"
|
53
53
|
optimization_method = pass_manager_config.optimization_method or "default"
|
54
54
|
scheduling_method = pass_manager_config.scheduling_method or "default"
|
55
55
|
target = pass_manager_config.target
|
@@ -73,14 +73,6 @@ def level_0_pass_manager(pass_manager_config: PassManagerConfig) -> StagedPassMa
|
|
73
73
|
"translation", translation_method, pass_manager_config, optimization_level=0
|
74
74
|
)
|
75
75
|
|
76
|
-
if (coupling_map and not coupling_map.is_symmetric) or (
|
77
|
-
target is not None and target.get_non_global_operation_names(strict_direction=True)
|
78
|
-
):
|
79
|
-
pre_opt = common.generate_pre_op_passmanager(target, coupling_map)
|
80
|
-
pre_opt += translation
|
81
|
-
else:
|
82
|
-
pre_opt = None
|
83
|
-
|
84
76
|
sched = plugin_manager.get_passmanager_stage(
|
85
77
|
"scheduling", scheduling_method, pass_manager_config, optimization_level=0
|
86
78
|
)
|
@@ -107,7 +99,6 @@ def level_0_pass_manager(pass_manager_config: PassManagerConfig) -> StagedPassMa
|
|
107
99
|
layout=layout,
|
108
100
|
routing=routing,
|
109
101
|
translation=translation,
|
110
|
-
pre_optimization=pre_opt,
|
111
102
|
optimization=optimization,
|
112
103
|
scheduling=sched,
|
113
104
|
)
|