oseledets/TT-Toolbox

Possibility for infinite loop in maxvol2

Opened this issue · 1 comments

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.

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.