qiskit 1.4.1__cp39-abi3-macosx_11_0_arm64.whl → 2.0.0__cp39-abi3-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qiskit/VERSION.txt +1 -1
- qiskit/__init__.py +3 -9
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/circuit/__init__.py +35 -10
- qiskit/circuit/{add_control.py → _add_control.py} +32 -12
- qiskit/circuit/_classical_resource_map.py +5 -3
- qiskit/circuit/barrier.py +3 -7
- qiskit/circuit/classical/expr/__init__.py +31 -3
- qiskit/circuit/classical/expr/constructors.py +236 -28
- qiskit/circuit/classical/expr/expr.py +104 -3
- qiskit/circuit/classical/expr/visitors.py +75 -0
- qiskit/circuit/classical/types/__init__.py +12 -8
- qiskit/circuit/classical/types/ordering.py +14 -7
- qiskit/circuit/classical/types/types.py +36 -0
- qiskit/circuit/commutation_checker.py +34 -7
- qiskit/circuit/controlflow/__init__.py +32 -1
- qiskit/circuit/controlflow/_builder_utils.py +9 -5
- qiskit/circuit/controlflow/box.py +163 -0
- qiskit/circuit/controlflow/break_loop.py +1 -1
- qiskit/circuit/controlflow/builder.py +139 -39
- qiskit/circuit/controlflow/continue_loop.py +1 -3
- qiskit/circuit/controlflow/control_flow.py +10 -0
- qiskit/circuit/controlflow/for_loop.py +2 -1
- qiskit/circuit/controlflow/if_else.py +3 -16
- qiskit/circuit/controlflow/switch_case.py +2 -8
- qiskit/circuit/controlflow/while_loop.py +2 -7
- qiskit/circuit/controlledgate.py +2 -4
- qiskit/circuit/delay.py +40 -11
- qiskit/circuit/duration.py +0 -15
- qiskit/circuit/gate.py +2 -4
- qiskit/circuit/instruction.py +2 -141
- qiskit/circuit/instructionset.py +7 -54
- qiskit/circuit/library/__init__.py +469 -154
- qiskit/circuit/library/arithmetic/__init__.py +16 -10
- qiskit/circuit/library/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
- qiskit/circuit/library/arithmetic/adders/draper_qft_adder.py +2 -2
- qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py +1 -1
- qiskit/circuit/library/arithmetic/exact_reciprocal.py +64 -21
- qiskit/circuit/library/arithmetic/integer_comparator.py +37 -80
- qiskit/circuit/library/arithmetic/linear_amplitude_function.py +169 -2
- qiskit/circuit/library/arithmetic/linear_pauli_rotations.py +59 -5
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +154 -6
- qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py +114 -4
- qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py +191 -15
- qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py +93 -39
- qiskit/circuit/library/arithmetic/quadratic_form.py +168 -2
- qiskit/circuit/library/arithmetic/weighted_adder.py +73 -1
- qiskit/circuit/library/bit_flip_oracle.py +130 -0
- qiskit/circuit/library/blueprintcircuit.py +52 -16
- qiskit/circuit/library/data_preparation/initializer.py +1 -1
- qiskit/circuit/library/data_preparation/pauli_feature_map.py +4 -4
- qiskit/circuit/library/data_preparation/state_preparation.py +1 -1
- qiskit/circuit/library/generalized_gates/gms.py +1 -1
- qiskit/circuit/library/generalized_gates/isometry.py +1 -1
- qiskit/circuit/library/generalized_gates/pauli.py +1 -2
- qiskit/circuit/library/generalized_gates/uc.py +97 -7
- qiskit/circuit/library/generalized_gates/uc_pauli_rot.py +1 -1
- qiskit/circuit/library/generalized_gates/unitary.py +4 -2
- qiskit/circuit/library/graph_state.py +1 -0
- qiskit/circuit/library/hamiltonian_gate.py +1 -1
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +1 -1
- qiskit/circuit/library/n_local/n_local.py +1 -1
- qiskit/circuit/library/n_local/qaoa_ansatz.py +1 -1
- qiskit/circuit/library/overlap.py +2 -2
- qiskit/circuit/library/pauli_evolution.py +39 -24
- qiskit/circuit/library/phase_oracle.py +130 -51
- qiskit/circuit/library/standard_gates/__init__.py +0 -1
- qiskit/circuit/library/standard_gates/dcx.py +3 -4
- qiskit/circuit/library/standard_gates/ecr.py +3 -4
- qiskit/circuit/library/standard_gates/global_phase.py +5 -6
- qiskit/circuit/library/standard_gates/h.py +4 -9
- qiskit/circuit/library/standard_gates/i.py +2 -2
- qiskit/circuit/library/standard_gates/iswap.py +3 -4
- qiskit/circuit/library/standard_gates/p.py +15 -34
- qiskit/circuit/library/standard_gates/r.py +7 -10
- qiskit/circuit/library/standard_gates/rx.py +5 -15
- qiskit/circuit/library/standard_gates/rxx.py +3 -6
- qiskit/circuit/library/standard_gates/ry.py +5 -17
- qiskit/circuit/library/standard_gates/ryy.py +3 -6
- qiskit/circuit/library/standard_gates/rz.py +5 -17
- qiskit/circuit/library/standard_gates/rzx.py +3 -6
- qiskit/circuit/library/standard_gates/rzz.py +3 -6
- qiskit/circuit/library/standard_gates/s.py +6 -15
- qiskit/circuit/library/standard_gates/swap.py +4 -11
- qiskit/circuit/library/standard_gates/sx.py +7 -12
- qiskit/circuit/library/standard_gates/t.py +6 -7
- qiskit/circuit/library/standard_gates/u.py +2 -10
- qiskit/circuit/library/standard_gates/u1.py +5 -16
- qiskit/circuit/library/standard_gates/u2.py +2 -6
- qiskit/circuit/library/standard_gates/u3.py +3 -11
- qiskit/circuit/library/standard_gates/x.py +14 -62
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +2 -5
- qiskit/circuit/library/standard_gates/xx_plus_yy.py +2 -5
- qiskit/circuit/library/standard_gates/y.py +4 -9
- qiskit/circuit/library/standard_gates/z.py +5 -15
- qiskit/circuit/measure.py +11 -2
- qiskit/circuit/parameterexpression.py +11 -0
- qiskit/circuit/quantumcircuit.py +890 -564
- qiskit/circuit/random/utils.py +12 -6
- qiskit/circuit/reset.py +5 -2
- qiskit/circuit/singleton.py +5 -11
- qiskit/circuit/store.py +0 -8
- qiskit/circuit/tools/pi_check.py +3 -0
- qiskit/compiler/__init__.py +1 -7
- qiskit/compiler/transpiler.py +38 -196
- qiskit/converters/circuit_to_dag.py +6 -4
- qiskit/converters/circuit_to_dagdependency.py +0 -2
- qiskit/converters/circuit_to_dagdependency_v2.py +0 -1
- qiskit/converters/circuit_to_gate.py +1 -1
- qiskit/converters/circuit_to_instruction.py +16 -29
- qiskit/converters/dag_to_circuit.py +7 -8
- qiskit/converters/dag_to_dagdependency.py +0 -1
- qiskit/converters/dag_to_dagdependency_v2.py +0 -1
- qiskit/converters/dagdependency_to_circuit.py +0 -6
- qiskit/converters/dagdependency_to_dag.py +0 -6
- qiskit/dagcircuit/collect_blocks.py +32 -20
- qiskit/dagcircuit/dagdependency.py +3 -37
- qiskit/dagcircuit/dagdependency_v2.py +5 -82
- qiskit/dagcircuit/dagnode.py +14 -2
- qiskit/passmanager/__init__.py +24 -6
- qiskit/passmanager/passmanager.py +26 -24
- qiskit/primitives/__init__.py +44 -35
- qiskit/primitives/backend_estimator_v2.py +102 -23
- qiskit/primitives/backend_sampler_v2.py +5 -20
- qiskit/primitives/base/__init__.py +4 -4
- qiskit/primitives/base/base_estimator.py +77 -82
- qiskit/primitives/base/base_primitive_job.py +2 -2
- qiskit/primitives/base/{base_primitive.py → base_primitive_v1.py} +1 -1
- qiskit/primitives/base/{base_result.py → base_result_v1.py} +1 -1
- qiskit/primitives/base/base_sampler.py +52 -60
- qiskit/primitives/base/{estimator_result.py → estimator_result_v1.py} +2 -2
- qiskit/primitives/base/{sampler_result.py → sampler_result_v1.py} +2 -2
- qiskit/primitives/base/{validation.py → validation_v1.py} +34 -15
- qiskit/primitives/containers/bindings_array.py +3 -1
- qiskit/primitives/containers/bit_array.py +23 -0
- qiskit/primitives/containers/data_bin.py +3 -1
- qiskit/primitives/containers/observables_array.py +19 -2
- qiskit/primitives/statevector_sampler.py +6 -8
- qiskit/primitives/utils.py +14 -189
- qiskit/providers/__init__.py +4 -130
- qiskit/providers/backend.py +11 -314
- qiskit/providers/basic_provider/__init__.py +3 -1
- qiskit/providers/basic_provider/basic_provider.py +29 -9
- qiskit/providers/basic_provider/basic_simulator.py +158 -298
- qiskit/providers/exceptions.py +0 -33
- qiskit/providers/fake_provider/__init__.py +0 -37
- qiskit/providers/fake_provider/generic_backend_v2.py +32 -693
- qiskit/qasm2/__init__.py +21 -6
- qiskit/qasm2/export.py +2 -10
- qiskit/qasm2/parse.py +11 -25
- qiskit/qasm3/__init__.py +5 -1
- qiskit/qasm3/ast.py +44 -0
- qiskit/qasm3/exporter.py +65 -27
- qiskit/qasm3/printer.py +35 -4
- qiskit/qpy/__init__.py +162 -19
- qiskit/qpy/binary_io/__init__.py +0 -1
- qiskit/qpy/binary_io/circuits.py +96 -116
- qiskit/qpy/binary_io/parse_sympy_repr.py +121 -0
- qiskit/qpy/binary_io/schedules.py +61 -388
- qiskit/qpy/binary_io/value.py +159 -33
- 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 -11
- qiskit/result/result.py +38 -134
- qiskit/result/sampled_expval.py +1 -2
- qiskit/result/utils.py +3 -4
- qiskit/synthesis/__init__.py +21 -1
- qiskit/synthesis/arithmetic/__init__.py +3 -1
- qiskit/synthesis/arithmetic/adders/cdkm_ripple_carry_adder.py +1 -1
- qiskit/synthesis/arithmetic/adders/draper_qft_adder.py +1 -1
- qiskit/synthesis/arithmetic/adders/vbe_ripple_carry_adder.py +2 -2
- qiskit/{providers/fake_provider/backends_v1/fake_20q → synthesis/arithmetic/comparators}/__init__.py +4 -6
- qiskit/synthesis/arithmetic/comparators/compare_2s.py +112 -0
- qiskit/synthesis/arithmetic/comparators/compare_greedy.py +66 -0
- qiskit/synthesis/arithmetic/multipliers/hrs_cumulative_multiplier.py +1 -1
- qiskit/synthesis/arithmetic/multipliers/rg_qft_multiplier.py +1 -1
- qiskit/synthesis/arithmetic/weighted_sum.py +155 -0
- qiskit/{result/mitigation → synthesis/boolean}/__init__.py +2 -2
- qiskit/synthesis/boolean/boolean_expression.py +231 -0
- qiskit/synthesis/boolean/boolean_expression_synth.py +124 -0
- qiskit/synthesis/boolean/boolean_expression_visitor.py +96 -0
- qiskit/synthesis/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 +4 -40
- qiskit/transpiler/passes/basis/basis_translator.py +5 -4
- qiskit/transpiler/passes/basis/decompose.py +1 -15
- qiskit/transpiler/passes/basis/unroll_3q_or_more.py +1 -5
- qiskit/transpiler/passes/basis/unroll_custom_definitions.py +3 -2
- qiskit/transpiler/passes/layout/apply_layout.py +4 -0
- qiskit/transpiler/passes/layout/dense_layout.py +2 -39
- qiskit/transpiler/passes/layout/full_ancilla_allocation.py +3 -4
- qiskit/transpiler/passes/layout/sabre_layout.py +7 -3
- qiskit/transpiler/passes/layout/vf2_layout.py +2 -20
- qiskit/transpiler/passes/layout/vf2_post_layout.py +60 -125
- qiskit/transpiler/passes/layout/vf2_utils.py +2 -26
- qiskit/transpiler/passes/optimization/__init__.py +2 -3
- qiskit/transpiler/passes/optimization/collect_and_collapse.py +2 -0
- qiskit/transpiler/passes/optimization/collect_cliffords.py +5 -0
- qiskit/transpiler/passes/optimization/collect_linear_functions.py +5 -0
- qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +16 -1
- qiskit/transpiler/passes/optimization/commutation_analysis.py +3 -3
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +41 -19
- qiskit/transpiler/passes/optimization/contract_idle_wires_in_control_flow.py +104 -0
- qiskit/transpiler/passes/optimization/light_cone.py +135 -0
- qiskit/transpiler/passes/optimization/optimize_1q_commutation.py +0 -1
- qiskit/transpiler/passes/optimization/optimize_1q_decomposition.py +18 -22
- qiskit/transpiler/passes/optimization/optimize_annotated.py +3 -2
- qiskit/transpiler/passes/optimization/remove_identity_equiv.py +6 -4
- qiskit/transpiler/passes/optimization/reset_after_measure_simplification.py +5 -2
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +26 -3
- qiskit/transpiler/passes/optimization/template_matching/template_substitution.py +3 -2
- qiskit/transpiler/passes/routing/__init__.py +0 -1
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +3 -1
- qiskit/transpiler/passes/routing/sabre_swap.py +14 -6
- qiskit/transpiler/passes/routing/star_prerouting.py +1 -1
- qiskit/transpiler/passes/scheduling/__init__.py +1 -7
- qiskit/transpiler/passes/scheduling/alignments/__init__.py +2 -4
- qiskit/transpiler/passes/scheduling/alignments/check_durations.py +1 -9
- qiskit/transpiler/passes/scheduling/alignments/reschedule.py +17 -16
- qiskit/transpiler/passes/scheduling/padding/base_padding.py +32 -4
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +25 -63
- qiskit/transpiler/passes/scheduling/padding/pad_delay.py +12 -4
- qiskit/transpiler/passes/scheduling/scheduling/alap.py +5 -39
- qiskit/transpiler/passes/scheduling/scheduling/asap.py +4 -35
- qiskit/transpiler/passes/scheduling/scheduling/base_scheduler.py +10 -16
- qiskit/transpiler/passes/scheduling/time_unit_conversion.py +134 -62
- qiskit/transpiler/passes/synthesis/default_unitary_synth_plugin.py +653 -0
- qiskit/transpiler/passes/synthesis/high_level_synthesis.py +176 -601
- qiskit/transpiler/passes/synthesis/hls_plugins.py +294 -1
- qiskit/transpiler/passes/synthesis/plugin.py +4 -0
- qiskit/transpiler/passes/synthesis/solovay_kitaev_synthesis.py +16 -10
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +34 -697
- qiskit/transpiler/passes/utils/__init__.py +0 -1
- qiskit/transpiler/passes/utils/check_gate_direction.py +13 -5
- qiskit/transpiler/passes/utils/control_flow.py +2 -6
- qiskit/transpiler/passes/utils/gate_direction.py +7 -0
- qiskit/transpiler/passes/utils/remove_final_measurements.py +40 -33
- qiskit/transpiler/passmanager.py +13 -0
- qiskit/transpiler/passmanager_config.py +5 -81
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +225 -344
- qiskit/transpiler/preset_passmanagers/common.py +140 -167
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +107 -322
- qiskit/transpiler/preset_passmanagers/level0.py +2 -11
- qiskit/transpiler/preset_passmanagers/level1.py +2 -14
- qiskit/transpiler/preset_passmanagers/level2.py +2 -12
- qiskit/transpiler/preset_passmanagers/level3.py +2 -11
- qiskit/transpiler/preset_passmanagers/plugin.py +5 -3
- qiskit/transpiler/target.py +78 -524
- qiskit/user_config.py +8 -4
- qiskit/utils/__init__.py +13 -12
- qiskit/utils/deprecation.py +4 -112
- qiskit/utils/optionals.py +11 -4
- qiskit/utils/parallel.py +214 -87
- qiskit/utils/units.py +4 -1
- qiskit/visualization/__init__.py +3 -7
- qiskit/visualization/array.py +4 -1
- qiskit/visualization/bloch.py +1 -1
- qiskit/visualization/circuit/_utils.py +19 -19
- qiskit/visualization/circuit/circuit_visualization.py +11 -4
- qiskit/visualization/circuit/matplotlib.py +13 -23
- qiskit/visualization/circuit/text.py +7 -3
- qiskit/visualization/counts_visualization.py +4 -0
- qiskit/visualization/dag_visualization.py +2 -1
- qiskit/visualization/gate_map.py +39 -154
- qiskit/visualization/library.py +4 -1
- qiskit/visualization/pass_manager_visualization.py +6 -2
- qiskit/visualization/state_visualization.py +19 -2
- qiskit/visualization/timeline/core.py +19 -13
- qiskit/visualization/timeline/interface.py +19 -18
- qiskit/visualization/timeline/plotters/matplotlib.py +4 -1
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info}/METADATA +4 -3
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info}/RECORD +303 -449
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info}/WHEEL +2 -1
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info}/entry_points.txt +8 -2
- qiskit/assembler/__init__.py +0 -42
- qiskit/assembler/assemble_circuits.py +0 -451
- qiskit/assembler/assemble_schedules.py +0 -367
- qiskit/assembler/disassemble.py +0 -310
- qiskit/assembler/run_config.py +0 -77
- qiskit/circuit/bit.py +0 -106
- qiskit/circuit/classicalfunction/__init__.py +0 -152
- qiskit/circuit/classicalfunction/boolean_expression.py +0 -138
- qiskit/circuit/classicalfunction/classical_element.py +0 -54
- qiskit/circuit/classicalfunction/classical_function_visitor.py +0 -155
- qiskit/circuit/classicalfunction/classicalfunction.py +0 -182
- qiskit/circuit/classicalfunction/exceptions.py +0 -41
- qiskit/circuit/classicalfunction/types.py +0 -18
- qiskit/circuit/classicalfunction/utils.py +0 -91
- qiskit/circuit/classicalregister.py +0 -57
- qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py +0 -405
- qiskit/circuit/quantumregister.py +0 -75
- qiskit/circuit/register.py +0 -246
- qiskit/compiler/assembler.py +0 -689
- qiskit/compiler/scheduler.py +0 -109
- qiskit/compiler/sequencer.py +0 -71
- qiskit/primitives/backend_estimator.py +0 -486
- qiskit/primitives/backend_sampler.py +0 -222
- qiskit/primitives/estimator.py +0 -172
- qiskit/primitives/sampler.py +0 -162
- qiskit/providers/backend_compat.py +0 -507
- qiskit/providers/fake_provider/backends_v1/__init__.py +0 -22
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/conf_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/defs_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/fake_127q_pulse_v1.py +0 -37
- qiskit/providers/fake_provider/backends_v1/fake_127q_pulse/props_washington.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_20q/conf_singapore.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_20q/fake_20q.py +0 -43
- qiskit/providers/fake_provider/backends_v1/fake_20q/props_singapore.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/conf_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/defs_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/fake_27q_pulse_v1.py +0 -50
- qiskit/providers/fake_provider/backends_v1/fake_27q_pulse/props_hanoi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_5q/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_5q/conf_yorktown.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_5q/fake_5q_v1.py +0 -41
- qiskit/providers/fake_provider/backends_v1/fake_5q/props_yorktown.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/__init__.py +0 -18
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/conf_nairobi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/defs_nairobi.json +0 -1
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/fake_7q_pulse_v1.py +0 -44
- qiskit/providers/fake_provider/backends_v1/fake_7q_pulse/props_nairobi.json +0 -1
- qiskit/providers/fake_provider/fake_1q.py +0 -91
- qiskit/providers/fake_provider/fake_backend.py +0 -165
- qiskit/providers/fake_provider/fake_openpulse_2q.py +0 -391
- qiskit/providers/fake_provider/fake_openpulse_3q.py +0 -340
- qiskit/providers/fake_provider/fake_pulse_backend.py +0 -49
- qiskit/providers/fake_provider/fake_qasm_backend.py +0 -77
- qiskit/providers/fake_provider/utils/backend_converter.py +0 -150
- qiskit/providers/fake_provider/utils/json_decoder.py +0 -109
- qiskit/providers/models/__init__.py +0 -89
- qiskit/providers/models/backendconfiguration.py +0 -1040
- qiskit/providers/models/backendproperties.py +0 -535
- qiskit/providers/models/backendstatus.py +0 -104
- qiskit/providers/models/jobstatus.py +0 -77
- qiskit/providers/models/pulsedefaults.py +0 -305
- qiskit/providers/provider.py +0 -95
- qiskit/pulse/__init__.py +0 -158
- qiskit/pulse/builder.py +0 -2262
- qiskit/pulse/calibration_entries.py +0 -381
- qiskit/pulse/channels.py +0 -227
- qiskit/pulse/configuration.py +0 -245
- qiskit/pulse/exceptions.py +0 -45
- qiskit/pulse/filters.py +0 -309
- qiskit/pulse/instruction_schedule_map.py +0 -424
- qiskit/pulse/instructions/__init__.py +0 -67
- qiskit/pulse/instructions/acquire.py +0 -150
- qiskit/pulse/instructions/delay.py +0 -71
- qiskit/pulse/instructions/directives.py +0 -154
- qiskit/pulse/instructions/frequency.py +0 -135
- qiskit/pulse/instructions/instruction.py +0 -270
- qiskit/pulse/instructions/phase.py +0 -152
- qiskit/pulse/instructions/play.py +0 -99
- qiskit/pulse/instructions/reference.py +0 -100
- qiskit/pulse/instructions/snapshot.py +0 -82
- qiskit/pulse/library/__init__.py +0 -97
- qiskit/pulse/library/continuous.py +0 -430
- qiskit/pulse/library/pulse.py +0 -148
- qiskit/pulse/library/samplers/__init__.py +0 -15
- qiskit/pulse/library/samplers/decorators.py +0 -295
- qiskit/pulse/library/samplers/strategies.py +0 -71
- qiskit/pulse/library/symbolic_pulses.py +0 -1989
- qiskit/pulse/library/waveform.py +0 -136
- qiskit/pulse/macros.py +0 -262
- qiskit/pulse/parameter_manager.py +0 -445
- qiskit/pulse/parser.py +0 -314
- qiskit/pulse/reference_manager.py +0 -58
- qiskit/pulse/schedule.py +0 -1854
- qiskit/pulse/transforms/__init__.py +0 -106
- qiskit/pulse/transforms/alignments.py +0 -406
- qiskit/pulse/transforms/base_transforms.py +0 -71
- qiskit/pulse/transforms/canonicalization.py +0 -498
- qiskit/pulse/transforms/dag.py +0 -122
- qiskit/pulse/utils.py +0 -149
- qiskit/qobj/__init__.py +0 -75
- qiskit/qobj/common.py +0 -81
- qiskit/qobj/converters/__init__.py +0 -18
- qiskit/qobj/converters/lo_config.py +0 -177
- qiskit/qobj/converters/pulse_instruction.py +0 -897
- qiskit/qobj/pulse_qobj.py +0 -709
- qiskit/qobj/qasm_qobj.py +0 -708
- qiskit/qobj/utils.py +0 -46
- qiskit/result/mitigation/base_readout_mitigator.py +0 -79
- qiskit/result/mitigation/correlated_readout_mitigator.py +0 -277
- qiskit/result/mitigation/local_readout_mitigator.py +0 -328
- qiskit/result/mitigation/utils.py +0 -217
- qiskit/scheduler/__init__.py +0 -40
- qiskit/scheduler/config.py +0 -37
- qiskit/scheduler/lowering.py +0 -187
- qiskit/scheduler/methods/__init__.py +0 -15
- qiskit/scheduler/methods/basic.py +0 -140
- qiskit/scheduler/schedule_circuit.py +0 -69
- qiskit/scheduler/sequence.py +0 -104
- qiskit/transpiler/passes/calibration/__init__.py +0 -17
- qiskit/transpiler/passes/calibration/base_builder.py +0 -79
- qiskit/transpiler/passes/calibration/builders.py +0 -20
- qiskit/transpiler/passes/calibration/exceptions.py +0 -22
- qiskit/transpiler/passes/calibration/pulse_gate.py +0 -100
- qiskit/transpiler/passes/calibration/rx_builder.py +0 -164
- qiskit/transpiler/passes/calibration/rzx_builder.py +0 -411
- qiskit/transpiler/passes/calibration/rzx_templates.py +0 -58
- qiskit/transpiler/passes/optimization/cx_cancellation.py +0 -65
- qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py +0 -162
- qiskit/transpiler/passes/optimization/normalize_rx_angle.py +0 -157
- qiskit/transpiler/passes/routing/stochastic_swap.py +0 -532
- qiskit/transpiler/passes/scheduling/alap.py +0 -153
- qiskit/transpiler/passes/scheduling/alignments/align_measures.py +0 -255
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +0 -107
- qiskit/transpiler/passes/scheduling/asap.py +0 -175
- qiskit/transpiler/passes/scheduling/base_scheduler.py +0 -310
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +0 -313
- qiskit/transpiler/passes/utils/convert_conditions_to_if_ops.py +0 -93
- qiskit/utils/deprecate_pulse.py +0 -119
- qiskit/utils/multiprocessing.py +0 -56
- qiskit/visualization/pulse_v2/__init__.py +0 -21
- qiskit/visualization/pulse_v2/core.py +0 -901
- qiskit/visualization/pulse_v2/device_info.py +0 -173
- qiskit/visualization/pulse_v2/drawings.py +0 -253
- qiskit/visualization/pulse_v2/events.py +0 -254
- qiskit/visualization/pulse_v2/generators/__init__.py +0 -40
- qiskit/visualization/pulse_v2/generators/barrier.py +0 -76
- qiskit/visualization/pulse_v2/generators/chart.py +0 -208
- qiskit/visualization/pulse_v2/generators/frame.py +0 -436
- qiskit/visualization/pulse_v2/generators/snapshot.py +0 -133
- qiskit/visualization/pulse_v2/generators/waveform.py +0 -645
- qiskit/visualization/pulse_v2/interface.py +0 -459
- qiskit/visualization/pulse_v2/layouts.py +0 -387
- qiskit/visualization/pulse_v2/plotters/__init__.py +0 -17
- qiskit/visualization/pulse_v2/plotters/base_plotter.py +0 -53
- qiskit/visualization/pulse_v2/plotters/matplotlib.py +0 -201
- qiskit/visualization/pulse_v2/stylesheet.py +0 -312
- qiskit/visualization/pulse_v2/types.py +0 -242
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info/licenses}/LICENSE.txt +0 -0
- {qiskit-1.4.1.dist-info → qiskit-2.0.0.dist-info}/top_level.txt +0 -0
@@ -1,71 +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
|
-
"""An instruction for blocking time on a channel; useful for scheduling alignment."""
|
14
|
-
from __future__ import annotations
|
15
|
-
|
16
|
-
from qiskit.circuit import ParameterExpression
|
17
|
-
from qiskit.pulse.channels import Channel
|
18
|
-
from qiskit.pulse.instructions.instruction import Instruction
|
19
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
20
|
-
|
21
|
-
|
22
|
-
class Delay(Instruction):
|
23
|
-
"""A blocking instruction with no other effect. The delay is used for aligning and scheduling
|
24
|
-
other instructions.
|
25
|
-
|
26
|
-
Example:
|
27
|
-
|
28
|
-
To schedule an instruction at time = 10, on a channel assigned to the variable ``channel``,
|
29
|
-
the following could be used::
|
30
|
-
|
31
|
-
sched = Schedule(name="Delay instruction example")
|
32
|
-
sched += Delay(10, channel)
|
33
|
-
sched += Gaussian(duration, amp, sigma, channel)
|
34
|
-
|
35
|
-
The ``channel`` will output no signal from time=0 up until time=10.
|
36
|
-
"""
|
37
|
-
|
38
|
-
@deprecate_pulse_func
|
39
|
-
def __init__(
|
40
|
-
self,
|
41
|
-
duration: int | ParameterExpression,
|
42
|
-
channel: Channel,
|
43
|
-
name: str | None = None,
|
44
|
-
):
|
45
|
-
"""Create a new delay instruction.
|
46
|
-
|
47
|
-
No other instruction may be scheduled within a ``Delay``.
|
48
|
-
|
49
|
-
Args:
|
50
|
-
duration: Length of time of the delay in terms of dt.
|
51
|
-
channel: The channel that will have the delay.
|
52
|
-
name: Name of the delay for display purposes.
|
53
|
-
"""
|
54
|
-
super().__init__(operands=(duration, channel), name=name)
|
55
|
-
|
56
|
-
@property
|
57
|
-
def channel(self) -> Channel:
|
58
|
-
"""Return the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
|
59
|
-
scheduled on.
|
60
|
-
"""
|
61
|
-
return self.operands[1]
|
62
|
-
|
63
|
-
@property
|
64
|
-
def channels(self) -> tuple[Channel]:
|
65
|
-
"""Returns the channels that this schedule uses."""
|
66
|
-
return (self.channel,)
|
67
|
-
|
68
|
-
@property
|
69
|
-
def duration(self) -> int | ParameterExpression:
|
70
|
-
"""Duration of this instruction."""
|
71
|
-
return self.operands[0]
|
@@ -1,154 +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
|
-
"""Directives are hints to the pulse compiler for how to process its input programs."""
|
14
|
-
from __future__ import annotations
|
15
|
-
|
16
|
-
from abc import ABC
|
17
|
-
|
18
|
-
from qiskit.pulse import channels as chans
|
19
|
-
from qiskit.pulse.instructions import instruction
|
20
|
-
from qiskit.pulse.exceptions import PulseError
|
21
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
22
|
-
|
23
|
-
|
24
|
-
class Directive(instruction.Instruction, ABC):
|
25
|
-
"""A compiler directive.
|
26
|
-
|
27
|
-
This is a hint to the pulse compiler and is not loaded into hardware.
|
28
|
-
"""
|
29
|
-
|
30
|
-
@property
|
31
|
-
def duration(self) -> int:
|
32
|
-
"""Duration of this instruction."""
|
33
|
-
return 0
|
34
|
-
|
35
|
-
|
36
|
-
class RelativeBarrier(Directive):
|
37
|
-
"""Pulse ``RelativeBarrier`` directive."""
|
38
|
-
|
39
|
-
@deprecate_pulse_func
|
40
|
-
def __init__(self, *channels: chans.Channel, name: str | None = None):
|
41
|
-
"""Create a relative barrier directive.
|
42
|
-
|
43
|
-
The barrier directive blocks instructions within the same schedule
|
44
|
-
as the barrier on channels contained within this barrier from moving
|
45
|
-
through the barrier in time.
|
46
|
-
|
47
|
-
Args:
|
48
|
-
channels: The channel that the barrier applies to.
|
49
|
-
name: Name of the directive for display purposes.
|
50
|
-
"""
|
51
|
-
super().__init__(operands=tuple(channels), name=name)
|
52
|
-
|
53
|
-
@property
|
54
|
-
def channels(self) -> tuple[chans.Channel, ...]:
|
55
|
-
"""Returns the channels that this schedule uses."""
|
56
|
-
return self.operands
|
57
|
-
|
58
|
-
def __eq__(self, other: object) -> bool:
|
59
|
-
"""Verify two barriers are equivalent."""
|
60
|
-
return isinstance(other, type(self)) and set(self.channels) == set(other.channels)
|
61
|
-
|
62
|
-
|
63
|
-
class TimeBlockade(Directive):
|
64
|
-
"""Pulse ``TimeBlockade`` directive.
|
65
|
-
|
66
|
-
This instruction is intended to be used internally within the pulse builder,
|
67
|
-
to convert :class:`.Schedule` into :class:`.ScheduleBlock`.
|
68
|
-
Because :class:`.ScheduleBlock` cannot take an absolute instruction time interval,
|
69
|
-
this directive helps the block representation to find the starting time of an instruction.
|
70
|
-
|
71
|
-
Example:
|
72
|
-
|
73
|
-
This schedule plays constant pulse at t0 = 120.
|
74
|
-
|
75
|
-
.. code-block:: python
|
76
|
-
|
77
|
-
from qiskit.pulse import Schedule, Play, Constant, DriveChannel
|
78
|
-
|
79
|
-
schedule = Schedule()
|
80
|
-
schedule.insert(120, Play(Constant(10, 0.1), DriveChannel(0)))
|
81
|
-
|
82
|
-
This schedule block is expected to be identical to above at a time of execution.
|
83
|
-
|
84
|
-
.. code-block:: python
|
85
|
-
|
86
|
-
from qiskit.pulse import ScheduleBlock, Play, Constant, DriveChannel
|
87
|
-
from qiskit.pulse.instructions import TimeBlockade
|
88
|
-
|
89
|
-
block = ScheduleBlock()
|
90
|
-
block.append(TimeBlockade(120, DriveChannel(0)))
|
91
|
-
block.append(Play(Constant(10, 0.1), DriveChannel(0)))
|
92
|
-
|
93
|
-
Such conversion may be done by
|
94
|
-
|
95
|
-
.. code-block:: python
|
96
|
-
|
97
|
-
from qiskit.pulse.transforms import block_to_schedule, remove_directives
|
98
|
-
|
99
|
-
schedule = remove_directives(block_to_schedule(block))
|
100
|
-
|
101
|
-
|
102
|
-
.. note::
|
103
|
-
|
104
|
-
The TimeBlockade instruction behaves almost identically
|
105
|
-
to :class:`~qiskit.pulse.instructions.Delay` instruction.
|
106
|
-
However, the TimeBlockade is just a compiler directive and must be removed before execution.
|
107
|
-
This may be done by :func:`~qiskit.pulse.transforms.remove_directives` transform.
|
108
|
-
Once these directives are removed, occupied timeslots are released and
|
109
|
-
user can insert another instruction without timing overlap.
|
110
|
-
"""
|
111
|
-
|
112
|
-
@deprecate_pulse_func
|
113
|
-
def __init__(
|
114
|
-
self,
|
115
|
-
duration: int,
|
116
|
-
channel: chans.Channel,
|
117
|
-
name: str | None = None,
|
118
|
-
):
|
119
|
-
"""Create a time blockade directive.
|
120
|
-
|
121
|
-
Args:
|
122
|
-
duration: Length of time of the occupation in terms of dt.
|
123
|
-
channel: The channel that will be the occupied.
|
124
|
-
name: Name of the time blockade for display purposes.
|
125
|
-
"""
|
126
|
-
super().__init__(operands=(duration, channel), name=name)
|
127
|
-
|
128
|
-
def _validate(self):
|
129
|
-
"""Called after initialization to validate instruction data.
|
130
|
-
|
131
|
-
Raises:
|
132
|
-
PulseError: If the input ``duration`` is not integer value.
|
133
|
-
"""
|
134
|
-
if not isinstance(self.duration, int):
|
135
|
-
raise PulseError(
|
136
|
-
"TimeBlockade duration cannot be parameterized. Specify an integer duration value."
|
137
|
-
)
|
138
|
-
|
139
|
-
@property
|
140
|
-
def channel(self) -> chans.Channel:
|
141
|
-
"""Return the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
|
142
|
-
scheduled on.
|
143
|
-
"""
|
144
|
-
return self.operands[1]
|
145
|
-
|
146
|
-
@property
|
147
|
-
def channels(self) -> tuple[chans.Channel]:
|
148
|
-
"""Returns the channels that this schedule uses."""
|
149
|
-
return (self.channel,)
|
150
|
-
|
151
|
-
@property
|
152
|
-
def duration(self) -> int:
|
153
|
-
"""Duration of this instruction."""
|
154
|
-
return self.operands[0]
|
@@ -1,135 +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
|
-
"""Frequency instructions module. These instructions allow the user to manipulate
|
14
|
-
the frequency of a channel.
|
15
|
-
"""
|
16
|
-
from typing import Optional, Union, Tuple
|
17
|
-
|
18
|
-
from qiskit.circuit.parameterexpression import ParameterExpression
|
19
|
-
from qiskit.pulse.channels import PulseChannel
|
20
|
-
from qiskit.pulse.instructions.instruction import Instruction
|
21
|
-
from qiskit.pulse.exceptions import PulseError
|
22
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
23
|
-
|
24
|
-
|
25
|
-
class SetFrequency(Instruction):
|
26
|
-
r"""Set the channel frequency. This instruction operates on ``PulseChannel`` s.
|
27
|
-
A ``PulseChannel`` creates pulses of the form
|
28
|
-
|
29
|
-
.. math::
|
30
|
-
Re[\exp(i 2\pi f jdt + \phi) d_j].
|
31
|
-
|
32
|
-
Here, :math:`f` is the frequency of the channel. The instruction ``SetFrequency`` allows
|
33
|
-
the user to set the value of :math:`f`. All pulses that are played on a channel
|
34
|
-
after SetFrequency has been called will have the corresponding frequency.
|
35
|
-
|
36
|
-
The duration of SetFrequency is 0.
|
37
|
-
"""
|
38
|
-
|
39
|
-
@deprecate_pulse_func
|
40
|
-
def __init__(
|
41
|
-
self,
|
42
|
-
frequency: Union[float, ParameterExpression],
|
43
|
-
channel: PulseChannel,
|
44
|
-
name: Optional[str] = None,
|
45
|
-
):
|
46
|
-
"""Creates a new set channel frequency instruction.
|
47
|
-
|
48
|
-
Args:
|
49
|
-
frequency: New frequency of the channel in Hz.
|
50
|
-
channel: The channel this instruction operates on.
|
51
|
-
name: Name of this set channel frequency instruction.
|
52
|
-
"""
|
53
|
-
super().__init__(operands=(frequency, channel), name=name)
|
54
|
-
|
55
|
-
def _validate(self):
|
56
|
-
"""Called after initialization to validate instruction data.
|
57
|
-
|
58
|
-
Raises:
|
59
|
-
PulseError: If the input ``channel`` is not type :class:`PulseChannel`.
|
60
|
-
"""
|
61
|
-
if not isinstance(self.channel, PulseChannel):
|
62
|
-
raise PulseError(f"Expected a pulse channel, got {self.channel} instead.")
|
63
|
-
|
64
|
-
@property
|
65
|
-
def frequency(self) -> Union[float, ParameterExpression]:
|
66
|
-
"""New frequency."""
|
67
|
-
return self.operands[0]
|
68
|
-
|
69
|
-
@property
|
70
|
-
def channel(self) -> PulseChannel:
|
71
|
-
"""Return the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
|
72
|
-
scheduled on.
|
73
|
-
"""
|
74
|
-
return self.operands[1]
|
75
|
-
|
76
|
-
@property
|
77
|
-
def channels(self) -> Tuple[PulseChannel]:
|
78
|
-
"""Returns the channels that this schedule uses."""
|
79
|
-
return (self.channel,)
|
80
|
-
|
81
|
-
@property
|
82
|
-
def duration(self) -> int:
|
83
|
-
"""Duration of this instruction."""
|
84
|
-
return 0
|
85
|
-
|
86
|
-
|
87
|
-
class ShiftFrequency(Instruction):
|
88
|
-
"""Shift the channel frequency away from the current frequency."""
|
89
|
-
|
90
|
-
@deprecate_pulse_func
|
91
|
-
def __init__(
|
92
|
-
self,
|
93
|
-
frequency: Union[float, ParameterExpression],
|
94
|
-
channel: PulseChannel,
|
95
|
-
name: Optional[str] = None,
|
96
|
-
):
|
97
|
-
"""Creates a new shift frequency instruction.
|
98
|
-
|
99
|
-
Args:
|
100
|
-
frequency: Frequency shift of the channel in Hz.
|
101
|
-
channel: The channel this instruction operates on.
|
102
|
-
name: Name of this set channel frequency instruction.
|
103
|
-
"""
|
104
|
-
super().__init__(operands=(frequency, channel), name=name)
|
105
|
-
|
106
|
-
def _validate(self):
|
107
|
-
"""Called after initialization to validate instruction data.
|
108
|
-
|
109
|
-
Raises:
|
110
|
-
PulseError: If the input ``channel`` is not type :class:`PulseChannel`.
|
111
|
-
"""
|
112
|
-
if not isinstance(self.channel, PulseChannel):
|
113
|
-
raise PulseError(f"Expected a pulse channel, got {self.channel} instead.")
|
114
|
-
|
115
|
-
@property
|
116
|
-
def frequency(self) -> Union[float, ParameterExpression]:
|
117
|
-
"""Frequency shift from the set frequency."""
|
118
|
-
return self.operands[0]
|
119
|
-
|
120
|
-
@property
|
121
|
-
def channel(self) -> PulseChannel:
|
122
|
-
"""Return the :py:class:`~qiskit.pulse.channels.Channel` that this instruction is
|
123
|
-
scheduled on.
|
124
|
-
"""
|
125
|
-
return self.operands[1]
|
126
|
-
|
127
|
-
@property
|
128
|
-
def channels(self) -> Tuple[PulseChannel]:
|
129
|
-
"""Returns the channels that this schedule uses."""
|
130
|
-
return (self.channel,)
|
131
|
-
|
132
|
-
@property
|
133
|
-
def duration(self) -> int:
|
134
|
-
"""Duration of this instruction."""
|
135
|
-
return 0
|
@@ -1,270 +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
|
-
"""
|
14
|
-
``Instruction`` s are single operations within a :py:class:`~qiskit.pulse.Schedule`, and can be
|
15
|
-
used the same way as :py:class:`~qiskit.pulse.Schedule` s.
|
16
|
-
|
17
|
-
For example::
|
18
|
-
|
19
|
-
duration = 10
|
20
|
-
channel = DriveChannel(0)
|
21
|
-
sched = Schedule()
|
22
|
-
sched += Delay(duration, channel) # Delay is a specific subclass of Instruction
|
23
|
-
"""
|
24
|
-
from __future__ import annotations
|
25
|
-
from abc import ABC, abstractmethod
|
26
|
-
from collections.abc import Iterable
|
27
|
-
|
28
|
-
from qiskit.circuit import Parameter, ParameterExpression
|
29
|
-
from qiskit.pulse.channels import Channel
|
30
|
-
from qiskit.pulse.exceptions import PulseError
|
31
|
-
from qiskit.utils.deprecate_pulse import deprecate_pulse_func
|
32
|
-
|
33
|
-
|
34
|
-
# pylint: disable=bad-docstring-quotes
|
35
|
-
|
36
|
-
|
37
|
-
class Instruction(ABC):
|
38
|
-
"""The smallest schedulable unit: a single instruction. It has a fixed duration and specified
|
39
|
-
channels.
|
40
|
-
"""
|
41
|
-
|
42
|
-
@deprecate_pulse_func
|
43
|
-
def __init__(
|
44
|
-
self,
|
45
|
-
operands: tuple,
|
46
|
-
name: str | None = None,
|
47
|
-
):
|
48
|
-
"""Instruction initializer.
|
49
|
-
|
50
|
-
Args:
|
51
|
-
operands: The argument list.
|
52
|
-
name: Optional display name for this instruction.
|
53
|
-
"""
|
54
|
-
self._operands = operands
|
55
|
-
self._name = name
|
56
|
-
self._validate()
|
57
|
-
|
58
|
-
def _validate(self):
|
59
|
-
"""Called after initialization to validate instruction data.
|
60
|
-
|
61
|
-
Raises:
|
62
|
-
PulseError: If the input ``channels`` are not all of type :class:`Channel`.
|
63
|
-
"""
|
64
|
-
for channel in self.channels:
|
65
|
-
if not isinstance(channel, Channel):
|
66
|
-
raise PulseError(f"Expected a channel, got {channel} instead.")
|
67
|
-
|
68
|
-
@property
|
69
|
-
def name(self) -> str:
|
70
|
-
"""Name of this instruction."""
|
71
|
-
return self._name
|
72
|
-
|
73
|
-
@property
|
74
|
-
def id(self) -> int: # pylint: disable=invalid-name
|
75
|
-
"""Unique identifier for this instruction."""
|
76
|
-
return id(self)
|
77
|
-
|
78
|
-
@property
|
79
|
-
def operands(self) -> tuple:
|
80
|
-
"""Return instruction operands."""
|
81
|
-
return self._operands
|
82
|
-
|
83
|
-
@property
|
84
|
-
@abstractmethod
|
85
|
-
def channels(self) -> tuple[Channel, ...]:
|
86
|
-
"""Returns the channels that this schedule uses."""
|
87
|
-
raise NotImplementedError
|
88
|
-
|
89
|
-
@property
|
90
|
-
def start_time(self) -> int:
|
91
|
-
"""Relative begin time of this instruction."""
|
92
|
-
return 0
|
93
|
-
|
94
|
-
@property
|
95
|
-
def stop_time(self) -> int:
|
96
|
-
"""Relative end time of this instruction."""
|
97
|
-
return self.duration
|
98
|
-
|
99
|
-
@property
|
100
|
-
def duration(self) -> int | ParameterExpression:
|
101
|
-
"""Duration of this instruction."""
|
102
|
-
raise NotImplementedError
|
103
|
-
|
104
|
-
@property
|
105
|
-
def _children(self) -> tuple["Instruction", ...]:
|
106
|
-
"""Instruction has no child nodes."""
|
107
|
-
return ()
|
108
|
-
|
109
|
-
@property
|
110
|
-
def instructions(self) -> tuple[tuple[int, "Instruction"], ...]:
|
111
|
-
"""Iterable for getting instructions from Schedule tree."""
|
112
|
-
return tuple(self._instructions())
|
113
|
-
|
114
|
-
def ch_duration(self, *channels: Channel) -> int:
|
115
|
-
"""Return duration of the supplied channels in this Instruction.
|
116
|
-
|
117
|
-
Args:
|
118
|
-
*channels: Supplied channels
|
119
|
-
"""
|
120
|
-
return self.ch_stop_time(*channels)
|
121
|
-
|
122
|
-
def ch_start_time(self, *channels: Channel) -> int:
|
123
|
-
# pylint: disable=unused-argument
|
124
|
-
"""Return minimum start time for supplied channels.
|
125
|
-
|
126
|
-
Args:
|
127
|
-
*channels: Supplied channels
|
128
|
-
"""
|
129
|
-
return 0
|
130
|
-
|
131
|
-
def ch_stop_time(self, *channels: Channel) -> int:
|
132
|
-
"""Return maximum start time for supplied channels.
|
133
|
-
|
134
|
-
Args:
|
135
|
-
*channels: Supplied channels
|
136
|
-
"""
|
137
|
-
if any(chan in self.channels for chan in channels):
|
138
|
-
return self.duration
|
139
|
-
return 0
|
140
|
-
|
141
|
-
def _instructions(self, time: int = 0) -> Iterable[tuple[int, "Instruction"]]:
|
142
|
-
"""Iterable for flattening Schedule tree.
|
143
|
-
|
144
|
-
Args:
|
145
|
-
time: Shifted time of this node due to parent
|
146
|
-
|
147
|
-
Yields:
|
148
|
-
Tuple[int, Union['Schedule, 'Instruction']]: Tuple of the form
|
149
|
-
(start_time, instruction).
|
150
|
-
"""
|
151
|
-
yield (time, self)
|
152
|
-
|
153
|
-
def shift(self, time: int, name: str | None = None):
|
154
|
-
"""Return a new schedule shifted forward by `time`.
|
155
|
-
|
156
|
-
Args:
|
157
|
-
time: Time to shift by
|
158
|
-
name: Name of the new schedule. Defaults to name of self
|
159
|
-
|
160
|
-
Returns:
|
161
|
-
Schedule: The shifted schedule.
|
162
|
-
"""
|
163
|
-
from qiskit.pulse.schedule import Schedule
|
164
|
-
|
165
|
-
if name is None:
|
166
|
-
name = self.name
|
167
|
-
return Schedule((time, self), name=name)
|
168
|
-
|
169
|
-
def insert(self, start_time: int, schedule, name: str | None = None):
|
170
|
-
"""Return a new :class:`~qiskit.pulse.Schedule` with ``schedule`` inserted within
|
171
|
-
``self`` at ``start_time``.
|
172
|
-
|
173
|
-
Args:
|
174
|
-
start_time: Time to insert the schedule schedule
|
175
|
-
schedule (Union['Schedule', 'Instruction']): Schedule or instruction to insert
|
176
|
-
name: Name of the new schedule. Defaults to name of self
|
177
|
-
|
178
|
-
Returns:
|
179
|
-
Schedule: A new schedule with ``schedule`` inserted with this instruction at t=0.
|
180
|
-
"""
|
181
|
-
from qiskit.pulse.schedule import Schedule
|
182
|
-
|
183
|
-
if name is None:
|
184
|
-
name = self.name
|
185
|
-
return Schedule(self, (start_time, schedule), name=name)
|
186
|
-
|
187
|
-
def append(self, schedule, name: str | None = None):
|
188
|
-
"""Return a new :class:`~qiskit.pulse.Schedule` with ``schedule`` inserted at the
|
189
|
-
maximum time over all channels shared between ``self`` and ``schedule``.
|
190
|
-
|
191
|
-
Args:
|
192
|
-
schedule (Union['Schedule', 'Instruction']): Schedule or instruction to be appended
|
193
|
-
name: Name of the new schedule. Defaults to name of self
|
194
|
-
|
195
|
-
Returns:
|
196
|
-
Schedule: A new schedule with ``schedule`` a this instruction at t=0.
|
197
|
-
"""
|
198
|
-
common_channels = set(self.channels) & set(schedule.channels)
|
199
|
-
time = self.ch_stop_time(*common_channels)
|
200
|
-
return self.insert(time, schedule, name=name)
|
201
|
-
|
202
|
-
@property
|
203
|
-
def parameters(self) -> set:
|
204
|
-
"""Parameters which determine the instruction behavior."""
|
205
|
-
|
206
|
-
def _get_parameters_recursive(obj):
|
207
|
-
params = set()
|
208
|
-
if hasattr(obj, "parameters"):
|
209
|
-
for param in obj.parameters:
|
210
|
-
if isinstance(param, Parameter):
|
211
|
-
params.add(param)
|
212
|
-
else:
|
213
|
-
params |= _get_parameters_recursive(param)
|
214
|
-
return params
|
215
|
-
|
216
|
-
parameters = set()
|
217
|
-
for op in self.operands:
|
218
|
-
parameters |= _get_parameters_recursive(op)
|
219
|
-
return parameters
|
220
|
-
|
221
|
-
def is_parameterized(self) -> bool:
|
222
|
-
"""Return True iff the instruction is parameterized."""
|
223
|
-
return any(self.parameters)
|
224
|
-
|
225
|
-
def __eq__(self, other: object) -> bool:
|
226
|
-
"""Check if this Instruction is equal to the `other` instruction.
|
227
|
-
|
228
|
-
Equality is determined by the instruction sharing the same operands and channels.
|
229
|
-
"""
|
230
|
-
if not isinstance(other, Instruction):
|
231
|
-
return NotImplemented
|
232
|
-
return isinstance(other, type(self)) and self.operands == other.operands
|
233
|
-
|
234
|
-
def __hash__(self) -> int:
|
235
|
-
return hash((type(self), self.operands, self.name))
|
236
|
-
|
237
|
-
def __add__(self, other):
|
238
|
-
"""Return a new schedule with `other` inserted within `self` at `start_time`.
|
239
|
-
|
240
|
-
Args:
|
241
|
-
other (Union['Schedule', 'Instruction']): Schedule or instruction to be appended
|
242
|
-
|
243
|
-
Returns:
|
244
|
-
Schedule: A new schedule with ``schedule`` appended after this instruction at t=0.
|
245
|
-
"""
|
246
|
-
return self.append(other)
|
247
|
-
|
248
|
-
def __or__(self, other):
|
249
|
-
"""Return a new schedule which is the union of `self` and `other`.
|
250
|
-
|
251
|
-
Args:
|
252
|
-
other (Union['Schedule', 'Instruction']): Schedule or instruction to union with
|
253
|
-
|
254
|
-
Returns:
|
255
|
-
Schedule: A new schedule with ``schedule`` inserted with this instruction at t=0
|
256
|
-
"""
|
257
|
-
return self.insert(0, other)
|
258
|
-
|
259
|
-
def __lshift__(self, time: int):
|
260
|
-
"""Return a new schedule which is shifted forward by `time`.
|
261
|
-
|
262
|
-
Returns:
|
263
|
-
Schedule: The shifted schedule
|
264
|
-
"""
|
265
|
-
return self.shift(time)
|
266
|
-
|
267
|
-
def __repr__(self) -> str:
|
268
|
-
operands = ", ".join(str(op) for op in self.operands)
|
269
|
-
name_repr = f", name='{self.name}'" if self.name else ""
|
270
|
-
return f"{self.__class__.__name__}({operands}{name_repr})"
|