feat: bound the number of sweeps the SVD spends on one singular value - #220
Closed
tayal-sarthak wants to merge 5 commits into
Closed
feat: bound the number of sweeps the SVD spends on one singular value#220tayal-sarthak wants to merge 5 commits into
tayal-sarthak wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
==========================================
+ Coverage 68.88% 68.94% +0.06%
==========================================
Files 49 49
Lines 5904 5916 +12
Branches 1060 1064 +4
==========================================
+ Hits 4067 4079 +12
Misses 1824 1824
Partials 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #70.
Summary
The issue reports a dataset that hangs, with the observation that
pnever drops below 93. Thatpis the counter driving the sweep in the singular value decomposition:iteris raised on every sweep along with being reset once a singular value settles, yet nothing ever reads it. There is no ceiling anywhere in the loop, so an input the sweep cannot settle keeps it going with no way out. The caller gets no error, no result, and no thread back.LAPACK bounds the same loop,
dbdsqrallowing 6 sweeps per singular value before it reports failure.The ceiling
A
maxIterationsoption, 100 by default, caps how many sweeps any one singular value gets. Passing it means the sweep is stuck, which is reported:Choosing the default
Measuring how many sweeps a decomposition that converges takes per singular value, across random matrices:
Four sweeps covers every case measured, and the figure does not grow with the size of the input, since the count is spent per singular value rather than over the whole run. A default of 100 therefore sits at roughly 25 times what a decomposition needs, wide enough that a converging input cannot reach it, while a stuck one stops in bounded time instead of running on.
Compatibility
Every decomposition that converges today behaves exactly as before. The only inputs affected are the ones that never finish.