qiskit 1.1.2__cp38-abi3-macosx_10_9_universal2.whl → 1.2.0rc1__cp38-abi3-macosx_10_9_universal2.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 +27 -24
- qiskit/_accelerate.abi3.so +0 -0
- qiskit/_numpy_compat.py +1 -1
- qiskit/assembler/assemble_circuits.py +107 -64
- qiskit/assembler/assemble_schedules.py +5 -12
- qiskit/assembler/disassemble.py +10 -1
- qiskit/circuit/__init__.py +1 -1
- qiskit/circuit/_classical_resource_map.py +5 -5
- qiskit/circuit/_utils.py +0 -13
- qiskit/circuit/add_control.py +1 -1
- qiskit/circuit/annotated_operation.py +23 -1
- qiskit/circuit/classical/expr/expr.py +4 -4
- qiskit/circuit/classical/expr/visitors.py +1 -1
- qiskit/circuit/classical/types/__init__.py +1 -1
- qiskit/circuit/classical/types/types.py +2 -2
- qiskit/circuit/classicalfunction/boolean_expression.py +1 -1
- qiskit/circuit/classicalfunction/classical_function_visitor.py +5 -5
- qiskit/circuit/classicalfunction/utils.py +1 -1
- qiskit/circuit/classicalregister.py +1 -1
- qiskit/circuit/commutation_checker.py +83 -35
- qiskit/circuit/controlflow/_builder_utils.py +1 -1
- qiskit/circuit/controlflow/builder.py +10 -6
- qiskit/circuit/controlflow/if_else.py +2 -2
- qiskit/circuit/controlflow/switch_case.py +1 -1
- qiskit/circuit/delay.py +1 -1
- qiskit/circuit/duration.py +2 -2
- qiskit/circuit/equivalence.py +5 -7
- qiskit/circuit/gate.py +11 -8
- qiskit/circuit/instruction.py +31 -13
- qiskit/circuit/instructionset.py +2 -5
- qiskit/circuit/library/__init__.py +2 -1
- qiskit/circuit/library/arithmetic/linear_amplitude_function.py +1 -1
- qiskit/circuit/library/arithmetic/linear_pauli_rotations.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_chebyshev.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py +1 -1
- qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py +3 -3
- qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py +1 -1
- qiskit/circuit/library/basis_change/__init__.py +1 -1
- qiskit/circuit/library/basis_change/qft.py +40 -6
- qiskit/circuit/library/blueprintcircuit.py +3 -5
- qiskit/circuit/library/data_preparation/__init__.py +9 -2
- qiskit/circuit/library/data_preparation/initializer.py +8 -0
- qiskit/circuit/library/data_preparation/state_preparation.py +98 -178
- qiskit/circuit/library/generalized_gates/isometry.py +8 -8
- qiskit/circuit/library/generalized_gates/linear_function.py +3 -2
- qiskit/circuit/library/generalized_gates/mcg_up_to_diagonal.py +4 -4
- qiskit/circuit/library/generalized_gates/permutation.py +8 -9
- qiskit/circuit/library/generalized_gates/uc.py +3 -3
- qiskit/circuit/library/generalized_gates/uc_pauli_rot.py +2 -2
- qiskit/circuit/library/generalized_gates/unitary.py +13 -11
- qiskit/circuit/library/graph_state.py +1 -1
- qiskit/circuit/library/hamiltonian_gate.py +1 -2
- qiskit/circuit/library/hidden_linear_function.py +1 -1
- qiskit/circuit/library/n_local/evolved_operator_ansatz.py +3 -2
- qiskit/circuit/library/n_local/n_local.py +4 -5
- qiskit/circuit/library/n_local/pauli_two_design.py +1 -1
- qiskit/circuit/library/n_local/qaoa_ansatz.py +6 -8
- qiskit/circuit/library/n_local/two_local.py +1 -1
- qiskit/circuit/library/overlap.py +11 -5
- qiskit/circuit/library/pauli_evolution.py +7 -3
- qiskit/circuit/library/standard_gates/dcx.py +3 -0
- qiskit/circuit/library/standard_gates/ecr.py +3 -0
- qiskit/circuit/library/standard_gates/global_phase.py +3 -0
- qiskit/circuit/library/standard_gates/h.py +13 -5
- qiskit/circuit/library/standard_gates/i.py +3 -0
- qiskit/circuit/library/standard_gates/iswap.py +3 -0
- qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py +19 -10
- qiskit/circuit/library/standard_gates/p.py +14 -9
- qiskit/circuit/library/standard_gates/r.py +3 -0
- qiskit/circuit/library/standard_gates/rx.py +21 -6
- qiskit/circuit/library/standard_gates/rxx.py +40 -1
- qiskit/circuit/library/standard_gates/ry.py +21 -6
- qiskit/circuit/library/standard_gates/ryy.py +40 -1
- qiskit/circuit/library/standard_gates/rz.py +22 -6
- qiskit/circuit/library/standard_gates/rzx.py +40 -1
- qiskit/circuit/library/standard_gates/rzz.py +41 -2
- qiskit/circuit/library/standard_gates/s.py +77 -0
- qiskit/circuit/library/standard_gates/swap.py +12 -5
- qiskit/circuit/library/standard_gates/sx.py +14 -5
- qiskit/circuit/library/standard_gates/t.py +5 -0
- qiskit/circuit/library/standard_gates/u.py +22 -7
- qiskit/circuit/library/standard_gates/u1.py +8 -3
- qiskit/circuit/library/standard_gates/u2.py +3 -0
- qiskit/circuit/library/standard_gates/u3.py +22 -7
- qiskit/circuit/library/standard_gates/x.py +156 -92
- qiskit/circuit/library/standard_gates/xx_minus_yy.py +40 -1
- qiskit/circuit/library/standard_gates/xx_plus_yy.py +52 -11
- qiskit/circuit/library/standard_gates/y.py +6 -1
- qiskit/circuit/library/standard_gates/z.py +8 -1
- qiskit/circuit/operation.py +1 -1
- qiskit/circuit/parameter.py +9 -10
- qiskit/circuit/parameterexpression.py +16 -13
- qiskit/circuit/parametertable.py +1 -190
- qiskit/circuit/parametervector.py +1 -1
- qiskit/circuit/quantumcircuit.py +392 -384
- qiskit/circuit/quantumcircuitdata.py +3 -5
- qiskit/circuit/quantumregister.py +1 -1
- qiskit/circuit/random/__init__.py +1 -1
- qiskit/circuit/random/utils.py +175 -26
- qiskit/circuit/register.py +5 -7
- qiskit/circuit/singleton.py +3 -3
- qiskit/circuit/tools/pi_check.py +4 -4
- qiskit/compiler/assembler.py +95 -24
- qiskit/compiler/scheduler.py +2 -2
- qiskit/compiler/transpiler.py +41 -127
- qiskit/converters/circuit_to_dag.py +4 -6
- qiskit/converters/circuit_to_gate.py +4 -8
- qiskit/converters/circuit_to_instruction.py +5 -17
- qiskit/converters/dag_to_circuit.py +2 -6
- qiskit/dagcircuit/collect_blocks.py +2 -2
- qiskit/dagcircuit/dagcircuit.py +190 -187
- qiskit/dagcircuit/dagdependency.py +4 -4
- qiskit/dagcircuit/dagdependency_v2.py +4 -4
- qiskit/dagcircuit/dagdepnode.py +1 -1
- qiskit/dagcircuit/dagnode.py +66 -157
- qiskit/passmanager/flow_controllers.py +1 -1
- qiskit/passmanager/passmanager.py +3 -3
- qiskit/primitives/__init__.py +1 -5
- qiskit/primitives/backend_estimator.py +25 -15
- qiskit/primitives/backend_estimator_v2.py +31 -7
- qiskit/primitives/backend_sampler.py +21 -12
- qiskit/primitives/backend_sampler_v2.py +12 -3
- qiskit/primitives/base/base_estimator.py +31 -4
- qiskit/primitives/base/base_primitive.py +2 -2
- qiskit/primitives/base/base_result.py +2 -2
- qiskit/primitives/base/base_sampler.py +26 -2
- qiskit/primitives/base/estimator_result.py +2 -2
- qiskit/primitives/base/sampler_result.py +2 -2
- qiskit/primitives/containers/__init__.py +0 -1
- qiskit/primitives/containers/bindings_array.py +2 -2
- qiskit/primitives/containers/bit_array.py +108 -10
- qiskit/primitives/containers/shape.py +3 -3
- qiskit/primitives/estimator.py +9 -2
- qiskit/primitives/primitive_job.py +1 -1
- qiskit/primitives/sampler.py +10 -3
- qiskit/primitives/statevector_estimator.py +5 -3
- qiskit/primitives/statevector_sampler.py +11 -5
- qiskit/primitives/utils.py +16 -0
- qiskit/providers/backend.py +15 -6
- qiskit/providers/backend_compat.py +7 -4
- qiskit/providers/basic_provider/basic_provider_tools.py +1 -1
- qiskit/providers/basic_provider/basic_simulator.py +32 -24
- qiskit/providers/fake_provider/fake_backend.py +10 -3
- qiskit/providers/fake_provider/fake_openpulse_2q.py +154 -146
- qiskit/providers/fake_provider/fake_openpulse_3q.py +226 -217
- qiskit/providers/fake_provider/fake_qasm_backend.py +5 -1
- qiskit/providers/fake_provider/generic_backend_v2.py +80 -50
- qiskit/providers/models/__init__.py +11 -0
- qiskit/providers/models/backendconfiguration.py +50 -4
- qiskit/providers/models/backendproperties.py +13 -2
- qiskit/providers/models/pulsedefaults.py +10 -11
- qiskit/providers/options.py +13 -13
- qiskit/providers/providerutils.py +3 -1
- qiskit/pulse/configuration.py +8 -12
- qiskit/pulse/instruction_schedule_map.py +3 -5
- qiskit/pulse/instructions/acquire.py +7 -8
- qiskit/pulse/instructions/instruction.py +2 -3
- qiskit/pulse/library/samplers/decorators.py +5 -9
- qiskit/pulse/library/symbolic_pulses.py +4 -7
- qiskit/pulse/library/waveform.py +2 -5
- qiskit/pulse/macros.py +11 -6
- qiskit/pulse/parser.py +8 -10
- qiskit/pulse/schedule.py +9 -17
- qiskit/pulse/transforms/alignments.py +1 -3
- qiskit/pulse/utils.py +1 -2
- qiskit/qasm/libs/stdgates.inc +35 -28
- qiskit/qasm2/__init__.py +7 -7
- qiskit/qasm2/export.py +5 -9
- qiskit/qasm2/parse.py +1 -1
- qiskit/qasm3/ast.py +9 -25
- qiskit/qasm3/exporter.py +578 -481
- qiskit/qasm3/printer.py +7 -16
- qiskit/qobj/common.py +10 -0
- qiskit/qobj/converters/lo_config.py +9 -0
- qiskit/qobj/converters/pulse_instruction.py +13 -6
- qiskit/qobj/pulse_qobj.py +69 -15
- qiskit/qobj/qasm_qobj.py +72 -20
- qiskit/qobj/utils.py +9 -0
- qiskit/qpy/binary_io/circuits.py +8 -5
- qiskit/qpy/binary_io/schedules.py +1 -1
- qiskit/qpy/binary_io/value.py +3 -3
- qiskit/qpy/interface.py +3 -2
- qiskit/qpy/type_keys.py +2 -2
- qiskit/quantum_info/operators/channel/quantum_channel.py +3 -6
- qiskit/quantum_info/operators/channel/superop.py +2 -2
- qiskit/quantum_info/operators/channel/transformations.py +1 -1
- qiskit/quantum_info/operators/dihedral/dihedral.py +3 -4
- qiskit/quantum_info/operators/dihedral/dihedral_circuits.py +1 -3
- qiskit/quantum_info/operators/dihedral/random.py +6 -3
- qiskit/quantum_info/operators/measures.py +2 -2
- qiskit/quantum_info/operators/op_shape.py +12 -20
- qiskit/quantum_info/operators/operator.py +14 -21
- qiskit/quantum_info/operators/predicates.py +1 -0
- qiskit/quantum_info/operators/symplectic/base_pauli.py +7 -11
- qiskit/quantum_info/operators/symplectic/clifford.py +1 -1
- qiskit/quantum_info/operators/symplectic/pauli.py +3 -3
- qiskit/quantum_info/operators/symplectic/pauli_list.py +9 -10
- qiskit/quantum_info/operators/symplectic/random.py +1 -1
- qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py +14 -16
- qiskit/quantum_info/quaternion.py +1 -1
- qiskit/quantum_info/states/densitymatrix.py +5 -8
- qiskit/quantum_info/states/stabilizerstate.py +128 -37
- qiskit/quantum_info/states/statevector.py +4 -8
- qiskit/result/counts.py +2 -2
- qiskit/result/mitigation/correlated_readout_mitigator.py +2 -2
- qiskit/result/mitigation/local_readout_mitigator.py +2 -2
- qiskit/result/mitigation/utils.py +1 -3
- qiskit/result/models.py +17 -16
- qiskit/result/result.py +15 -20
- qiskit/scheduler/lowering.py +2 -2
- qiskit/synthesis/__init__.py +2 -1
- qiskit/synthesis/clifford/__init__.py +1 -1
- qiskit/synthesis/clifford/clifford_decompose_ag.py +2 -2
- qiskit/synthesis/clifford/clifford_decompose_bm.py +10 -240
- qiskit/synthesis/clifford/clifford_decompose_greedy.py +9 -303
- qiskit/synthesis/clifford/clifford_decompose_layers.py +25 -23
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_full.py +1 -1
- qiskit/synthesis/cnotdihedral/cnotdihedral_decompose_general.py +1 -1
- qiskit/synthesis/discrete_basis/generate_basis_approximations.py +1 -1
- qiskit/synthesis/discrete_basis/solovay_kitaev.py +2 -2
- qiskit/synthesis/evolution/evolution_synthesis.py +4 -2
- qiskit/synthesis/evolution/lie_trotter.py +46 -19
- qiskit/synthesis/evolution/product_formula.py +111 -55
- qiskit/synthesis/evolution/qdrift.py +40 -10
- qiskit/synthesis/evolution/suzuki_trotter.py +43 -33
- qiskit/synthesis/linear/__init__.py +1 -0
- qiskit/synthesis/linear/cnot_synth.py +22 -96
- qiskit/synthesis/linear/linear_depth_lnn.py +8 -8
- qiskit/synthesis/linear/linear_matrix_utils.py +13 -161
- qiskit/synthesis/linear_phase/cnot_phase_synth.py +1 -1
- qiskit/synthesis/linear_phase/cx_cz_depth_lnn.py +3 -3
- qiskit/synthesis/linear_phase/cz_depth_lnn.py +1 -1
- qiskit/synthesis/one_qubit/one_qubit_decompose.py +29 -29
- qiskit/synthesis/permutation/permutation_full.py +5 -29
- qiskit/synthesis/permutation/permutation_lnn.py +2 -24
- qiskit/synthesis/permutation/permutation_utils.py +2 -59
- qiskit/synthesis/qft/__init__.py +1 -0
- qiskit/synthesis/qft/qft_decompose_full.py +79 -0
- qiskit/synthesis/qft/qft_decompose_lnn.py +17 -9
- qiskit/synthesis/stabilizer/stabilizer_circuit.py +6 -6
- qiskit/synthesis/stabilizer/stabilizer_decompose.py +2 -2
- qiskit/synthesis/two_qubit/local_invariance.py +8 -38
- qiskit/synthesis/two_qubit/two_qubit_decompose.py +48 -129
- qiskit/synthesis/unitary/aqc/cnot_structures.py +1 -1
- qiskit/synthesis/unitary/qsd.py +5 -3
- qiskit/transpiler/__init__.py +1 -0
- qiskit/transpiler/basepasses.py +1 -1
- qiskit/transpiler/coupling.py +3 -3
- qiskit/transpiler/instruction_durations.py +1 -2
- qiskit/transpiler/layout.py +3 -3
- qiskit/transpiler/passes/__init__.py +2 -0
- qiskit/transpiler/passes/basis/basis_translator.py +82 -63
- qiskit/transpiler/passes/basis/translate_parameterized.py +3 -5
- qiskit/transpiler/passes/basis/unroll_3q_or_more.py +1 -1
- qiskit/transpiler/passes/basis/unroll_custom_definitions.py +10 -10
- qiskit/transpiler/passes/calibration/rx_builder.py +3 -3
- qiskit/transpiler/passes/calibration/rzx_builder.py +3 -3
- qiskit/transpiler/passes/layout/apply_layout.py +13 -3
- qiskit/transpiler/passes/layout/sabre_layout.py +10 -8
- qiskit/transpiler/passes/layout/sabre_pre_layout.py +4 -1
- qiskit/transpiler/passes/layout/set_layout.py +2 -2
- qiskit/transpiler/passes/layout/vf2_layout.py +1 -1
- qiskit/transpiler/passes/layout/vf2_utils.py +3 -3
- qiskit/transpiler/passes/optimization/__init__.py +1 -0
- qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +2 -2
- qiskit/transpiler/passes/optimization/commutation_analysis.py +7 -10
- qiskit/transpiler/passes/optimization/commutative_cancellation.py +35 -19
- qiskit/transpiler/passes/optimization/consolidate_blocks.py +11 -8
- qiskit/transpiler/passes/optimization/inverse_cancellation.py +6 -6
- qiskit/transpiler/passes/optimization/optimize_1q_decomposition.py +64 -41
- qiskit/transpiler/passes/optimization/optimize_1q_gates.py +1 -1
- qiskit/transpiler/passes/optimization/split_2q_unitaries.py +83 -0
- qiskit/transpiler/passes/optimization/template_matching/backward_match.py +1 -1
- qiskit/transpiler/passes/optimization/template_matching/forward_match.py +2 -2
- qiskit/transpiler/passes/optimization/template_matching/template_substitution.py +1 -1
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/commuting_2q_gate_router.py +3 -2
- qiskit/transpiler/passes/routing/commuting_2q_gate_routing/swap_strategy.py +1 -1
- qiskit/transpiler/passes/routing/layout_transformation.py +2 -1
- qiskit/transpiler/passes/routing/sabre_swap.py +35 -26
- qiskit/transpiler/passes/routing/star_prerouting.py +80 -105
- qiskit/transpiler/passes/routing/stochastic_swap.py +1 -3
- qiskit/transpiler/passes/scheduling/alap.py +1 -2
- qiskit/transpiler/passes/scheduling/alignments/__init__.py +2 -2
- qiskit/transpiler/passes/scheduling/alignments/check_durations.py +1 -1
- qiskit/transpiler/passes/scheduling/alignments/pulse_gate_validation.py +1 -1
- qiskit/transpiler/passes/scheduling/alignments/reschedule.py +1 -1
- qiskit/transpiler/passes/scheduling/asap.py +1 -2
- qiskit/transpiler/passes/scheduling/base_scheduler.py +5 -5
- qiskit/transpiler/passes/scheduling/dynamical_decoupling.py +3 -3
- qiskit/transpiler/passes/scheduling/padding/base_padding.py +1 -1
- qiskit/transpiler/passes/scheduling/padding/dynamical_decoupling.py +11 -11
- qiskit/transpiler/passes/scheduling/scheduling/base_scheduler.py +7 -6
- qiskit/transpiler/passes/scheduling/time_unit_conversion.py +4 -3
- qiskit/transpiler/passes/synthesis/high_level_synthesis.py +211 -36
- qiskit/transpiler/passes/synthesis/plugin.py +2 -2
- qiskit/transpiler/passes/synthesis/unitary_synthesis.py +80 -40
- qiskit/transpiler/passes/utils/__init__.py +0 -1
- qiskit/transpiler/passes/utils/check_gate_direction.py +4 -4
- qiskit/transpiler/passes/utils/check_map.py +3 -6
- qiskit/transpiler/passes/utils/convert_conditions_to_if_ops.py +3 -4
- qiskit/transpiler/passes/utils/error.py +2 -2
- qiskit/transpiler/passes/utils/fixed_point.py +3 -3
- qiskit/transpiler/passes/utils/gate_direction.py +1 -1
- qiskit/transpiler/passes/utils/gates_basis.py +1 -2
- qiskit/transpiler/passmanager.py +7 -6
- qiskit/transpiler/preset_passmanagers/__init__.py +4 -228
- qiskit/transpiler/preset_passmanagers/builtin_plugins.py +117 -18
- qiskit/transpiler/preset_passmanagers/common.py +3 -6
- qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py +518 -0
- qiskit/transpiler/preset_passmanagers/level0.py +1 -1
- qiskit/transpiler/target.py +27 -8
- qiskit/user_config.py +29 -6
- qiskit/utils/classtools.py +3 -3
- qiskit/utils/deprecation.py +3 -2
- qiskit/utils/lazy_tester.py +2 -2
- qiskit/utils/optionals.py +8 -8
- qiskit/visualization/bloch.py +19 -67
- qiskit/visualization/circuit/_utils.py +34 -10
- qiskit/visualization/circuit/circuit_visualization.py +23 -16
- qiskit/visualization/circuit/latex.py +29 -27
- qiskit/visualization/circuit/matplotlib.py +4 -2
- qiskit/visualization/circuit/qcstyle.py +2 -2
- qiskit/visualization/circuit/text.py +9 -15
- qiskit/visualization/dag_visualization.py +5 -12
- qiskit/visualization/pulse_v2/core.py +1 -1
- qiskit/visualization/pulse_v2/events.py +1 -1
- qiskit/visualization/pulse_v2/generators/frame.py +3 -4
- qiskit/visualization/pulse_v2/generators/waveform.py +5 -9
- qiskit/visualization/pulse_v2/layouts.py +1 -5
- qiskit/visualization/pulse_v2/plotters/matplotlib.py +1 -2
- qiskit/visualization/state_visualization.py +5 -6
- qiskit/visualization/timeline/plotters/matplotlib.py +1 -2
- qiskit/visualization/transition_visualization.py +7 -2
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/METADATA +26 -26
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/RECORD +340 -338
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/WHEEL +1 -1
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/entry_points.txt +3 -0
- qiskit/transpiler/passes/utils/block_to_matrix.py +0 -47
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/LICENSE.txt +0 -0
- {qiskit-1.1.2.dist-info → qiskit-1.2.0rc1.dist-info}/top_level.txt +0 -0
@@ -12,6 +12,8 @@
|
|
12
12
|
|
13
13
|
"""The S, Sdg, CS and CSdg gates."""
|
14
14
|
|
15
|
+
from __future__ import annotations
|
16
|
+
|
15
17
|
from math import pi
|
16
18
|
from typing import Optional, Union
|
17
19
|
|
@@ -20,6 +22,7 @@ import numpy
|
|
20
22
|
from qiskit.circuit.singleton import SingletonGate, SingletonControlledGate, stdlib_singleton_key
|
21
23
|
from qiskit.circuit.quantumregister import QuantumRegister
|
22
24
|
from qiskit.circuit._utils import with_gate_array, with_controlled_gate_array
|
25
|
+
from qiskit._accelerate.circuit import StandardGate
|
23
26
|
|
24
27
|
|
25
28
|
_S_ARRAY = numpy.array([[1, 0], [0, 1j]])
|
@@ -57,6 +60,8 @@ class SGate(SingletonGate):
|
|
57
60
|
Equivalent to a :math:`\pi/2` radian rotation about the Z axis.
|
58
61
|
"""
|
59
62
|
|
63
|
+
_standard_gate = StandardGate.SGate
|
64
|
+
|
60
65
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
61
66
|
"""Create new S gate."""
|
62
67
|
super().__init__("s", 1, [], label=label, duration=duration, unit=unit)
|
@@ -80,6 +85,39 @@ class SGate(SingletonGate):
|
|
80
85
|
|
81
86
|
self.definition = qc
|
82
87
|
|
88
|
+
def control(
|
89
|
+
self,
|
90
|
+
num_ctrl_qubits: int = 1,
|
91
|
+
label: str | None = None,
|
92
|
+
ctrl_state: int | str | None = None,
|
93
|
+
annotated: bool | None = None,
|
94
|
+
):
|
95
|
+
"""Return a (multi-)controlled-S gate.
|
96
|
+
|
97
|
+
One control qubit returns a :class:`.CSGate`.
|
98
|
+
|
99
|
+
Args:
|
100
|
+
num_ctrl_qubits: number of control qubits.
|
101
|
+
label: An optional label for the gate [Default: ``None``]
|
102
|
+
ctrl_state: control state expressed as integer,
|
103
|
+
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
104
|
+
annotated: indicates whether the controlled gate should be implemented
|
105
|
+
as an annotated gate. If ``None``, this is handled as ``False``.
|
106
|
+
|
107
|
+
Returns:
|
108
|
+
ControlledGate: controlled version of this gate.
|
109
|
+
"""
|
110
|
+
if not annotated and num_ctrl_qubits == 1:
|
111
|
+
gate = CSGate(label=label, ctrl_state=ctrl_state, _base_label=self.label)
|
112
|
+
else:
|
113
|
+
gate = super().control(
|
114
|
+
num_ctrl_qubits=num_ctrl_qubits,
|
115
|
+
label=label,
|
116
|
+
ctrl_state=ctrl_state,
|
117
|
+
annotated=annotated,
|
118
|
+
)
|
119
|
+
return gate
|
120
|
+
|
83
121
|
def inverse(self, annotated: bool = False):
|
84
122
|
"""Return inverse of S (SdgGate).
|
85
123
|
|
@@ -134,6 +172,8 @@ class SdgGate(SingletonGate):
|
|
134
172
|
Equivalent to a :math:`-\pi/2` radian rotation about the Z axis.
|
135
173
|
"""
|
136
174
|
|
175
|
+
_standard_gate = StandardGate.SdgGate
|
176
|
+
|
137
177
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
138
178
|
"""Create new Sdg gate."""
|
139
179
|
super().__init__("sdg", 1, [], label=label, duration=duration, unit=unit)
|
@@ -157,6 +197,39 @@ class SdgGate(SingletonGate):
|
|
157
197
|
|
158
198
|
self.definition = qc
|
159
199
|
|
200
|
+
def control(
|
201
|
+
self,
|
202
|
+
num_ctrl_qubits: int = 1,
|
203
|
+
label: str | None = None,
|
204
|
+
ctrl_state: int | str | None = None,
|
205
|
+
annotated: bool | None = None,
|
206
|
+
):
|
207
|
+
"""Return a (multi-)controlled-Sdg gate.
|
208
|
+
|
209
|
+
One control qubit returns a :class:`.CSdgGate`.
|
210
|
+
|
211
|
+
Args:
|
212
|
+
num_ctrl_qubits: number of control qubits.
|
213
|
+
label: An optional label for the gate [Default: ``None``]
|
214
|
+
ctrl_state: control state expressed as integer,
|
215
|
+
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
216
|
+
annotated: indicates whether the controlled gate should be implemented
|
217
|
+
as an annotated gate. If ``None``, this is handled as ``False``.
|
218
|
+
|
219
|
+
Returns:
|
220
|
+
ControlledGate: controlled version of this gate.
|
221
|
+
"""
|
222
|
+
if not annotated and num_ctrl_qubits == 1:
|
223
|
+
gate = CSdgGate(label=label, ctrl_state=ctrl_state, _base_label=self.label)
|
224
|
+
else:
|
225
|
+
gate = super().control(
|
226
|
+
num_ctrl_qubits=num_ctrl_qubits,
|
227
|
+
label=label,
|
228
|
+
ctrl_state=ctrl_state,
|
229
|
+
annotated=annotated,
|
230
|
+
)
|
231
|
+
return gate
|
232
|
+
|
160
233
|
def inverse(self, annotated: bool = False):
|
161
234
|
"""Return inverse of Sdg (SGate).
|
162
235
|
|
@@ -210,6 +283,8 @@ class CSGate(SingletonControlledGate):
|
|
210
283
|
\end{pmatrix}
|
211
284
|
"""
|
212
285
|
|
286
|
+
_standard_gate = StandardGate.CSGate
|
287
|
+
|
213
288
|
def __init__(
|
214
289
|
self,
|
215
290
|
label: Optional[str] = None,
|
@@ -296,6 +371,8 @@ class CSdgGate(SingletonControlledGate):
|
|
296
371
|
\end{pmatrix}
|
297
372
|
"""
|
298
373
|
|
374
|
+
_standard_gate = StandardGate.CSdgGate
|
375
|
+
|
299
376
|
def __init__(
|
300
377
|
self,
|
301
378
|
label: Optional[str] = None,
|
@@ -12,11 +12,14 @@
|
|
12
12
|
|
13
13
|
"""Swap gate."""
|
14
14
|
|
15
|
+
from __future__ import annotations
|
16
|
+
|
15
17
|
from typing import Optional, Union
|
16
18
|
import numpy
|
17
19
|
from qiskit.circuit.singleton import SingletonGate, SingletonControlledGate, stdlib_singleton_key
|
18
20
|
from qiskit.circuit.quantumregister import QuantumRegister
|
19
21
|
from qiskit.circuit._utils import with_gate_array, with_controlled_gate_array
|
22
|
+
from qiskit._accelerate.circuit import StandardGate
|
20
23
|
|
21
24
|
|
22
25
|
_SWAP_ARRAY = numpy.array([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])
|
@@ -58,6 +61,8 @@ class SwapGate(SingletonGate):
|
|
58
61
|
|a, b\rangle \rightarrow |b, a\rangle
|
59
62
|
"""
|
60
63
|
|
64
|
+
_standard_gate = StandardGate.SwapGate
|
65
|
+
|
61
66
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
62
67
|
"""Create new SWAP gate."""
|
63
68
|
super().__init__("swap", 2, [], label=label, duration=duration, unit=unit)
|
@@ -87,9 +92,9 @@ class SwapGate(SingletonGate):
|
|
87
92
|
def control(
|
88
93
|
self,
|
89
94
|
num_ctrl_qubits: int = 1,
|
90
|
-
label:
|
91
|
-
ctrl_state:
|
92
|
-
annotated: bool =
|
95
|
+
label: str | None = None,
|
96
|
+
ctrl_state: str | int | None = None,
|
97
|
+
annotated: bool | None = None,
|
93
98
|
):
|
94
99
|
"""Return a (multi-)controlled-SWAP gate.
|
95
100
|
|
@@ -100,8 +105,8 @@ class SwapGate(SingletonGate):
|
|
100
105
|
label: An optional label for the gate [Default: ``None``]
|
101
106
|
ctrl_state: control state expressed as integer,
|
102
107
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
103
|
-
annotated: indicates whether the controlled gate
|
104
|
-
as an annotated gate.
|
108
|
+
annotated: indicates whether the controlled gate should be implemented
|
109
|
+
as an annotated gate. If ``None``, this is handled as ``False``.
|
105
110
|
|
106
111
|
Returns:
|
107
112
|
ControlledGate: controlled version of this gate.
|
@@ -213,6 +218,8 @@ class CSwapGate(SingletonControlledGate):
|
|
213
218
|
|1, b, c\rangle \rightarrow |1, c, b\rangle
|
214
219
|
"""
|
215
220
|
|
221
|
+
_standard_gate = StandardGate.CSwapGate
|
222
|
+
|
216
223
|
def __init__(
|
217
224
|
self,
|
218
225
|
label: Optional[str] = None,
|
@@ -12,11 +12,14 @@
|
|
12
12
|
|
13
13
|
"""Sqrt(X) and C-Sqrt(X) gates."""
|
14
14
|
|
15
|
+
from __future__ import annotations
|
16
|
+
|
15
17
|
from math import pi
|
16
18
|
from typing import Optional, Union
|
17
19
|
from qiskit.circuit.singleton import SingletonGate, SingletonControlledGate, stdlib_singleton_key
|
18
20
|
from qiskit.circuit.quantumregister import QuantumRegister
|
19
21
|
from qiskit.circuit._utils import with_gate_array, with_controlled_gate_array
|
22
|
+
from qiskit._accelerate.circuit import StandardGate
|
20
23
|
|
21
24
|
|
22
25
|
_SX_ARRAY = [[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]]
|
@@ -62,6 +65,8 @@ class SXGate(SingletonGate):
|
|
62
65
|
|
63
66
|
"""
|
64
67
|
|
68
|
+
_standard_gate = StandardGate.SXGate
|
69
|
+
|
65
70
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
66
71
|
"""Create new SX gate."""
|
67
72
|
super().__init__("sx", 1, [], label=label, duration=duration, unit=unit)
|
@@ -101,9 +106,9 @@ class SXGate(SingletonGate):
|
|
101
106
|
def control(
|
102
107
|
self,
|
103
108
|
num_ctrl_qubits: int = 1,
|
104
|
-
label:
|
105
|
-
ctrl_state:
|
106
|
-
annotated: bool =
|
109
|
+
label: str | None = None,
|
110
|
+
ctrl_state: str | int | None = None,
|
111
|
+
annotated: bool | None = None,
|
107
112
|
):
|
108
113
|
"""Return a (multi-)controlled-SX gate.
|
109
114
|
|
@@ -114,8 +119,8 @@ class SXGate(SingletonGate):
|
|
114
119
|
label: An optional label for the gate [Default: ``None``]
|
115
120
|
ctrl_state: control state expressed as integer,
|
116
121
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
117
|
-
annotated: indicates whether the controlled gate
|
118
|
-
as an annotated gate.
|
122
|
+
annotated: indicates whether the controlled gate should be implemented
|
123
|
+
as an annotated gate. If ``None``, this is handled as ``False``.
|
119
124
|
|
120
125
|
Returns:
|
121
126
|
SingletonControlledGate: controlled version of this gate.
|
@@ -164,6 +169,8 @@ class SXdgGate(SingletonGate):
|
|
164
169
|
= e^{-i \pi/4} \sqrt{X}^{\dagger}
|
165
170
|
"""
|
166
171
|
|
172
|
+
_standard_gate = StandardGate.SXdgGate
|
173
|
+
|
167
174
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
168
175
|
"""Create new SXdg gate."""
|
169
176
|
super().__init__("sxdg", 1, [], label=label, duration=duration, unit=unit)
|
@@ -261,6 +268,8 @@ class CSXGate(SingletonControlledGate):
|
|
261
268
|
|
262
269
|
"""
|
263
270
|
|
271
|
+
_standard_gate = StandardGate.CSXGate
|
272
|
+
|
264
273
|
def __init__(
|
265
274
|
self,
|
266
275
|
label: Optional[str] = None,
|
@@ -21,6 +21,7 @@ from qiskit.circuit.singleton import SingletonGate, stdlib_singleton_key
|
|
21
21
|
from qiskit.circuit.library.standard_gates.p import PhaseGate
|
22
22
|
from qiskit.circuit.quantumregister import QuantumRegister
|
23
23
|
from qiskit.circuit._utils import with_gate_array
|
24
|
+
from qiskit._accelerate.circuit import StandardGate
|
24
25
|
|
25
26
|
|
26
27
|
@with_gate_array([[1, 0], [0, (1 + 1j) / math.sqrt(2)]])
|
@@ -55,6 +56,8 @@ class TGate(SingletonGate):
|
|
55
56
|
Equivalent to a :math:`\pi/4` radian rotation about the Z axis.
|
56
57
|
"""
|
57
58
|
|
59
|
+
_standard_gate = StandardGate.TGate
|
60
|
+
|
58
61
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
59
62
|
"""Create new T gate."""
|
60
63
|
super().__init__("t", 1, [], label=label, duration=duration, unit=unit)
|
@@ -130,6 +133,8 @@ class TdgGate(SingletonGate):
|
|
130
133
|
Equivalent to a :math:`-\pi/4` radian rotation about the Z axis.
|
131
134
|
"""
|
132
135
|
|
136
|
+
_standard_gate = StandardGate.TdgGate
|
137
|
+
|
133
138
|
def __init__(self, label: Optional[str] = None, *, duration=None, unit="dt"):
|
134
139
|
"""Create new Tdg gate."""
|
135
140
|
super().__init__("tdg", 1, [], label=label, duration=duration, unit=unit)
|
@@ -11,6 +11,9 @@
|
|
11
11
|
# that they have been altered from the originals.
|
12
12
|
|
13
13
|
"""Two-pulse single-qubit gate."""
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
14
17
|
import cmath
|
15
18
|
import copy as _copy
|
16
19
|
import math
|
@@ -19,8 +22,9 @@ from typing import Optional, Union
|
|
19
22
|
import numpy
|
20
23
|
from qiskit.circuit.controlledgate import ControlledGate
|
21
24
|
from qiskit.circuit.gate import Gate
|
22
|
-
from qiskit.circuit.parameterexpression import ParameterValueType
|
25
|
+
from qiskit.circuit.parameterexpression import ParameterValueType, ParameterExpression
|
23
26
|
from qiskit.circuit.quantumregister import QuantumRegister
|
27
|
+
from qiskit._accelerate.circuit import StandardGate
|
24
28
|
|
25
29
|
|
26
30
|
class UGate(Gate):
|
@@ -68,6 +72,8 @@ class UGate(Gate):
|
|
68
72
|
U(\theta, 0, 0) = RY(\theta)
|
69
73
|
"""
|
70
74
|
|
75
|
+
_standard_gate = StandardGate.UGate
|
76
|
+
|
71
77
|
def __init__(
|
72
78
|
self,
|
73
79
|
theta: ParameterValueType,
|
@@ -100,9 +106,9 @@ class UGate(Gate):
|
|
100
106
|
def control(
|
101
107
|
self,
|
102
108
|
num_ctrl_qubits: int = 1,
|
103
|
-
label:
|
104
|
-
ctrl_state:
|
105
|
-
annotated: bool =
|
109
|
+
label: str | None = None,
|
110
|
+
ctrl_state: str | int | None = None,
|
111
|
+
annotated: bool | None = None,
|
106
112
|
):
|
107
113
|
"""Return a (multi-)controlled-U gate.
|
108
114
|
|
@@ -111,8 +117,10 @@ class UGate(Gate):
|
|
111
117
|
label: An optional label for the gate [Default: ``None``]
|
112
118
|
ctrl_state: control state expressed as integer,
|
113
119
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
114
|
-
annotated: indicates whether the controlled gate
|
115
|
-
as an annotated gate.
|
120
|
+
annotated: indicates whether the controlled gate should be implemented
|
121
|
+
as an annotated gate. If ``None``, this is set to ``True`` if
|
122
|
+
the gate contains free parameters and more than one control qubit, in which
|
123
|
+
case it cannot yet be synthesized. Otherwise it is set to ``False``.
|
116
124
|
|
117
125
|
Returns:
|
118
126
|
ControlledGate: controlled version of this gate.
|
@@ -128,6 +136,11 @@ class UGate(Gate):
|
|
128
136
|
)
|
129
137
|
gate.base_gate.label = self.label
|
130
138
|
else:
|
139
|
+
# If the gate parameters contain free parameters, we cannot eagerly synthesize
|
140
|
+
# the controlled gate decomposition. In this case, we annotate the gate per default.
|
141
|
+
if annotated is None:
|
142
|
+
annotated = any(isinstance(p, ParameterExpression) for p in self.params)
|
143
|
+
|
131
144
|
gate = super().control(
|
132
145
|
num_ctrl_qubits=num_ctrl_qubits,
|
133
146
|
label=label,
|
@@ -180,7 +193,7 @@ class _CUGateParams(list):
|
|
180
193
|
# Magic numbers: CUGate has 4 parameters, UGate has 3, with the last of CUGate's missing.
|
181
194
|
if isinstance(key, slice):
|
182
195
|
# We don't need to worry about the case of the slice being used to insert extra / remove
|
183
|
-
# elements because that would be "undefined
|
196
|
+
# elements because that would be "undefined behavior" in a gate already, so we're
|
184
197
|
# within our rights to do anything at all.
|
185
198
|
for i, base_key in enumerate(range(*key.indices(4))):
|
186
199
|
if base_key < 0:
|
@@ -259,6 +272,8 @@ class CUGate(ControlledGate):
|
|
259
272
|
\end{pmatrix}
|
260
273
|
"""
|
261
274
|
|
275
|
+
_standard_gate = StandardGate.CUGate
|
276
|
+
|
262
277
|
def __init__(
|
263
278
|
self,
|
264
279
|
theta: ParameterValueType,
|
@@ -19,6 +19,7 @@ from qiskit.circuit.gate import Gate
|
|
19
19
|
from qiskit.circuit.parameterexpression import ParameterValueType
|
20
20
|
from qiskit.circuit.quantumregister import QuantumRegister
|
21
21
|
from qiskit.circuit._utils import _ctrl_state_to_int
|
22
|
+
from qiskit._accelerate.circuit import StandardGate
|
22
23
|
|
23
24
|
|
24
25
|
class U1Gate(Gate):
|
@@ -92,6 +93,8 @@ class U1Gate(Gate):
|
|
92
93
|
`1612.00858 <https://arxiv.org/abs/1612.00858>`_
|
93
94
|
"""
|
94
95
|
|
96
|
+
_standard_gate = StandardGate.U1Gate
|
97
|
+
|
95
98
|
def __init__(
|
96
99
|
self, theta: ParameterValueType, label: str | None = None, *, duration=None, unit="dt"
|
97
100
|
):
|
@@ -125,7 +128,7 @@ class U1Gate(Gate):
|
|
125
128
|
label: An optional label for the gate [Default: ``None``]
|
126
129
|
ctrl_state: control state expressed as integer,
|
127
130
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
128
|
-
annotated: indicates whether the controlled gate
|
131
|
+
annotated: indicates whether the controlled gate should be implemented
|
129
132
|
as an annotated gate.
|
130
133
|
|
131
134
|
Returns:
|
@@ -205,6 +208,8 @@ class CU1Gate(ControlledGate):
|
|
205
208
|
phase difference.
|
206
209
|
"""
|
207
210
|
|
211
|
+
_standard_gate = StandardGate.CU1Gate
|
212
|
+
|
208
213
|
def __init__(
|
209
214
|
self,
|
210
215
|
theta: ParameterValueType,
|
@@ -273,7 +278,7 @@ class CU1Gate(ControlledGate):
|
|
273
278
|
label: An optional label for the gate [Default: ``None``]
|
274
279
|
ctrl_state: control state expressed as integer,
|
275
280
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
276
|
-
annotated: indicates whether the controlled gate
|
281
|
+
annotated: indicates whether the controlled gate should be implemented
|
277
282
|
as an annotated gate.
|
278
283
|
|
279
284
|
Returns:
|
@@ -405,7 +410,7 @@ class MCU1Gate(ControlledGate):
|
|
405
410
|
label: An optional label for the gate [Default: ``None``]
|
406
411
|
ctrl_state: control state expressed as integer,
|
407
412
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
408
|
-
annotated: indicates whether the controlled gate
|
413
|
+
annotated: indicates whether the controlled gate should be implemented
|
409
414
|
as an annotated gate.
|
410
415
|
|
411
416
|
Returns:
|
@@ -18,6 +18,7 @@ import numpy
|
|
18
18
|
from qiskit.circuit.gate import Gate
|
19
19
|
from qiskit.circuit.parameterexpression import ParameterValueType
|
20
20
|
from qiskit.circuit.quantumregister import QuantumRegister
|
21
|
+
from qiskit._accelerate.circuit import StandardGate
|
21
22
|
|
22
23
|
|
23
24
|
class U2Gate(Gate):
|
@@ -86,6 +87,8 @@ class U2Gate(Gate):
|
|
86
87
|
using two X90 pulses.
|
87
88
|
"""
|
88
89
|
|
90
|
+
_standard_gate = StandardGate.U2Gate
|
91
|
+
|
89
92
|
def __init__(
|
90
93
|
self,
|
91
94
|
phi: ParameterValueType,
|
@@ -11,14 +11,18 @@
|
|
11
11
|
# that they have been altered from the originals.
|
12
12
|
|
13
13
|
"""Two-pulse single-qubit gate."""
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
14
17
|
import math
|
15
18
|
from cmath import exp
|
16
19
|
from typing import Optional, Union
|
17
20
|
import numpy
|
18
21
|
from qiskit.circuit.controlledgate import ControlledGate
|
19
22
|
from qiskit.circuit.gate import Gate
|
20
|
-
from qiskit.circuit.parameterexpression import ParameterValueType
|
23
|
+
from qiskit.circuit.parameterexpression import ParameterValueType, ParameterExpression
|
21
24
|
from qiskit.circuit.quantumregister import QuantumRegister
|
25
|
+
from qiskit._accelerate.circuit import StandardGate
|
22
26
|
|
23
27
|
|
24
28
|
class U3Gate(Gate):
|
@@ -80,6 +84,8 @@ class U3Gate(Gate):
|
|
80
84
|
U3(\theta, 0, 0) = RY(\theta)
|
81
85
|
"""
|
82
86
|
|
87
|
+
_standard_gate = StandardGate.U3Gate
|
88
|
+
|
83
89
|
def __init__(
|
84
90
|
self,
|
85
91
|
theta: ParameterValueType,
|
@@ -112,9 +118,9 @@ class U3Gate(Gate):
|
|
112
118
|
def control(
|
113
119
|
self,
|
114
120
|
num_ctrl_qubits: int = 1,
|
115
|
-
label:
|
116
|
-
ctrl_state:
|
117
|
-
annotated: bool =
|
121
|
+
label: str | None = None,
|
122
|
+
ctrl_state: str | int | None = None,
|
123
|
+
annotated: bool | None = None,
|
118
124
|
):
|
119
125
|
"""Return a (multi-)controlled-U3 gate.
|
120
126
|
|
@@ -123,8 +129,10 @@ class U3Gate(Gate):
|
|
123
129
|
label: An optional label for the gate [Default: ``None``]
|
124
130
|
ctrl_state: control state expressed as integer,
|
125
131
|
string (e.g.``'110'``), or ``None``. If ``None``, use all 1s.
|
126
|
-
annotated: indicates whether the controlled gate
|
127
|
-
as an annotated gate.
|
132
|
+
annotated: indicates whether the controlled gate should be implemented
|
133
|
+
as an annotated gate. If ``None``, this is set to ``True`` if
|
134
|
+
the gate contains free parameters and more than one control qubit, in which
|
135
|
+
case it cannot yet be synthesized. Otherwise it is set to ``False``.
|
128
136
|
|
129
137
|
Returns:
|
130
138
|
ControlledGate: controlled version of this gate.
|
@@ -133,6 +141,11 @@ class U3Gate(Gate):
|
|
133
141
|
gate = CU3Gate(*self.params, label=label, ctrl_state=ctrl_state)
|
134
142
|
gate.base_gate.label = self.label
|
135
143
|
else:
|
144
|
+
# If the gate parameters contain free parameters, we cannot eagerly synthesize
|
145
|
+
# the controlled gate decomposition. In this case, we annotate the gate per default.
|
146
|
+
if annotated is None:
|
147
|
+
annotated = any(isinstance(p, ParameterExpression) for p in self.params)
|
148
|
+
|
136
149
|
gate = super().control(
|
137
150
|
num_ctrl_qubits=num_ctrl_qubits,
|
138
151
|
label=label,
|
@@ -227,6 +240,8 @@ class CU3Gate(ControlledGate):
|
|
227
240
|
\end{pmatrix}
|
228
241
|
"""
|
229
242
|
|
243
|
+
_standard_gate = StandardGate.CU3Gate
|
244
|
+
|
230
245
|
def __init__(
|
231
246
|
self,
|
232
247
|
theta: ParameterValueType,
|
@@ -344,7 +359,7 @@ def _generate_gray_code(num_bits):
|
|
344
359
|
result = [0]
|
345
360
|
for i in range(num_bits):
|
346
361
|
result += [x + 2**i for x in reversed(result)]
|
347
|
-
return [format(x, "0
|
362
|
+
return [format(x, f"0{num_bits}b") for x in result]
|
348
363
|
|
349
364
|
|
350
365
|
def _gray_code_chain(q, num_ctrl_qubits, gate):
|