Skip to content

TST: test_eigs_consistency() now sorts output #9456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tylerjereddy
Copy link
Contributor

Fixes #9453

@lobpcg confirmed the mathematical equivalence of the differently sorted values (and complex or not), but the assertion does not pass in the stochastic cases where the sorting doesn't match between actual and expected values.

So, sorting is now enforced even though the mathematically correct result was already produced, to alleviate the unit test failure.

To confirm locally, due to the difficulty with reproduction, I initially looped the test 500 times, and this made it much easier to detect and confirm a likely fix.

* test_eigs_consistency() was prone to failure
because of the production of mathematically
equivalent results in unsorted order; the order
is now enforced to alleviate these stochastic
unit test failures
@tylerjereddy tylerjereddy added scipy.sparse.linalg CI Items related to the CI tools such as CircleCI, GitHub Actions or Azure labels Nov 8, 2018
@tylerjereddy
Copy link
Contributor Author

Now, whether it is a problem for end-users or other libraries that a result can be mathematically equivalent but produced in a different sort order in an array is not something that's immediately clear to me here.

I suppose one could make the argument that the sort should happen in the code proper instead of the test -- maybe thoughts on that would be useful if it is something I should worry about.

@rgommers rgommers added maintenance Items related to regular maintenance tasks and removed CI Items related to the CI tools such as CircleCI, GitHub Actions or Azure labels Nov 8, 2018
@rgommers
Copy link
Member

rgommers commented Nov 8, 2018

Hmm, it seems the seed I added fixed it for me, but now makes it consistently fail on TravisCI on all build matrix entries (at least in the last completed CI run). This fix looks good. Let's merge as soon as things turn green. Thanks @tylerjereddy

@rgommers rgommers added this to the 1.2.0 milestone Nov 8, 2018
@rgommers rgommers merged commit 5b24d5c into scipy:master Nov 8, 2018
@rgommers
Copy link
Member

rgommers commented Nov 8, 2018

All green, merged. Thanks Tyler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.sparse.linalg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: test_eigs_consistency() doesn't have consistent results
2 participants