-
Notifications
You must be signed in to change notification settings - Fork 5
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
check all S are 0 with tolerance #7
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 38d7671.
Ah, this actually isn't doing anything different from what the code was originally doing with the |
My understanding is that the floating point precision issues are causing the graph G to eventually not have a maximal matching that contains all nodes (in my specific case G is not even connected). For my application I break in the loop when the maximum matching is not perfect. I've shared my changes here. From what I've read, it's typical to either terminate once the coefficients sum to close to 1, or after a fixed number of iterations, or using a larger tolerance on determining whether One thing that confused me: why aren't the coefficients returned in non-increasing order? My understanding was that this algorithm determined the corresponding permutations and coefficients sorted by magnitude. |
If you have any reference material that you can share, that would be helpful.
Just so I understand, you are saying that we can terminate the loop when
Although you are proposing the last one, it seems rather fragile to me. The maximum matching is an "implementation detail" of the algorithm, something that happens in the middle of each iteration. It would make more sense to me to have a termination condition that can be applied at the beginning (or end) of each iteration of the loop---a condition on the matrix or the coefficients, for example. Perhaps we need to make the tolerance of the "isclose()` check configurable?
You can sort them in the calling code using If you are able, it would be helpful to add a unit test that fails before your proposed change and passes after your proposed change. The matrix in the reference issue may be of use in finding a minimal working example. |
My issue with the other methods used for stopping is that they all require the user to play around with tolerance values etc--how is the consumer of the API supposed to know now many iterations to run for, or the tolerance they need is? In the case of breaking when no perfect matching is possible, we know that the algorithm has run for the largest number of iterations that it can. Check out: https://hal.inria.fr/hal-01270331v2/document (Notes on Birkhoff-von Neumann decomposition of doubly stochastic matrices). Specifically Lemma 3 which states that the coefficients are obtained in non-increasing order. I'll look into creating a unit test. |
Addresses #2
Turns out the comparison at the beginning of the loop was being too strict. Floating pt err causes the loop to not terminate when it should.
Thanks for the package by the way!