-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Environment
- Qiskit version: 1.3.0
- Python version: 3.12.3
- Operating system: Xubuntu 24.10
What is happening?
In qiskit-1.3.0
, the assign_parameters
method does not assign parameters to the global phase of a quantum circuit.
How can we reproduce the issue?
Example Code:
import numpy as np
from qiskit.circuit.library import EfficientSU2
qc = EfficientSU2(num_qubits=2, su2_gates=['ry', 'rz'], entanglement='linear', reps=1)
parameters = np.random.random(8)
transpiled_qc = qc.decompose(reps=4)
bound_qc = transpiled_qc.assign_parameters(parameters)
print(qc, transpiled_qc, bound_qc, sep = '\n\n\n')
What should happen?
In qiskit-1.3.0
, the above code produces a quantum circuit with assigned parameters and a SYMBOLIC global phase.
global phase: -θ[2]/2 - θ[3]/2 - θ[6]/2 - θ[7]/2
┌────────────────┐┌────────────────┐ ┌────────────────┐┌────────────────┐
q_0: ┤ U(0.59811,0,0) ├┤ U(0,0,0.21656) ├──■──┤ U(0.62355,0,0) ├┤ U(0,0,0.62789) ├
├────────────────┤├────────────────┤┌─┴─┐├────────────────┤├────────────────┤
q_1: ┤ U(0.46992,0,0) ├┤ U(0,0,0.45032) ├┤ X ├┤ U(0.45307,0,0) ├┤ U(0,0,0.44882) ├
└────────────────┘└────────────────┘└───┘└────────────────┘└────────────────┘
In qiskit-1.2.0
, the above code produces a quantum circuit with assigned parameters and a NUMERICAL global phase.
global phase: 5.7155
┌────────────────┐ ┌────────────────┐ ┌────────────────┐ ┌────────────────┐
q_0: ┤ U(0.99453,0,0) ├─┤ U(0,0,0.12111) ├──■──┤ U(0.15492,0,0) ├─┤ U(0,0,0.84968) ├
├────────────────┤┌┴────────────────┤┌─┴─┐├────────────────┤┌┴────────────────┤
q_1: ┤ U(0.95689,0,0) ├┤ U(0,0,0.075532) ├┤ X ├┤ U(0.55437,0,0) ├┤ U(0,0,0.089015) ├
└────────────────┘└─────────────────┘└───┘└────────────────┘└─────────────────┘
Any suggestions?
The symbolic global phase should be evaluated and replaced with a numerical value within the assign_parameters
method.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working