-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- Qiskit version: 2.2.3
- Python version: 3.13.2
- Operating system: macOS
This discrepancy is there for all versions of qiskit >= 2.2.
What is happening?
Quantum Circuits to which PauliEvolutionGate appended is giving inconsistent results with respect to different qiskit version
How can we reproduce the issue?
While running the following code, qiskit 2.1.2 and qiskit 2.2.3 gives different results.
from qiskit.circuit import QuantumCircuit
from qiskit.circuit.library import PauliEvolutionGate
from qiskit.quantum_info import SparsePauliOp
from qiskit.primitives import StatevectorEstimator
X = SparsePauliOp("X")
Z = SparsePauliOp("Z")
I = SparsePauliOp("I")
operator = (Z ^ Z) - 0.1 * (X ^ I)
tlist = range(0,5)
circuits = []
for t in tlist:
evo = PauliEvolutionGate(operator, time=t)
circ = QuantumCircuit(2)
circ.append(evo, range(2))
circuits.append(circ)
estimator= StatevectorEstimator(seed=10)
pub = [(circ, operator) for circ in circuits]
job = estimator.run(pubs = pub)
res = job.result()
evs = [job.result()[i].data.evs for i in range(len(res))]
The issue could be observerd for all versions of qiskit >= 2.2
What should happen?
Ideally, I would expect both results to be consistent results across different versions.
Any suggestions?
I am able to get consistent results, if I am using decomposed version of the circuit rather than circuit with PauliEvolutionGate.
estimator= StatevectorEstimator(seed=10)
pub = [(circ.decompose(reps=1), operator) for circ in circuits] #<-- changed here
job = estimator.run(pubs = pub)
res = job.result()
evs = [job.result()[i].data.evs for i in range(len(res))]Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working