Skip to content
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

Possibility for infinite loop in maxvol2 #43

Open
emprice opened this issue Mar 11, 2019 · 1 comment
Open

Possibility for infinite loop in maxvol2 #43

emprice opened this issue Mar 11, 2019 · 1 comment

Comments

@emprice
Copy link

emprice commented Mar 11, 2019

Thanks so much for writing this code! I am working on a possible application for my research but need C++ and so have been translating pieces of your code (with proper attribution, of course).

I ran across something odd at this line of maxvol2 It looks like there is an iteration variable and a while loop, but the iteration variable never gets incremented. For the simple tests I've tried, it looks like the loop is always broken anyway, but I can't tell if that was the purpose. If it is intentional, a comment explaining why would be helpful. If not, I think a simple iter = iter + 1 would avoid a possible infinite loop.

@dolgov
Copy link
Collaborator

dolgov commented Mar 11, 2019

In very deed! The number of iterations should be incremented of course.
Thanks for spotting a long-standing bug.

You are right though that in all practical tests the algorithm terminates in a finite number of iterations, that's why we didn't spot this bug before.
So, before committing an update, let me check that 100 iterations are never actually reached (at least in my applications), as otherwise the behaviour of cross algorithms might change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants