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

SVD loops forever in certain cases #5

Closed
translunar opened this issue Mar 15, 2017 · 6 comments
Closed

SVD loops forever in certain cases #5

translunar opened this issue Mar 15, 2017 · 6 comments
Labels

Comments

@translunar
Copy link

I'm not sure how to fix it, but your SVD algorithm isn't incrementing k0 in some cases — it then enters an infinite loop.

First found it here: http://stackoverflow.com/questions/3856072/single-value-decomposition-implementation-c/25291714#25291714

@dmalhotra
Copy link
Owner

Thanks for reporting this issue. Can you provide a test case that I can use to debug?

@translunar
Copy link
Author

Yes, I think so. Upon further examination, looks like it's happening with rank deficient matrices. Try this one:

{{267.21359999999999, -267.21359999999999, -230.9624}, {-4383.1704, 4383.1704, -4383.1704}, {0, 0, 0}}

@translunar
Copy link
Author

translunar commented Mar 15, 2017

I also notice you have some divisions by 2 instead of 2.0, which will cause truncation (separate issue).

@dmalhotra
Copy link
Owner

I don't believe dividing a float or double by an integer will cause truncation.

@dmalhotra
Copy link
Owner

3075929 fixes this issue.

@translunar
Copy link
Author

@dmalhotra Huh, wow. You're totally right! I've been believing something that was totally wrong for the greater part of fifteen years.

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

No branches or pull requests

2 participants