Closed boschmitt closed 3 years ago
Well spotted. I took a look at this and I think the right thing is to add the atol
for the zxz case as you suggest. Refactoring this as you describe makes sense to me, but I think @ajavadia might have some opinions about this kind of thing.
Yes I agree. There's a good amount of duplication here and refactoring makes sense to me.
If we could have a generic Euler fn that would also support XZX etc then @ewinston would be able to use it in #6581
@boschmitt is there anything left here now that #6553 has merged?
@boschmitt is there anything left here now that #6553 has merged?
I only had time to briefly look over the changes, but looks like there is nothing left. Since it appears that was not a big problem to begin with, only a warning flag, I will simply close the issue.
While looking at the code for one qubit decomposition I found a small difference between ZXZ decomposition and the other ones ('ZYZ, XYX'):
https://github.com/Qiskit/qiskit-terra/blob/62383eb90e1d3fc9790ceef9789e8f842e671a1e/qiskit/quantum_info/synthesis/one_qubit_decompose.py#L320
The following diff show the difference between
_circuit_zyz
and_circuit_zxz
. Apart from the expectedRYGate
andRXGate
, we also see the function_mod_2pi
is called withoutatol
, which might be a bug.If this is indeed a bug, then we could refactor the code of the three functions:
_circuit_zxz
,_circuit_zyz
and_circuit_xyx
. We could merge these three functions into one that receive the appropriate gates as parameters. (Like:_circuit_psx_gen
)