Investigate Possible Numerical Instability in 2q and 3q analytical decompositions
After adding two_qubit_matrix_to_cz_operations and three_qubit_matrix_to_operations as base cases for quantum_shannon_decomposition, some tests started to become flaky #6765. The tests pass with new versions of numpy and fail with older versions. For now I marked those tests with xfail until we are in state where we run tests with only newer numpy versions. however there might be some numerical instabilities in those methods that we may be able to fix.
Hi, I would like to take this up.
@RahilJain1366 thanks for offering to help. I assigned the task to you
Thank you @NoureldinYosri for assigning it me. I wanted to confirm my understanding. I need to replicate the two_qubit_matrix_to_cz_operations and three_qubit_matrix_to_operations on quantum_shannon_decomposition in an older version of numpy? Am I right?
this is a start ... see if you can use an old version of numpy to make the tests marked in #6767 fail ... then if you can propose a fix
@NoureldinYosri Could you please assign me to this issue as well?
@RahilJain1366 For planning purposes, could you let us know the status of this? Are you still working on this?
Hi @mhucka
I remember seeing that the fix was provided for the issue as it was completed with [#7390 (https://github.com/quantumlib/Cirq/pull/7390). If not, I will try it out.
@RahilJain1366 I think you're right. I just tested it in Python 3.11.9 on Linux by
- commenting out the xfail annotations in
cirq-core/cirq/transformers/analytical_decompositions/quantum_shannon_decomposition_test.py - installing NumPy 1.26 instead of 2.x
- running
check/pytest
and it passed.
@NoureldinYosri is it time to remove those two xfail annotations in that file? Or are there additional tests to do (perhaps more specifically about numerical stability)?
@NoureldinYosri Very gentle ping …