qiskit 1.4.1__cp39-abi3-win_amd64.whl → 2.0.0rc1__cp39-abi3-win_amd64.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.pyd +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 +1 -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
@@ -1,424 +0,0 @@
|
|
1
|
-
# This code is part of Qiskit.
|
2
|
-
#
|
3
|
-
# (C) Copyright IBM 2019.
|
4
|
-
#
|
5
|
-
# This code is licensed under the Apache License, Version 2.0. You may
|
6
|
-
# obtain a copy of this license in the LICENSE.txt file in the root directory
|
7
|
-
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
|
8
|
-
#
|
9
|
-
# Any modifications or derivative works of this code must retain this
|
10
|
-
# copyright notice, and modified files need to carry a notice indicating
|
11
|
-
# that they have been altered from the originals.
|
12
|
-
|
13
|
-
# pylint: disable=unused-import
|
14
|
-
|
15
|
-
"""
|
16
|
-
A convenient way to track reusable subschedules by name and qubit.
|
17
|
-
|
18
|
-
This can be used for scheduling circuits with custom definitions, for instance::
|
19
|
-
|
20
|
-
inst_map = InstructionScheduleMap()
|
21
|
-
inst_map.add('new_inst', 0, qubit_0_new_inst_schedule)
|
22
|
-
|
23
|
-
sched = schedule(quantum_circuit, backend, inst_map)
|
24
|
-
|
25
|
-
An instance of this class is instantiated by Pulse-enabled backends and populated with defaults
|
26
|
-
(if available)::
|
27
|
-
|
28
|
-
inst_map = backend.defaults().instruction_schedule_map
|
29
|
-
|
30
|
-
"""
|
31
|
-
from __future__ import annotations
|
32
|
-
import functools
|
33
|
-
import warnings
|
34
|
-
from collections import defaultdict
|
35
|
-
from collections.abc import Iterable, Callable
|
36
|
-
|
37
|
-
from qiskit import circuit
|
38
|
-
from qiskit.circuit.parameterexpression import ParameterExpression
|
39
|
-
from qiskit.pulse.calibration_entries import (
|
40
|
-
CalibrationEntry,
|
41
|
-
ScheduleDef,
|
42
|
-
CallableDef,
|
43
|
-
# for backward compatibility
|
44
|
-
PulseQobjDef,
|
45
|
-
CalibrationPublisher,
|
46
|
-
)
|
47
|
-
from qiskit.pulse.exceptions import PulseError
|
48
|
-
from qiskit.pulse.schedule import Schedule, ScheduleBlock
|
49
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
50
|
-
|
51
|
-
|
52
|
-
class InstructionScheduleMap:
|
53
|
-
"""Mapping from :py:class:`~qiskit.circuit.QuantumCircuit`
|
54
|
-
:py:class:`qiskit.circuit.Instruction` names and qubits to
|
55
|
-
:py:class:`~qiskit.pulse.Schedule` s. In particular, the mapping is formatted as type::
|
56
|
-
|
57
|
-
Dict[str, Dict[Tuple[int], Schedule]]
|
58
|
-
|
59
|
-
where the first key is the name of a circuit instruction (e.g. ``'u1'``, ``'measure'``), the
|
60
|
-
second key is a tuple of qubit indices, and the final value is a Schedule implementing the
|
61
|
-
requested instruction.
|
62
|
-
|
63
|
-
These can usually be seen as gate calibrations.
|
64
|
-
"""
|
65
|
-
|
66
|
-
@deprecate_pulse_func
|
67
|
-
def __init__(self):
|
68
|
-
"""Initialize a circuit instruction to schedule mapper instance."""
|
69
|
-
# The processed and reformatted circuit instruction definitions
|
70
|
-
|
71
|
-
# Do not use lambda function for nested defaultdict, i.e. lambda: defaultdict(CalibrationEntry).
|
72
|
-
# This crashes qiskit parallel. Note that parallel framework passes args as
|
73
|
-
# pickled object, however lambda function cannot be pickled.
|
74
|
-
self._map: dict[str | circuit.instruction.Instruction, dict[tuple, CalibrationEntry]] = (
|
75
|
-
defaultdict(functools.partial(defaultdict, CalibrationEntry))
|
76
|
-
)
|
77
|
-
|
78
|
-
# A backwards mapping from qubit to supported instructions
|
79
|
-
self._qubit_instructions: dict[tuple[int, ...], set] = defaultdict(set)
|
80
|
-
|
81
|
-
def has_custom_gate(self) -> bool:
|
82
|
-
"""Return ``True`` if the map has user provided instruction."""
|
83
|
-
for qubit_inst in self._map.values():
|
84
|
-
for entry in qubit_inst.values():
|
85
|
-
if entry.user_provided:
|
86
|
-
return True
|
87
|
-
return False
|
88
|
-
|
89
|
-
@property
|
90
|
-
def instructions(self) -> list[str]:
|
91
|
-
"""Return all instructions which have definitions.
|
92
|
-
|
93
|
-
By default, these are typically the basis gates along with other instructions such as
|
94
|
-
measure and reset.
|
95
|
-
|
96
|
-
Returns:
|
97
|
-
The names of all the circuit instructions which have Schedule definitions in this.
|
98
|
-
"""
|
99
|
-
return list(self._map.keys())
|
100
|
-
|
101
|
-
def qubits_with_instruction(
|
102
|
-
self, instruction: str | circuit.instruction.Instruction
|
103
|
-
) -> list[int | tuple[int, ...]]:
|
104
|
-
"""Return a list of the qubits for which the given instruction is defined. Single qubit
|
105
|
-
instructions return a flat list, and multiqubit instructions return a list of ordered
|
106
|
-
tuples.
|
107
|
-
|
108
|
-
Args:
|
109
|
-
instruction: The name of the circuit instruction.
|
110
|
-
|
111
|
-
Returns:
|
112
|
-
Qubit indices which have the given instruction defined. This is a list of tuples if the
|
113
|
-
instruction has an arity greater than 1, or a flat list of ints otherwise.
|
114
|
-
|
115
|
-
Raises:
|
116
|
-
PulseError: If the instruction is not found.
|
117
|
-
"""
|
118
|
-
instruction = _get_instruction_string(instruction)
|
119
|
-
if instruction not in self._map:
|
120
|
-
return []
|
121
|
-
return [
|
122
|
-
qubits[0] if len(qubits) == 1 else qubits
|
123
|
-
for qubits in sorted(self._map[instruction].keys())
|
124
|
-
]
|
125
|
-
|
126
|
-
def qubit_instructions(self, qubits: int | Iterable[int]) -> list[str]:
|
127
|
-
"""Return a list of the instruction names that are defined by the backend for the given
|
128
|
-
qubit or qubits.
|
129
|
-
|
130
|
-
Args:
|
131
|
-
qubits: A qubit index, or a list or tuple of indices.
|
132
|
-
|
133
|
-
Returns:
|
134
|
-
All the instructions which are defined on the qubits.
|
135
|
-
|
136
|
-
For 1 qubit, all the 1Q instructions defined. For multiple qubits, all the instructions
|
137
|
-
which apply to that whole set of qubits (e.g. ``qubits=[0, 1]`` may return ``['cx']``).
|
138
|
-
"""
|
139
|
-
if _to_tuple(qubits) in self._qubit_instructions:
|
140
|
-
return list(self._qubit_instructions[_to_tuple(qubits)])
|
141
|
-
return []
|
142
|
-
|
143
|
-
def has(
|
144
|
-
self, instruction: str | circuit.instruction.Instruction, qubits: int | Iterable[int]
|
145
|
-
) -> bool:
|
146
|
-
"""Is the instruction defined for the given qubits?
|
147
|
-
|
148
|
-
Args:
|
149
|
-
instruction: The instruction for which to look.
|
150
|
-
qubits: The specific qubits for the instruction.
|
151
|
-
|
152
|
-
Returns:
|
153
|
-
True iff the instruction is defined.
|
154
|
-
"""
|
155
|
-
instruction = _get_instruction_string(instruction)
|
156
|
-
return instruction in self._map and _to_tuple(qubits) in self._map[instruction]
|
157
|
-
|
158
|
-
def assert_has(
|
159
|
-
self, instruction: str | circuit.instruction.Instruction, qubits: int | Iterable[int]
|
160
|
-
) -> None:
|
161
|
-
"""Error if the given instruction is not defined.
|
162
|
-
|
163
|
-
Args:
|
164
|
-
instruction: The instruction for which to look.
|
165
|
-
qubits: The specific qubits for the instruction.
|
166
|
-
|
167
|
-
Raises:
|
168
|
-
PulseError: If the instruction is not defined on the qubits.
|
169
|
-
"""
|
170
|
-
instruction = _get_instruction_string(instruction)
|
171
|
-
if not self.has(instruction, _to_tuple(qubits)):
|
172
|
-
# TODO: PulseError is deprecated, this code will be removed in 2.0.
|
173
|
-
# In the meantime, we catch the deprecation
|
174
|
-
# warning not to overload users with non-actionable messages
|
175
|
-
with warnings.catch_warnings():
|
176
|
-
warnings.filterwarnings(
|
177
|
-
"ignore",
|
178
|
-
category=DeprecationWarning,
|
179
|
-
message=".*The entire Qiskit Pulse package*",
|
180
|
-
module="qiskit",
|
181
|
-
)
|
182
|
-
if instruction in self._map:
|
183
|
-
raise PulseError(
|
184
|
-
f"Operation '{instruction}' exists, but is only defined for qubits "
|
185
|
-
f"{self.qubits_with_instruction(instruction)}."
|
186
|
-
)
|
187
|
-
raise PulseError(f"Operation '{instruction}' is not defined for this system.")
|
188
|
-
|
189
|
-
def get(
|
190
|
-
self,
|
191
|
-
instruction: str | circuit.instruction.Instruction,
|
192
|
-
qubits: int | Iterable[int],
|
193
|
-
*params: complex | ParameterExpression,
|
194
|
-
**kwparams: complex | ParameterExpression,
|
195
|
-
) -> Schedule | ScheduleBlock:
|
196
|
-
"""Return the defined :py:class:`~qiskit.pulse.Schedule` or
|
197
|
-
:py:class:`~qiskit.pulse.ScheduleBlock` for the given instruction on the given qubits.
|
198
|
-
|
199
|
-
If all keys are not specified this method returns schedule with unbound parameters.
|
200
|
-
|
201
|
-
Args:
|
202
|
-
instruction: Name of the instruction or the instruction itself.
|
203
|
-
qubits: The qubits for the instruction.
|
204
|
-
*params: Command parameters for generating the output schedule.
|
205
|
-
**kwparams: Keyworded command parameters for generating the schedule.
|
206
|
-
|
207
|
-
Returns:
|
208
|
-
The Schedule defined for the input.
|
209
|
-
"""
|
210
|
-
return self._get_calibration_entry(instruction, qubits).get_schedule(*params, **kwparams)
|
211
|
-
|
212
|
-
def _get_calibration_entry(
|
213
|
-
self,
|
214
|
-
instruction: str | circuit.instruction.Instruction,
|
215
|
-
qubits: int | Iterable[int],
|
216
|
-
) -> CalibrationEntry:
|
217
|
-
"""Return the :class:`.CalibrationEntry` without generating schedule.
|
218
|
-
|
219
|
-
When calibration entry is un-parsed Pulse Qobj, this returns calibration
|
220
|
-
without parsing it. :meth:`CalibrationEntry.get_schedule` method
|
221
|
-
must be manually called with assigned parameters to get corresponding pulse schedule.
|
222
|
-
|
223
|
-
This method is expected be directly used internally by the V2 backend converter
|
224
|
-
for faster loading of the backend calibrations.
|
225
|
-
|
226
|
-
Args:
|
227
|
-
instruction: Name of the instruction or the instruction itself.
|
228
|
-
qubits: The qubits for the instruction.
|
229
|
-
|
230
|
-
Returns:
|
231
|
-
The calibration entry.
|
232
|
-
"""
|
233
|
-
instruction = _get_instruction_string(instruction)
|
234
|
-
self.assert_has(instruction, qubits)
|
235
|
-
|
236
|
-
return self._map[instruction][_to_tuple(qubits)]
|
237
|
-
|
238
|
-
def add(
|
239
|
-
self,
|
240
|
-
instruction: str | circuit.instruction.Instruction,
|
241
|
-
qubits: int | Iterable[int],
|
242
|
-
schedule: Schedule | ScheduleBlock | Callable[..., Schedule | ScheduleBlock],
|
243
|
-
arguments: list[str] | None = None,
|
244
|
-
) -> None:
|
245
|
-
"""Add a new known instruction for the given qubits and its mapping to a pulse schedule.
|
246
|
-
|
247
|
-
Args:
|
248
|
-
instruction: The name of the instruction to add.
|
249
|
-
qubits: The qubits which the instruction applies to.
|
250
|
-
schedule: The Schedule that implements the given instruction.
|
251
|
-
arguments: List of parameter names to create a parameter-bound schedule from the
|
252
|
-
associated gate instruction. If :py:meth:`get` is called with arguments rather
|
253
|
-
than keyword arguments, this parameter list is used to map the input arguments to
|
254
|
-
parameter objects stored in the target schedule.
|
255
|
-
|
256
|
-
Raises:
|
257
|
-
PulseError: If the qubits are provided as an empty iterable.
|
258
|
-
"""
|
259
|
-
instruction = _get_instruction_string(instruction)
|
260
|
-
|
261
|
-
# validation of target qubit
|
262
|
-
qubits = _to_tuple(qubits)
|
263
|
-
if not qubits:
|
264
|
-
raise PulseError(f"Cannot add definition {instruction} with no target qubits.")
|
265
|
-
|
266
|
-
# generate signature
|
267
|
-
if isinstance(schedule, (Schedule, ScheduleBlock)):
|
268
|
-
entry: CalibrationEntry = ScheduleDef(arguments)
|
269
|
-
elif callable(schedule):
|
270
|
-
if arguments:
|
271
|
-
warnings.warn(
|
272
|
-
"Arguments are overruled by the callback function signature. "
|
273
|
-
"Input `arguments` are ignored.",
|
274
|
-
UserWarning,
|
275
|
-
)
|
276
|
-
entry = CallableDef()
|
277
|
-
else:
|
278
|
-
raise PulseError(
|
279
|
-
"Supplied schedule must be one of the Schedule, ScheduleBlock or a "
|
280
|
-
"callable that outputs a schedule."
|
281
|
-
)
|
282
|
-
entry.define(schedule, user_provided=True)
|
283
|
-
self._add(instruction, qubits, entry)
|
284
|
-
|
285
|
-
def _add(
|
286
|
-
self,
|
287
|
-
instruction_name: str,
|
288
|
-
qubits: tuple[int, ...],
|
289
|
-
entry: CalibrationEntry,
|
290
|
-
):
|
291
|
-
"""A method to resister calibration entry.
|
292
|
-
|
293
|
-
.. note::
|
294
|
-
|
295
|
-
This is internal fast-path function, and caller must ensure
|
296
|
-
the entry is properly formatted. This function may be used by other programs
|
297
|
-
that load backend calibrations to create Qiskit representation of it.
|
298
|
-
|
299
|
-
Args:
|
300
|
-
instruction_name: Name of instruction.
|
301
|
-
qubits: List of qubits that this calibration is applied.
|
302
|
-
entry: Calibration entry to register.
|
303
|
-
|
304
|
-
:meta public:
|
305
|
-
"""
|
306
|
-
self._map[instruction_name][qubits] = entry
|
307
|
-
self._qubit_instructions[qubits].add(instruction_name)
|
308
|
-
|
309
|
-
def remove(
|
310
|
-
self, instruction: str | circuit.instruction.Instruction, qubits: int | Iterable[int]
|
311
|
-
) -> None:
|
312
|
-
"""Remove the given instruction from the listing of instructions defined in self.
|
313
|
-
|
314
|
-
Args:
|
315
|
-
instruction: The name of the instruction to add.
|
316
|
-
qubits: The qubits which the instruction applies to.
|
317
|
-
"""
|
318
|
-
instruction = _get_instruction_string(instruction)
|
319
|
-
qubits = _to_tuple(qubits)
|
320
|
-
self.assert_has(instruction, qubits)
|
321
|
-
|
322
|
-
del self._map[instruction][qubits]
|
323
|
-
if not self._map[instruction]:
|
324
|
-
del self._map[instruction]
|
325
|
-
|
326
|
-
self._qubit_instructions[qubits].remove(instruction)
|
327
|
-
if not self._qubit_instructions[qubits]:
|
328
|
-
del self._qubit_instructions[qubits]
|
329
|
-
|
330
|
-
def pop(
|
331
|
-
self,
|
332
|
-
instruction: str | circuit.instruction.Instruction,
|
333
|
-
qubits: int | Iterable[int],
|
334
|
-
*params: complex | ParameterExpression,
|
335
|
-
**kwparams: complex | ParameterExpression,
|
336
|
-
) -> Schedule | ScheduleBlock:
|
337
|
-
"""Remove and return the defined schedule for the given instruction on the given
|
338
|
-
qubits.
|
339
|
-
|
340
|
-
Args:
|
341
|
-
instruction: Name of the instruction.
|
342
|
-
qubits: The qubits for the instruction.
|
343
|
-
*params: Command parameters for generating the output schedule.
|
344
|
-
**kwparams: Keyworded command parameters for generating the schedule.
|
345
|
-
|
346
|
-
Returns:
|
347
|
-
The Schedule defined for the input.
|
348
|
-
"""
|
349
|
-
instruction = _get_instruction_string(instruction)
|
350
|
-
schedule = self.get(instruction, qubits, *params, **kwparams)
|
351
|
-
self.remove(instruction, qubits)
|
352
|
-
return schedule
|
353
|
-
|
354
|
-
def get_parameters(
|
355
|
-
self, instruction: str | circuit.instruction.Instruction, qubits: int | Iterable[int]
|
356
|
-
) -> tuple[str, ...]:
|
357
|
-
"""Return the list of parameters taken by the given instruction on the given qubits.
|
358
|
-
|
359
|
-
Args:
|
360
|
-
instruction: Name of the instruction.
|
361
|
-
qubits: The qubits for the instruction.
|
362
|
-
|
363
|
-
Returns:
|
364
|
-
The names of the parameters required by the instruction.
|
365
|
-
"""
|
366
|
-
instruction = _get_instruction_string(instruction)
|
367
|
-
|
368
|
-
self.assert_has(instruction, qubits)
|
369
|
-
with warnings.catch_warnings():
|
370
|
-
warnings.simplefilter(action="ignore", category=DeprecationWarning)
|
371
|
-
# Prevent `get_signature` from emitting pulse package deprecation warnings
|
372
|
-
signature = self._map[instruction][_to_tuple(qubits)].get_signature()
|
373
|
-
return tuple(signature.parameters.keys())
|
374
|
-
|
375
|
-
def __str__(self):
|
376
|
-
single_q_insts = "1Q instructions:\n"
|
377
|
-
multi_q_insts = "Multi qubit instructions:\n"
|
378
|
-
for qubits, insts in self._qubit_instructions.items():
|
379
|
-
if len(qubits) == 1:
|
380
|
-
single_q_insts += f" q{qubits[0]}: {insts}\n"
|
381
|
-
else:
|
382
|
-
multi_q_insts += f" {qubits}: {insts}\n"
|
383
|
-
instructions = single_q_insts + multi_q_insts
|
384
|
-
return f"<{self.__class__.__name__}({instructions})>"
|
385
|
-
|
386
|
-
def __eq__(self, other):
|
387
|
-
if not isinstance(other, InstructionScheduleMap):
|
388
|
-
return False
|
389
|
-
|
390
|
-
for inst in self.instructions:
|
391
|
-
for qinds in self.qubits_with_instruction(inst):
|
392
|
-
try:
|
393
|
-
if self._map[inst][_to_tuple(qinds)] != other._map[inst][_to_tuple(qinds)]:
|
394
|
-
return False
|
395
|
-
except KeyError:
|
396
|
-
return False
|
397
|
-
return True
|
398
|
-
|
399
|
-
|
400
|
-
def _to_tuple(values: int | Iterable[int]) -> tuple[int, ...]:
|
401
|
-
"""Return the input as a tuple.
|
402
|
-
|
403
|
-
Args:
|
404
|
-
values: An integer, or iterable of integers.
|
405
|
-
|
406
|
-
Returns:
|
407
|
-
The input values as a sorted tuple.
|
408
|
-
"""
|
409
|
-
try:
|
410
|
-
return tuple(values)
|
411
|
-
except TypeError:
|
412
|
-
return (values,)
|
413
|
-
|
414
|
-
|
415
|
-
def _get_instruction_string(inst: str | circuit.instruction.Instruction) -> str:
|
416
|
-
if isinstance(inst, str):
|
417
|
-
return inst
|
418
|
-
else:
|
419
|
-
try:
|
420
|
-
return inst.name
|
421
|
-
except AttributeError as ex:
|
422
|
-
raise PulseError(
|
423
|
-
'Input "inst" has no attribute "name". This should be a circuit "Instruction".'
|
424
|
-
) from ex
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# This code is part of Qiskit.
|
2
|
-
#
|
3
|
-
# (C) Copyright IBM 2020.
|
4
|
-
#
|
5
|
-
# This code is licensed under the Apache License, Version 2.0. You may
|
6
|
-
# obtain a copy of this license in the LICENSE.txt file in the root directory
|
7
|
-
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
|
8
|
-
#
|
9
|
-
# Any modifications or derivative works of this code must retain this
|
10
|
-
# copyright notice, and modified files need to carry a notice indicating
|
11
|
-
# that they have been altered from the originals.
|
12
|
-
|
13
|
-
r"""
|
14
|
-
.. _pulse-insts:
|
15
|
-
|
16
|
-
===============================================
|
17
|
-
Instructions (:mod:`qiskit.pulse.instructions`)
|
18
|
-
===============================================
|
19
|
-
|
20
|
-
The ``instructions`` module holds the various :obj:`Instruction`\ s which are supported by
|
21
|
-
Qiskit Pulse. Instructions have operands, which typically include at least one
|
22
|
-
:py:class:`~qiskit.pulse.channels.Channel` specifying where the instruction will be applied.
|
23
|
-
|
24
|
-
Every instruction has a duration, whether explicitly included as an operand or implicitly defined.
|
25
|
-
For instance, a :py:class:`~qiskit.pulse.instructions.ShiftPhase` instruction can be instantiated
|
26
|
-
with operands *phase* and *channel*, for some float ``phase`` and a
|
27
|
-
:py:class:`~qiskit.pulse.channels.Channel` ``channel``::
|
28
|
-
|
29
|
-
ShiftPhase(phase, channel)
|
30
|
-
|
31
|
-
The duration of this instruction is implicitly zero. On the other hand, the
|
32
|
-
:py:class:`~qiskit.pulse.instructions.Delay` instruction takes an explicit duration::
|
33
|
-
|
34
|
-
Delay(duration, channel)
|
35
|
-
|
36
|
-
An instruction can be added to a :py:class:`~qiskit.pulse.Schedule`, which is a
|
37
|
-
sequence of scheduled Pulse ``Instruction`` s over many channels. ``Instruction`` s and
|
38
|
-
``Schedule`` s implement the same interface.
|
39
|
-
|
40
|
-
.. autosummary::
|
41
|
-
:toctree: ../stubs/
|
42
|
-
|
43
|
-
Acquire
|
44
|
-
Reference
|
45
|
-
Delay
|
46
|
-
Play
|
47
|
-
RelativeBarrier
|
48
|
-
SetFrequency
|
49
|
-
ShiftFrequency
|
50
|
-
SetPhase
|
51
|
-
ShiftPhase
|
52
|
-
Snapshot
|
53
|
-
TimeBlockade
|
54
|
-
|
55
|
-
These are all instances of the same base class:
|
56
|
-
|
57
|
-
.. autoclass:: Instruction
|
58
|
-
"""
|
59
|
-
from .acquire import Acquire
|
60
|
-
from .delay import Delay
|
61
|
-
from .directives import Directive, RelativeBarrier, TimeBlockade
|
62
|
-
from .instruction import Instruction
|
63
|
-
from .frequency import SetFrequency, ShiftFrequency
|
64
|
-
from .phase import ShiftPhase, SetPhase
|
65
|
-
from .play import Play
|
66
|
-
from .snapshot import Snapshot
|
67
|
-
from .reference import Reference
|
@@ -1,150 +0,0 @@
|
|
1
|
-
# This code is part of Qiskit.
|
2
|
-
#
|
3
|
-
# (C) Copyright IBM 2020.
|
4
|
-
#
|
5
|
-
# This code is licensed under the Apache License, Version 2.0. You may
|
6
|
-
# obtain a copy of this license in the LICENSE.txt file in the root directory
|
7
|
-
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
|
8
|
-
#
|
9
|
-
# Any modifications or derivative works of this code must retain this
|
10
|
-
# copyright notice, and modified files need to carry a notice indicating
|
11
|
-
# that they have been altered from the originals.
|
12
|
-
|
13
|
-
"""The Acquire instruction is used to trigger the qubit measurement unit and provide
|
14
|
-
some metadata for the acquisition process, for example, where to store classified readout data.
|
15
|
-
"""
|
16
|
-
from __future__ import annotations
|
17
|
-
from qiskit.circuit import ParameterExpression
|
18
|
-
from qiskit.pulse.channels import MemorySlot, RegisterSlot, AcquireChannel
|
19
|
-
from qiskit.pulse.configuration import Kernel, Discriminator
|
20
|
-
from qiskit.pulse.exceptions import PulseError
|
21
|
-
from qiskit.pulse.instructions.instruction import Instruction
|
22
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
23
|
-
|
24
|
-
|
25
|
-
class Acquire(Instruction):
|
26
|
-
"""The Acquire instruction is used to trigger the ADC associated with a particular qubit;
|
27
|
-
e.g. instantiated with AcquireChannel(0), the Acquire command will trigger data collection
|
28
|
-
for the channel associated with qubit 0 readout. This instruction also provides acquisition
|
29
|
-
metadata:
|
30
|
-
|
31
|
-
* the number of cycles during which to acquire (in terms of dt),
|
32
|
-
|
33
|
-
* the register slot to store classified, intermediary readout results,
|
34
|
-
|
35
|
-
* the memory slot to return classified results,
|
36
|
-
|
37
|
-
* the kernel to integrate raw data for each shot, and
|
38
|
-
|
39
|
-
* the discriminator to classify kerneled IQ points.
|
40
|
-
"""
|
41
|
-
|
42
|
-
@deprecate_pulse_func
|
43
|
-
def __init__(
|
44
|
-
self,
|
45
|
-
duration: int | ParameterExpression,
|
46
|
-
channel: AcquireChannel,
|
47
|
-
mem_slot: MemorySlot | None = None,
|
48
|
-
reg_slot: RegisterSlot | None = None,
|
49
|
-
kernel: Kernel | None = None,
|
50
|
-
discriminator: Discriminator | None = None,
|
51
|
-
name: str | None = None,
|
52
|
-
):
|
53
|
-
"""Create a new Acquire instruction.
|
54
|
-
|
55
|
-
Args:
|
56
|
-
duration: Length of time to acquire data in terms of dt.
|
57
|
-
channel: The channel that will acquire data.
|
58
|
-
mem_slot: The classical memory slot in which to store the classified readout result.
|
59
|
-
reg_slot: The fast-access register slot in which to store the classified readout
|
60
|
-
result for fast feedback.
|
61
|
-
kernel: A ``Kernel`` for integrating raw data.
|
62
|
-
discriminator: A ``Discriminator`` for discriminating kerneled IQ data into 0/1
|
63
|
-
results.
|
64
|
-
name: Name of the instruction for display purposes.
|
65
|
-
"""
|
66
|
-
super().__init__(
|
67
|
-
operands=(duration, channel, mem_slot, reg_slot, kernel, discriminator),
|
68
|
-
name=name,
|
69
|
-
)
|
70
|
-
|
71
|
-
def _validate(self):
|
72
|
-
"""Called after initialization to validate instruction data.
|
73
|
-
|
74
|
-
Raises:
|
75
|
-
PulseError: If the input ``channel`` is not type :class:`AcquireChannel`.
|
76
|
-
PulseError: If the input ``mem_slot`` is not type :class:`MemorySlot`.
|
77
|
-
PulseError: If the input ``reg_slot`` is not type :class:`RegisterSlot`.
|
78
|
-
PulseError: When memory slot and register slot are both empty.
|
79
|
-
"""
|
80
|
-
if not isinstance(self.channel, AcquireChannel):
|
81
|
-
raise PulseError(f"Expected an acquire channel, got {self.channel} instead.")
|
82
|
-
|
83
|
-
if self.mem_slot and not isinstance(self.mem_slot, MemorySlot):
|
84
|
-
raise PulseError(f"Expected a memory slot, got {self.mem_slot} instead.")
|
85
|
-
|
86
|
-
if self.reg_slot and not isinstance(self.reg_slot, RegisterSlot):
|
87
|
-
raise PulseError(f"Expected a register slot, got {self.reg_slot} instead.")
|
88
|
-
|
89
|
-
if self.mem_slot is None and self.reg_slot is None:
|
90
|
-
raise PulseError("Neither MemorySlots nor RegisterSlots were supplied.")
|
91
|
-
|
92
|
-
@property
|
93
|
-
def channel(self) -> AcquireChannel:
|
94
|
-
"""Return the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
|
95
|
-
scheduled on.
|
96
|
-
"""
|
97
|
-
return self.operands[1]
|
98
|
-
|
99
|
-
@property
|
100
|
-
def channels(self) -> tuple[AcquireChannel | MemorySlot | RegisterSlot, ...]:
|
101
|
-
"""Returns the channels that this schedule uses."""
|
102
|
-
return tuple(self.operands[ind] for ind in (1, 2, 3) if self.operands[ind] is not None)
|
103
|
-
|
104
|
-
@property
|
105
|
-
def duration(self) -> int | ParameterExpression:
|
106
|
-
"""Duration of this instruction."""
|
107
|
-
return self.operands[0]
|
108
|
-
|
109
|
-
@property
|
110
|
-
def kernel(self) -> Kernel:
|
111
|
-
"""Return kernel settings."""
|
112
|
-
return self._operands[4]
|
113
|
-
|
114
|
-
@property
|
115
|
-
def discriminator(self) -> Discriminator:
|
116
|
-
"""Return discrimination settings."""
|
117
|
-
return self._operands[5]
|
118
|
-
|
119
|
-
@property
|
120
|
-
def acquire(self) -> AcquireChannel:
|
121
|
-
"""Acquire channel to acquire data. The ``AcquireChannel`` index maps trivially to
|
122
|
-
qubit index.
|
123
|
-
"""
|
124
|
-
return self.channel
|
125
|
-
|
126
|
-
@property
|
127
|
-
def mem_slot(self) -> MemorySlot:
|
128
|
-
"""The classical memory slot which will store the classified readout result."""
|
129
|
-
return self.operands[2]
|
130
|
-
|
131
|
-
@property
|
132
|
-
def reg_slot(self) -> RegisterSlot:
|
133
|
-
"""The fast-access register slot which will store the classified readout result for
|
134
|
-
fast-feedback computation.
|
135
|
-
"""
|
136
|
-
return self.operands[3]
|
137
|
-
|
138
|
-
def is_parameterized(self) -> bool:
|
139
|
-
"""Return True iff the instruction is parameterized."""
|
140
|
-
return isinstance(self.duration, ParameterExpression) or super().is_parameterized()
|
141
|
-
|
142
|
-
def __repr__(self) -> str:
|
143
|
-
mem_slot_repr = str(self.mem_slot) if self.mem_slot else ""
|
144
|
-
reg_slot_repr = str(self.reg_slot) if self.reg_slot else ""
|
145
|
-
kernel_repr = str(self.kernel) if self.kernel else ""
|
146
|
-
discriminator_repr = str(self.discriminator) if self.discriminator else ""
|
147
|
-
return (
|
148
|
-
f"{self.__class__.__name__}({self.duration}, {str(self.channel)}, "
|
149
|
-
f"{mem_slot_repr}, {reg_slot_repr}, {kernel_repr}, {discriminator_repr})"
|
150
|
-
)
|