qiskit 1.4.1__cp39-abi3-macosx_11_0_arm64.whl → 2.0.0rc1__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 +2 -5
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/circuit/__init__.py +24 -5
- 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 +248 -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 +34 -5
- 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/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 +2 -6
- 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 +13 -60
- 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 +4 -0
- qiskit/circuit/quantumcircuit.py +881 -555
- 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 +4 -2
- 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 +5 -5
- 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 +2 -80
- 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 +141 -19
- qiskit/qpy/binary_io/__init__.py +0 -1
- qiskit/qpy/binary_io/circuits.py +91 -116
- qiskit/qpy/binary_io/schedules.py +61 -388
- qiskit/qpy/binary_io/value.py +154 -28
- qiskit/qpy/common.py +10 -7
- qiskit/qpy/formats.py +41 -0
- qiskit/qpy/interface.py +29 -62
- 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 -10
- qiskit/result/result.py +28 -126
- 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/discrete_basis/generate_basis_approximations.py +2 -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 +2 -40
- qiskit/transpiler/passes/basis/basis_translator.py +4 -3
- 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 +4 -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 +1 -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 +30 -2
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +20 -58
- qiskit/transpiler/passes/scheduling/padding/pad_delay.py +11 -3
- 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 +127 -59
- 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 +101 -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 +67 -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/dag_visualization.py +2 -1
- qiskit/visualization/gate_map.py +39 -154
- qiskit/visualization/pass_manager_visualization.py +6 -2
- qiskit/visualization/state_visualization.py +6 -0
- qiskit/visualization/timeline/core.py +18 -12
- qiskit/visualization/timeline/interface.py +19 -18
- {qiskit-1.4.1.dist-info → qiskit-2.0.0rc1.dist-info}/METADATA +2 -2
- {qiskit-1.4.1.dist-info → qiskit-2.0.0rc1.dist-info}/RECORD +297 -444
- {qiskit-1.4.1.dist-info → qiskit-2.0.0rc1.dist-info}/WHEEL +2 -1
- {qiskit-1.4.1.dist-info → qiskit-2.0.0rc1.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.1.dist-info → qiskit-2.0.0rc1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.4.1.dist-info → qiskit-2.0.0rc1.dist-info}/top_level.txt +0 -0
qiskit/providers/__init__.py
CHANGED
@@ -21,7 +21,7 @@ This module contains the classes used to build external providers for Qiskit. A
|
|
21
21
|
provider is anything that provides an external service to Qiskit. The typical
|
22
22
|
example of this is a Backend provider which provides
|
23
23
|
:class:`~qiskit.providers.Backend` objects which can be used for executing
|
24
|
-
:class:`~qiskit.circuit.QuantumCircuit`
|
24
|
+
:class:`~qiskit.circuit.QuantumCircuit`
|
25
25
|
objects. This module contains the abstract classes which are used to define the
|
26
26
|
interface between a provider and Qiskit.
|
27
27
|
|
@@ -75,15 +75,6 @@ mandatory/the minimum version).
|
|
75
75
|
Abstract Classes
|
76
76
|
================
|
77
77
|
|
78
|
-
Provider
|
79
|
-
--------
|
80
|
-
|
81
|
-
.. autosummary::
|
82
|
-
:toctree: ../stubs/
|
83
|
-
|
84
|
-
Provider
|
85
|
-
ProviderV1
|
86
|
-
|
87
78
|
Backend
|
88
79
|
-------
|
89
80
|
|
@@ -91,11 +82,8 @@ Backend
|
|
91
82
|
:toctree: ../stubs/
|
92
83
|
|
93
84
|
Backend
|
94
|
-
BackendV1
|
95
85
|
BackendV2
|
96
86
|
QubitProperties
|
97
|
-
BackendV2Converter
|
98
|
-
convert_to_target
|
99
87
|
|
100
88
|
Options
|
101
89
|
-------
|
@@ -126,10 +114,8 @@ Exceptions
|
|
126
114
|
----------
|
127
115
|
|
128
116
|
.. autoexception:: QiskitBackendNotFoundError
|
129
|
-
.. autoexception:: BackendPropertyError
|
130
117
|
.. autoexception:: JobError
|
131
118
|
.. autoexception:: JobTimeoutError
|
132
|
-
.. autoexception:: BackendConfigurationError
|
133
119
|
|
134
120
|
Writing a New Backend
|
135
121
|
=====================
|
@@ -142,8 +128,7 @@ method to get available :class:`~qiskit.providers.BackendV2` objects. The
|
|
142
128
|
a backend and its operation for the :mod:`~qiskit.transpiler` so that circuits
|
143
129
|
can be compiled to something that is optimized and can execute on the
|
144
130
|
backend. It also provides the :meth:`~qiskit.providers.BackendV2.run` method which can
|
145
|
-
run the :class:`~qiskit.circuit.QuantumCircuit` objects and
|
146
|
-
:class:`~qiskit.pulse.Schedule` objects. This enables users and other Qiskit
|
131
|
+
run the :class:`~qiskit.circuit.QuantumCircuit` objects. This enables users and other Qiskit
|
147
132
|
APIs to get results from
|
148
133
|
executing circuits on devices in a standard
|
149
134
|
fashion regardless of how the backend is implemented. At a high level the basic
|
@@ -568,7 +553,7 @@ which will block until the execution is complete and then will return a
|
|
568
553
|
For some backends (mainly local simulators) the execution of circuits is a
|
569
554
|
synchronous operation and there is no need to return a handle to a running job
|
570
555
|
elsewhere. For sync jobs its expected that the
|
571
|
-
:obj:`~qiskit.providers.
|
556
|
+
:obj:`~qiskit.providers.BackendV2.run` method on the backend will block until a
|
572
557
|
:class:`~qiskit.result.Result` object is generated and the sync job will return
|
573
558
|
with that inner :class:`~qiskit.result.Result` object.
|
574
559
|
|
@@ -612,7 +597,6 @@ An example job class for an async API based backend would look something like::
|
|
612
597
|
'backend_name': self._backend.configuration().backend_name,
|
613
598
|
'backend_version': self._backend.configuration().backend_version,
|
614
599
|
'job_id': self._job_id,
|
615
|
-
'qobj_id': ', '.join(x.name for x in self.circuits),
|
616
600
|
'success': True,
|
617
601
|
})
|
618
602
|
|
@@ -672,123 +656,15 @@ quasi-probabilities directly from mthree in the result. Doing this would
|
|
672
656
|
enable algorithms to get the best results with
|
673
657
|
mitigation applied directly from your backends. You can refer to the
|
674
658
|
documentation in :mod:`qiskit.primitives` on how to write custom
|
675
|
-
implementations. Also the built-in implementations: :class:`~.Sampler`,
|
659
|
+
implementations. Also, the built-in implementations: :class:`~.Sampler`,
|
676
660
|
:class:`~.Estimator`, :class:`~.BackendSampler`, and :class:`~.BackendEstimator`
|
677
661
|
can serve as references/models on how to implement these as well.
|
678
|
-
|
679
|
-
Migrating from BackendV1 to BackendV2
|
680
|
-
=====================================
|
681
|
-
|
682
|
-
The :obj:`~BackendV2` class re-defined user access for most properties of a
|
683
|
-
backend to make them work with native Qiskit data structures and have flatter
|
684
|
-
access patterns. However this means when using a provider that upgrades
|
685
|
-
from :obj:`~BackendV1` to :obj:`~BackendV2` existing access patterns will need
|
686
|
-
to be adjusted. It is expected for existing providers to deprecate the old
|
687
|
-
access where possible to provide a graceful migration, but eventually users
|
688
|
-
will need to adjust code. The biggest change to adapt to in :obj:`~BackendV2` is
|
689
|
-
that most of the information accessible about a backend is contained in its
|
690
|
-
:class:`~qiskit.transpiler.Target` object and the backend's attributes often query
|
691
|
-
its :attr:`~qiskit.providers.BackendV2.target`
|
692
|
-
attribute to return information, however in many cases the attributes only provide
|
693
|
-
a subset of information the target can contain. For example, ``backend.coupling_map``
|
694
|
-
returns a :class:`~qiskit.transpiler.CouplingMap` constructed from the
|
695
|
-
:class:`~qiskit.transpiler.Target` accessible in the
|
696
|
-
:attr:`~qiskit.providers.BackendV2.target` attribute, however the target may contain
|
697
|
-
instructions that operate on more than two qubits (which can't be represented in a
|
698
|
-
:class:`~qiskit.transpiler.CouplingMap`) or has instructions that only operate on
|
699
|
-
a subset of qubits (or two qubit links for a two qubit instruction) which won't be
|
700
|
-
detailed in the full coupling map returned by
|
701
|
-
:attr:`~qiskit.providers.BackendV2.coupling_map`. So depending on your use case
|
702
|
-
it might be necessary to look deeper than just the equivalent access with
|
703
|
-
:obj:`~BackendV2`.
|
704
|
-
|
705
|
-
Below is a table of example access patterns in :obj:`~BackendV1` and the new form
|
706
|
-
with :obj:`~BackendV2`:
|
707
|
-
|
708
|
-
.. list-table:: Migrate from :obj:`~BackendV1` to :obj:`~BackendV2`
|
709
|
-
:header-rows: 1
|
710
|
-
|
711
|
-
* - :obj:`~BackendV1`
|
712
|
-
- :obj:`~BackendV2`
|
713
|
-
- Notes
|
714
|
-
* - ``backend.configuration().n_qubits``
|
715
|
-
- ``backend.num_qubits``
|
716
|
-
-
|
717
|
-
* - ``backend.configuration().coupling_map``
|
718
|
-
- ``backend.coupling_map``
|
719
|
-
- The return from :obj:`~BackendV2` is a :class:`~qiskit.transpiler.CouplingMap` object.
|
720
|
-
while in :obj:`~BackendV1` it is an edge list. Also this is just a view of
|
721
|
-
the information contained in ``backend.target`` which may only be a subset of the
|
722
|
-
information contained in :class:`~qiskit.transpiler.Target` object.
|
723
|
-
* - ``backend.configuration().backend_name``
|
724
|
-
- ``backend.name``
|
725
|
-
-
|
726
|
-
* - ``backend.configuration().backend_version``
|
727
|
-
- ``backend.backend_version``
|
728
|
-
- The :attr:`~qiskit.providers.BackendV2.version` attribute represents
|
729
|
-
the version of the abstract :class:`~qiskit.providers.Backend` interface
|
730
|
-
the object implements while :attr:`~qiskit.providers.BackendV2.backend_version`
|
731
|
-
is metadata about the version of the backend itself.
|
732
|
-
* - ``backend.configuration().basis_gates``
|
733
|
-
- ``backend.operation_names``
|
734
|
-
- The :obj:`~BackendV2` return is a list of operation names contained in the
|
735
|
-
``backend.target`` attribute. The :class:`~qiskit.transpiler.Target` may contain more
|
736
|
-
information that can be expressed by this list of names. For example, that some
|
737
|
-
operations only work on a subset of qubits or that some names implement the same gate
|
738
|
-
with different parameters.
|
739
|
-
* - ``backend.configuration().dt``
|
740
|
-
- ``backend.dt``
|
741
|
-
-
|
742
|
-
* - ``backend.configuration().dtm``
|
743
|
-
- ``backend.dtm``
|
744
|
-
-
|
745
|
-
* - ``backend.configuration().max_experiments``
|
746
|
-
- ``backend.max_circuits``
|
747
|
-
-
|
748
|
-
* - ``backend.configuration().online_date``
|
749
|
-
- ``backend.online_date``
|
750
|
-
-
|
751
|
-
* - ``InstructionDurations.from_backend(backend)``
|
752
|
-
- ``backend.instruction_durations``
|
753
|
-
-
|
754
|
-
* - ``backend.defaults().instruction_schedule_map``
|
755
|
-
- ``backend.instruction_schedule_map``
|
756
|
-
-
|
757
|
-
* - ``backend.properties().t1(0)``
|
758
|
-
- ``backend.qubit_properties(0).t1``
|
759
|
-
-
|
760
|
-
* - ``backend.properties().t2(0)``
|
761
|
-
- ``backend.qubit_properties(0).t2``
|
762
|
-
-
|
763
|
-
* - ``backend.properties().frequency(0)``
|
764
|
-
- ``backend.qubit_properties(0).frequency``
|
765
|
-
-
|
766
|
-
* - ``backend.properties().readout_error(0)``
|
767
|
-
- ``backend.target["measure"][(0,)].error``
|
768
|
-
- In :obj:`~BackendV2` the error rate for the :class:`~qiskit.circuit.library.Measure`
|
769
|
-
operation on a given qubit is used to model the readout error. However a
|
770
|
-
:obj:`~BackendV2` can implement multiple measurement types and list them
|
771
|
-
separately in a :class:`~qiskit.transpiler.Target`.
|
772
|
-
* - ``backend.properties().readout_length(0)``
|
773
|
-
- ``backend.target["measure"][(0,)].duration``
|
774
|
-
- In :obj:`~BackendV2` the duration for the :class:`~qiskit.circuit.library.Measure`
|
775
|
-
operation on a given qubit is used to model the readout length. However, a
|
776
|
-
:obj:`~BackendV2` can implement multiple measurement types and list them
|
777
|
-
separately in a :class:`~qiskit.transpiler.Target`.
|
778
|
-
|
779
|
-
There is also a :class:`~.BackendV2Converter` class available that enables you
|
780
|
-
to wrap a :class:`~.BackendV1` object with a :class:`~.BackendV2` interface.
|
781
662
|
"""
|
782
663
|
|
783
664
|
# Providers interface
|
784
|
-
from qiskit.providers.provider import Provider
|
785
|
-
from qiskit.providers.provider import ProviderV1
|
786
665
|
from qiskit.providers.backend import Backend
|
787
|
-
from qiskit.providers.backend import BackendV1
|
788
666
|
from qiskit.providers.backend import BackendV2
|
789
667
|
from qiskit.providers.backend import QubitProperties
|
790
|
-
from qiskit.providers.backend_compat import BackendV2Converter
|
791
|
-
from qiskit.providers.backend_compat import convert_to_target
|
792
668
|
from qiskit.providers.options import Options
|
793
669
|
from qiskit.providers.job import Job
|
794
670
|
from qiskit.providers.job import JobV1
|
@@ -797,7 +673,5 @@ from qiskit.providers.exceptions import (
|
|
797
673
|
JobError,
|
798
674
|
JobTimeoutError,
|
799
675
|
QiskitBackendNotFoundError,
|
800
|
-
BackendPropertyError,
|
801
|
-
BackendConfigurationError,
|
802
676
|
)
|
803
677
|
from qiskit.providers.jobstatus import JobStatus
|
qiskit/providers/backend.py
CHANGED
@@ -18,13 +18,9 @@
|
|
18
18
|
from abc import ABC
|
19
19
|
from abc import abstractmethod
|
20
20
|
import datetime
|
21
|
-
from typing import List, Union,
|
21
|
+
from typing import List, Union, Tuple
|
22
22
|
|
23
|
-
from qiskit.providers.provider import Provider
|
24
|
-
from qiskit.providers.models.backendstatus import BackendStatus
|
25
23
|
from qiskit.circuit.gate import Instruction
|
26
|
-
from qiskit.utils import deprecate_func
|
27
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_dependency
|
28
24
|
|
29
25
|
|
30
26
|
class Backend:
|
@@ -39,213 +35,6 @@ class Backend:
|
|
39
35
|
version = 0
|
40
36
|
|
41
37
|
|
42
|
-
class BackendV1(Backend, ABC):
|
43
|
-
"""Abstract class for Backends
|
44
|
-
|
45
|
-
This abstract class is to be used for Backend objects.
|
46
|
-
There are several classes of information contained in a Backend.
|
47
|
-
The first are the attributes of the class itself. These should be used to
|
48
|
-
define the immutable characteristics of the backend. The ``options``
|
49
|
-
attribute of the backend is used to contain the dynamic user configurable
|
50
|
-
options of the backend. It should be used more for runtime options
|
51
|
-
that configure how the backend is used. For example, something like a
|
52
|
-
``shots`` field for a backend that runs experiments which would contain an
|
53
|
-
int for how many shots to execute. The ``properties`` attribute is
|
54
|
-
optionally defined :class:`~qiskit.providers.models.BackendProperties`
|
55
|
-
object and is used to return measured properties, or properties
|
56
|
-
of a backend that may change over time. The simplest example of this would
|
57
|
-
be a version string, which will change as a backend is updated, but also
|
58
|
-
could be something like noise parameters for backends that run experiments.
|
59
|
-
|
60
|
-
This first version of the Backend abstract class is written to be mostly
|
61
|
-
backwards compatible with the legacy providers interface. This includes reusing
|
62
|
-
the model objects :class:`~qiskit.providers.models.BackendProperties` and
|
63
|
-
:class:`~qiskit.providers.models.BackendConfiguration`. This was done to
|
64
|
-
ease the transition for users and provider maintainers to the new versioned providers.
|
65
|
-
Expect, future versions of this abstract class to change the data model and
|
66
|
-
interface.
|
67
|
-
|
68
|
-
Subclasses of this should override the public method :meth:`run` and the internal
|
69
|
-
:meth:`_default_options`:
|
70
|
-
|
71
|
-
.. automethod:: _default_options
|
72
|
-
"""
|
73
|
-
|
74
|
-
version = 1
|
75
|
-
|
76
|
-
@deprecate_func(
|
77
|
-
since="1.2",
|
78
|
-
removal_timeline="in the 2.0 release",
|
79
|
-
additional_msg="If the backend only encapsulates a hardware description, "
|
80
|
-
"consider constructing a Target directly. If it is part of a provider "
|
81
|
-
"that gives access to execution, consider using Primitives instead. "
|
82
|
-
"Alternatively, consider moving to BackendV2 (see https://qisk.it/backendV1-to-V2).",
|
83
|
-
)
|
84
|
-
def __init__(self, configuration, provider=None, **fields):
|
85
|
-
"""Initialize a backend class
|
86
|
-
|
87
|
-
Args:
|
88
|
-
configuration (BackendConfiguration): A backend configuration
|
89
|
-
object for the backend object.
|
90
|
-
provider (qiskit.providers.Provider): Optionally, the provider
|
91
|
-
object that this Backend comes from.
|
92
|
-
fields: kwargs for the values to use to override the default
|
93
|
-
options.
|
94
|
-
Raises:
|
95
|
-
AttributeError: if input field not a valid options
|
96
|
-
|
97
|
-
..
|
98
|
-
This next bit is necessary just because autosummary generally won't summarise private
|
99
|
-
methods; changing that behavior would have annoying knock-on effects through all the
|
100
|
-
rest of the documentation, so instead we just hard-code the automethod directive.
|
101
|
-
"""
|
102
|
-
self._configuration = configuration
|
103
|
-
self._options = self._default_options()
|
104
|
-
self._provider = provider
|
105
|
-
if fields:
|
106
|
-
for field in fields:
|
107
|
-
if field not in self._options.data:
|
108
|
-
raise AttributeError(f"Options field {field} is not valid for this backend")
|
109
|
-
self._options.update_config(**fields)
|
110
|
-
|
111
|
-
@classmethod
|
112
|
-
@abstractmethod
|
113
|
-
def _default_options(cls):
|
114
|
-
"""Return the default options
|
115
|
-
|
116
|
-
This method will return a :class:`qiskit.providers.Options`
|
117
|
-
subclass object that will be used for the default options. These
|
118
|
-
should be the default parameters to use for the options of the
|
119
|
-
backend.
|
120
|
-
|
121
|
-
Returns:
|
122
|
-
qiskit.providers.Options: A options object with
|
123
|
-
default values set
|
124
|
-
"""
|
125
|
-
|
126
|
-
def set_options(self, **fields):
|
127
|
-
"""Set the options fields for the backend
|
128
|
-
|
129
|
-
This method is used to update the options of a backend. If
|
130
|
-
you need to change any of the options prior to running just
|
131
|
-
pass in the kwarg with the new value for the options.
|
132
|
-
|
133
|
-
Args:
|
134
|
-
fields: The fields to update the options
|
135
|
-
|
136
|
-
Raises:
|
137
|
-
AttributeError: If the field passed in is not part of the
|
138
|
-
options
|
139
|
-
"""
|
140
|
-
for field in fields:
|
141
|
-
if not hasattr(self._options, field):
|
142
|
-
raise AttributeError(f"Options field {field} is not valid for this backend")
|
143
|
-
self._options.update_options(**fields)
|
144
|
-
|
145
|
-
def configuration(self):
|
146
|
-
"""Return the backend configuration.
|
147
|
-
|
148
|
-
Returns:
|
149
|
-
BackendConfiguration: the configuration for the backend.
|
150
|
-
"""
|
151
|
-
return self._configuration
|
152
|
-
|
153
|
-
def properties(self):
|
154
|
-
"""Return the backend properties.
|
155
|
-
|
156
|
-
Returns:
|
157
|
-
BackendProperties: the configuration for the backend. If the backend
|
158
|
-
does not support properties, it returns ``None``.
|
159
|
-
"""
|
160
|
-
return None
|
161
|
-
|
162
|
-
def provider(self):
|
163
|
-
"""Return the backend Provider.
|
164
|
-
|
165
|
-
Returns:
|
166
|
-
Provider: the Provider responsible for the backend.
|
167
|
-
"""
|
168
|
-
return self._provider
|
169
|
-
|
170
|
-
def status(self):
|
171
|
-
"""Return the backend status.
|
172
|
-
|
173
|
-
Returns:
|
174
|
-
BackendStatus: the status of the backend.
|
175
|
-
"""
|
176
|
-
return BackendStatus(
|
177
|
-
backend_name=self.name(),
|
178
|
-
backend_version="1",
|
179
|
-
operational=True,
|
180
|
-
pending_jobs=0,
|
181
|
-
status_msg="",
|
182
|
-
)
|
183
|
-
|
184
|
-
def name(self):
|
185
|
-
"""Return the backend name.
|
186
|
-
|
187
|
-
Returns:
|
188
|
-
str: the name of the backend.
|
189
|
-
"""
|
190
|
-
return self._configuration.backend_name
|
191
|
-
|
192
|
-
def __str__(self):
|
193
|
-
return self.name()
|
194
|
-
|
195
|
-
def __repr__(self):
|
196
|
-
"""Official string representation of a Backend.
|
197
|
-
|
198
|
-
Note that, by Qiskit convention, it is consciously *not* a fully valid
|
199
|
-
Python expression. Subclasses should provide 'a string of the form
|
200
|
-
<...some useful description...>'. [0]
|
201
|
-
|
202
|
-
[0] https://docs.python.org/3/reference/datamodel.html#object.__repr__
|
203
|
-
"""
|
204
|
-
return f"<{self.__class__.__name__}('{self.name()}')>"
|
205
|
-
|
206
|
-
@property
|
207
|
-
def options(self):
|
208
|
-
"""Return the options for the backend
|
209
|
-
|
210
|
-
The options of a backend are the dynamic parameters defining
|
211
|
-
how the backend is used. These are used to control the :meth:`run`
|
212
|
-
method.
|
213
|
-
"""
|
214
|
-
return self._options
|
215
|
-
|
216
|
-
@abstractmethod
|
217
|
-
def run(self, run_input, **options):
|
218
|
-
"""Run on the backend.
|
219
|
-
|
220
|
-
This method returns a :class:`~qiskit.providers.Job` object
|
221
|
-
that runs circuits. Depending on the backend this may be either an async
|
222
|
-
or sync call. It is at the discretion of the provider to decide whether
|
223
|
-
running should block until the execution is finished or not: the Job
|
224
|
-
class can handle either situation.
|
225
|
-
|
226
|
-
Args:
|
227
|
-
run_input (QuantumCircuit or Schedule or list): An individual or a
|
228
|
-
list of :class:`~qiskit.circuit.QuantumCircuit` or
|
229
|
-
:class:`~qiskit.pulse.Schedule` objects to run on the backend.
|
230
|
-
For legacy providers migrating to the new versioned providers,
|
231
|
-
provider interface a :class:`~qiskit.qobj.QasmQobj` or
|
232
|
-
:class:`~qiskit.qobj.PulseQobj` objects should probably be
|
233
|
-
supported too (but deprecated) for backwards compatibility. Be
|
234
|
-
sure to update the docstrings of subclasses implementing this
|
235
|
-
method to document that. New provider implementations should not
|
236
|
-
do this though as :mod:`qiskit.qobj` will be deprecated and
|
237
|
-
removed along with the legacy providers interface.
|
238
|
-
options: Any kwarg options to pass to the backend for running the
|
239
|
-
config. If a key is also present in the options
|
240
|
-
attribute/object then the expectation is that the value
|
241
|
-
specified will be used instead of what's set in the options
|
242
|
-
object.
|
243
|
-
Returns:
|
244
|
-
Job: The job object for the run
|
245
|
-
"""
|
246
|
-
pass
|
247
|
-
|
248
|
-
|
249
38
|
class QubitProperties:
|
250
39
|
"""A representation of the properties of a qubit on a backend.
|
251
40
|
|
@@ -290,13 +79,6 @@ class BackendV2(Backend, ABC):
|
|
290
79
|
something like a ``shots`` field for a backend that runs experiments which
|
291
80
|
would contain an int for how many shots to execute.
|
292
81
|
|
293
|
-
If migrating a provider from :class:`~qiskit.providers.BackendV1`
|
294
|
-
one thing to keep in mind is for
|
295
|
-
backwards compatibility you might need to add a configuration method that
|
296
|
-
will build a :class:`~qiskit.providers.models.BackendConfiguration` object
|
297
|
-
and :class:`~qiskit.providers.models.BackendProperties` from the attributes
|
298
|
-
defined in this class for backwards compatibility.
|
299
|
-
|
300
82
|
A backend object can optionally contain methods named
|
301
83
|
``get_translation_stage_plugin`` and ``get_scheduling_stage_plugin``. If these
|
302
84
|
methods are present on a backend object and this object is used for
|
@@ -327,7 +109,7 @@ class BackendV2(Backend, ABC):
|
|
327
109
|
|
328
110
|
def __init__(
|
329
111
|
self,
|
330
|
-
provider
|
112
|
+
provider=None,
|
331
113
|
name: str = None,
|
332
114
|
description: str = None,
|
333
115
|
online_date: datetime.datetime = None,
|
@@ -337,9 +119,8 @@ class BackendV2(Backend, ABC):
|
|
337
119
|
"""Initialize a BackendV2 based backend
|
338
120
|
|
339
121
|
Args:
|
340
|
-
provider: An optional backwards reference to the
|
341
|
-
|
342
|
-
is from
|
122
|
+
provider: An optional backwards reference to the provider
|
123
|
+
object that the backend is from
|
343
124
|
name: An optional name for the backend
|
344
125
|
description: An optional description of the backend
|
345
126
|
online_date: An optional datetime the backend was brought online
|
@@ -361,9 +142,9 @@ class BackendV2(Backend, ABC):
|
|
361
142
|
self._provider = provider
|
362
143
|
if fields:
|
363
144
|
for field in fields:
|
364
|
-
if field not in self._options
|
145
|
+
if field not in self._options:
|
365
146
|
raise AttributeError(f"Options field {field} is not valid for this backend")
|
366
|
-
self._options.
|
147
|
+
self._options.update_options(**fields)
|
367
148
|
self.name = name
|
368
149
|
"""Name of the backend."""
|
369
150
|
self.description = description
|
@@ -420,7 +201,7 @@ class BackendV2(Backend, ABC):
|
|
420
201
|
@property
|
421
202
|
@abstractmethod
|
422
203
|
def max_circuits(self):
|
423
|
-
"""The maximum number of circuits
|
204
|
+
"""The maximum number of circuits that can be
|
424
205
|
run in a single job.
|
425
206
|
|
426
207
|
If there is no limit this will return None
|
@@ -485,18 +266,6 @@ class BackendV2(Backend, ABC):
|
|
485
266
|
"""
|
486
267
|
raise NotImplementedError
|
487
268
|
|
488
|
-
@property
|
489
|
-
@deprecate_pulse_dependency(is_property=True)
|
490
|
-
def instruction_schedule_map(self):
|
491
|
-
"""Return the :class:`~qiskit.pulse.InstructionScheduleMap` for the
|
492
|
-
instructions defined in this backend's target."""
|
493
|
-
return self._instruction_schedule_map
|
494
|
-
|
495
|
-
@property
|
496
|
-
def _instruction_schedule_map(self):
|
497
|
-
"""An alternative private path to be used internally to avoid pulse deprecation warnings."""
|
498
|
-
return self.target._get_instruction_schedule_map()
|
499
|
-
|
500
269
|
def qubit_properties(
|
501
270
|
self, qubit: Union[int, List[int]]
|
502
271
|
) -> Union[QubitProperties, List[QubitProperties]]:
|
@@ -531,77 +300,6 @@ class BackendV2(Backend, ABC):
|
|
531
300
|
return self.target.qubit_properties[qubit]
|
532
301
|
return [self.target.qubit_properties[q] for q in qubit]
|
533
302
|
|
534
|
-
@deprecate_pulse_dependency
|
535
|
-
def drive_channel(self, qubit: int):
|
536
|
-
"""Return the drive channel for the given qubit.
|
537
|
-
|
538
|
-
This is required to be implemented if the backend supports Pulse
|
539
|
-
scheduling.
|
540
|
-
|
541
|
-
Returns:
|
542
|
-
DriveChannel: The Qubit drive channel
|
543
|
-
|
544
|
-
Raises:
|
545
|
-
NotImplementedError: if the backend doesn't support querying the
|
546
|
-
measurement mapping
|
547
|
-
"""
|
548
|
-
raise NotImplementedError
|
549
|
-
|
550
|
-
@deprecate_pulse_dependency
|
551
|
-
def measure_channel(self, qubit: int):
|
552
|
-
"""Return the measure stimulus channel for the given qubit.
|
553
|
-
|
554
|
-
This is required to be implemented if the backend supports Pulse
|
555
|
-
scheduling.
|
556
|
-
|
557
|
-
Returns:
|
558
|
-
MeasureChannel: The Qubit measurement stimulus line
|
559
|
-
|
560
|
-
Raises:
|
561
|
-
NotImplementedError: if the backend doesn't support querying the
|
562
|
-
measurement mapping
|
563
|
-
"""
|
564
|
-
raise NotImplementedError
|
565
|
-
|
566
|
-
@deprecate_pulse_dependency
|
567
|
-
def acquire_channel(self, qubit: int):
|
568
|
-
"""Return the acquisition channel for the given qubit.
|
569
|
-
|
570
|
-
This is required to be implemented if the backend supports Pulse
|
571
|
-
scheduling.
|
572
|
-
|
573
|
-
Returns:
|
574
|
-
AcquireChannel: The Qubit measurement acquisition line.
|
575
|
-
|
576
|
-
Raises:
|
577
|
-
NotImplementedError: if the backend doesn't support querying the
|
578
|
-
measurement mapping
|
579
|
-
"""
|
580
|
-
raise NotImplementedError
|
581
|
-
|
582
|
-
@deprecate_pulse_dependency
|
583
|
-
def control_channel(self, qubits: Iterable[int]):
|
584
|
-
"""Return the secondary drive channel for the given qubit
|
585
|
-
|
586
|
-
This is typically utilized for controlling multiqubit interactions.
|
587
|
-
This channel is derived from other channels.
|
588
|
-
|
589
|
-
This is required to be implemented if the backend supports Pulse
|
590
|
-
scheduling.
|
591
|
-
|
592
|
-
Args:
|
593
|
-
qubits: Tuple or list of qubits of the form
|
594
|
-
``(control_qubit, target_qubit)``.
|
595
|
-
|
596
|
-
Returns:
|
597
|
-
List[ControlChannel]: The multi qubit control line.
|
598
|
-
|
599
|
-
Raises:
|
600
|
-
NotImplementedError: if the backend doesn't support querying the
|
601
|
-
measurement mapping
|
602
|
-
"""
|
603
|
-
raise NotImplementedError
|
604
|
-
|
605
303
|
def set_options(self, **fields):
|
606
304
|
"""Set the options fields for the backend
|
607
305
|
|
@@ -633,10 +331,10 @@ class BackendV2(Backend, ABC):
|
|
633
331
|
|
634
332
|
@property
|
635
333
|
def provider(self):
|
636
|
-
"""Return the backend
|
334
|
+
"""Return the backend provider.
|
637
335
|
|
638
336
|
Returns:
|
639
|
-
|
337
|
+
provider: the provider responsible for the backend.
|
640
338
|
"""
|
641
339
|
return self._provider
|
642
340
|
|
@@ -651,9 +349,8 @@ class BackendV2(Backend, ABC):
|
|
651
349
|
class can handle either situation.
|
652
350
|
|
653
351
|
Args:
|
654
|
-
run_input (QuantumCircuit or
|
655
|
-
individual or a list of :class:`.QuantumCircuit
|
656
|
-
:class:`~qiskit.pulse.ScheduleBlock`, or :class:`~qiskit.pulse.Schedule` objects to
|
352
|
+
run_input (QuantumCircuit or list): An
|
353
|
+
individual or a list of :class:`.QuantumCircuit` objects to
|
657
354
|
run on the backend.
|
658
355
|
options: Any kwarg options to pass to the backend for running the
|
659
356
|
config. If a key is also present in the options
|
@@ -20,7 +20,9 @@ BasicProvider: Python-based Simulators (:mod:`qiskit.providers.basic_provider`)
|
|
20
20
|
A module of Python-based quantum simulators. Simulators can be accessed
|
21
21
|
via the `BasicProvider` provider, e.g.:
|
22
22
|
|
23
|
-
..
|
23
|
+
.. plot::
|
24
|
+
:include-source:
|
25
|
+
:nofigs:
|
24
26
|
|
25
27
|
from qiskit.providers.basic_provider import BasicProvider
|
26
28
|
|
@@ -23,7 +23,6 @@ import logging
|
|
23
23
|
|
24
24
|
from qiskit.exceptions import QiskitError
|
25
25
|
from qiskit.providers.backend import Backend
|
26
|
-
from qiskit.providers.provider import ProviderV1
|
27
26
|
from qiskit.providers.exceptions import QiskitBackendNotFoundError
|
28
27
|
from qiskit.providers.providerutils import filter_backends
|
29
28
|
|
@@ -35,7 +34,7 @@ logger = logging.getLogger(__name__)
|
|
35
34
|
SIMULATORS = [BasicSimulator]
|
36
35
|
|
37
36
|
|
38
|
-
class BasicProvider
|
37
|
+
class BasicProvider:
|
39
38
|
"""Provider for test simulators."""
|
40
39
|
|
41
40
|
def __init__(self) -> None:
|
@@ -44,12 +43,33 @@ class BasicProvider(ProviderV1):
|
|
44
43
|
# Populate the list of test backends (simulators)
|
45
44
|
self._backends = self._verify_backends()
|
46
45
|
|
47
|
-
def get_backend(self, name
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
def get_backend(self, name=None, **kwargs):
|
47
|
+
"""Return a single backend matching the specified filtering.
|
48
|
+
Args:
|
49
|
+
name (str): name of the backend.
|
50
|
+
**kwargs: dict used for filtering.
|
51
|
+
Returns:
|
52
|
+
Backend: a backend matching the filtering.
|
53
|
+
Raises:
|
54
|
+
QiskitBackendNotFoundError: if no backend could be found or
|
55
|
+
more than one backend matches the filtering criteria.
|
56
|
+
"""
|
57
|
+
backends = self.backends(name, **kwargs)
|
58
|
+
if len(backends) > 1:
|
59
|
+
raise QiskitBackendNotFoundError("More than one backend matches the criteria")
|
60
|
+
if not backends:
|
61
|
+
raise QiskitBackendNotFoundError("No backend matches the criteria")
|
62
|
+
return backends[0]
|
63
|
+
|
64
|
+
def backends(self, name: str | None = None, filters: Callable | None = None) -> list[Backend]:
|
65
|
+
"""Return a list of backends matching the specified filtering.
|
66
|
+
Args:
|
67
|
+
name: name of the backend.
|
68
|
+
filters: callable for filtering.
|
69
|
+
Returns:
|
70
|
+
list[Backend]: a list of Backends that match the filtering
|
71
|
+
criteria.
|
72
|
+
"""
|
53
73
|
backends = self._backends.values()
|
54
74
|
if name:
|
55
75
|
available = [
|
@@ -59,7 +79,7 @@ class BasicProvider(ProviderV1):
|
|
59
79
|
raise QiskitBackendNotFoundError(
|
60
80
|
f"The '{name}' backend is not installed in your system."
|
61
81
|
)
|
62
|
-
return filter_backends(backends, filters=filters
|
82
|
+
return filter_backends(backends, filters=filters)
|
63
83
|
|
64
84
|
def _verify_backends(self) -> OrderedDict[str, Backend]:
|
65
85
|
"""
|