-
Notifications
You must be signed in to change notification settings - Fork 15
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
Switch to irlba to avoid Spectra dependencies. #4
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
==========================================
+ Coverage 95.75% 95.96% +0.20%
==========================================
Files 9 9
Lines 448 446 -2
==========================================
- Hits 429 428 -1
+ Misses 19 18 -1
Continue to review full report at Codecov.
|
@LTLA was the motivation for this PR to remove Spectra as a dependency because of the weirdness reported at yixuan/spectra#126? I am also toying with removing RSpectra as a dependency mainly because it causes PREPERRORs with rhub when using UBSAN/ASAN sanitizers and with valgrind (a pretty important safety net for me). The irlba approach seems good enough, although it is noticeably slower for some artificial cases like a 1D line embedded in 3D. As an aside, the maximum eigenvalue that can be attained for the normalized laplacian is 2, so I think you could pre-shift your matrix without having to extract the largest eigenvalue first (the approach I used to test irlba is outlined here and almost the same as what you are currently doing). |
That was the primary motivation. I also have some fairly stringent requirements re. compilation times and binary sizes for a non-R project I'm working on, so I've been trying to trim dependencies in all libraries involved - and I already was using irlba elsewhere so I figured I could just save myself a dependency and re-use it here.
That would be neat. Is this an obvious/well-known result? I managed to convince myself that the normalized laplacian is PSD and that its smallest eigenvalue is zero, but I didn't get around to thinking through this property. Edit: I have convinced myself. Needed to look it up but eventually worked it out. |
Great. For reference, I have seen this asserted in several places, but the canonical place including a proof seems to be Spectral Graph Theory. Part 5 of Lemma 1.7 in Section 1.3, 'Basic facts about the spectrum of a graph'. |
Just did the change for the max eigenvalue - seems to check out, I'll see how it goes with some of my downstream apps. |
This uses the diagonal shift trick to convert the problem of "finding the smallest eigenvalues" into the largest ones.