You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from qiskit.circuit import QuantumCircuit, ParameterVector
from qiskit.circuit.library import PauliEvolutionGate
from qiskit.quantum_info import SparsePauliOp
from qiskit.qasm3 import dumps, loads, dump, load
t = ParameterVector("t", 3)
X, Y, Z = SparsePauliOp("X"), SparsePauliOp("Y"), SparsePauliOp("Z")
op1, op2, op3 = (X^X), (Y^Y), (Z^Z)
evo1 = PauliEvolutionGate(op1, time=t[0])
evo2 = PauliEvolutionGate(op2, time=t[1])
evo3 = PauliEvolutionGate(op3, time=t[2])
dec0 = QuantumCircuit(2)
dec0.append(evo1, range(2))
dec0.append(evo2, range(2))
dec0.append(evo3, range(2))
dec0.count_ops() #returns OrderedDict([('PauliEvolution', 3)])
after dumping into a qasm3, we would expect the qasm to have 3 different gates for the XX, YY, ZZ but it only looks into the first Pauli evolution gate and repeats it 3 times :
It looks like the same problem as in #7335 but the workaround doesn't work for this specific example. It might be because the op doesn't appear in the name or in the parameters and fall through the cracks of the fix.
Thanks for the report. It looks like the OpenQASM 3 exporter still maintains a lot of the same problems that the OpenQASM 2 exporter used to have until we fixed a whole load of them in #9953 - this kind of duplicate definition / bad definition reuse / whatever used to be rife in the old one as well. I'm not sure of a timespan for when we'll get this entirely fixed, but I think such a fix will tie into the implementation of #10737, since to handle exporting against multiple possible library files, we'll need to rethink how we do the definition decomposition quite heavily.
When trying to turn this circuit into a qasm3 :
after dumping into a qasm3, we would expect the qasm to have 3 different gates for the XX, YY, ZZ but it only looks into the first Pauli evolution gate and repeats it 3 times :
The text was updated successfully, but these errors were encountered: