numpy 1.24 breaks some tests
Closed this issue · 0 comments
DanPuzzuoli commented
The tests:
dynamics.models.test_generator_model.Testtransfer_operator_functionsJax.test_array_inputs_pseudo_random
and
dynamics.solvers.test_lanczos.TestLanczos.test_ground_state
now fail on main
.
Both appear to be due to the tests depending on the sign of eigenvectors computed by numpy.linalg.eigh
.
- The second failure is simple: the first eigenvector, as computed by two separate routines, are checked to be equal. The sign of this as computed by
numpy.linalg.eigh
has now flipped, raising an error. This can easily be fixed by multiplying both by the sign of the first element (which has to be real) before comparing. - The first one is ultimately an error coming from the same place, but it's hidden a bit deeper in the function calls in the test case, and is arising due to new sign inconsistencies between the output of
numpy.linalg.eigh
andjax.numpy.linalg.eigh
. (Both of course output mathematically correct values, but again, some of the eigenvectors output bynumpy
now have a flipped sign.) I think this can be fixed by more explicitly controlling theRotatingFrame
objects being constructed in this test, so that the explicit diagonalizing basis details don't impact the checks in the test.