Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
4.82k stars 2.29k forks source link

Transpiler optimization_method="zxpass" gives wrong result #12531

Open BankNatchapol opened 3 weeks ago

BankNatchapol commented 3 weeks ago

Environment

What is happening?

Circuits after Transpilation should give similar result, but not.

How can we reproduce the issue?

from qiskit.quantum_info import Statevector
from qiskit.compiler import transpile

with open('acircuit.qpy', 'rb') as handle:
    qc = qpy.load(handle)
wo = transpile(qc, basis_gates=['cz', 'swap', 'cx', 'tdg', 's', 'sdg', 'h', 'rz'], optimization_level=1)[0]
w = transpile(wo, basis_gates=['cz', 'swap', 'cx', 'tdg', 's', 'sdg', 'h', 'rz'], optimization_method="zxpass")

print(Statevector(wo))
print(Statevector(w))

ill attach acircuit.qpy acircuit.zip

What should happen?

the statevector should be the same.

Any suggestions?

If it's correct, please guide me how to make the statevector output to be the same. Thank you in advance.

jakelishman commented 2 weeks ago

We don't define an optimization_method called zxpass; you must be pulling that in from some external plugin.