You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My lab spends a lot of time taking SVDs of, let's say, "nearly nice" matrices. For these matrices, we can often compute t(A) %*% x and A %*% x in a reasonable amount of time if we give A a custom class and then implement the multiplication in C++ via RcppEigen. In our cases, A is often sparse, and this introduces a problem. While we can implement matrix multiplication in C++ and make it fast, using sparse matrices incurs a copying cost. This makes irlba slow for us: either we implement matrix multiplication in R, which is slow in our case, or we do it in C++, and pay many copying costs for each SVD. We have to take the SVD many times since we're doing matrix completion work, and anyway this all adds up.
Ideally, irlba would expose a C++ level interface, so that we could copy A just once for each SVD, or even better, just once for the whole matrix completion algorithm if we implemented it in C++. For example, spectra does this for eigendecompositions, and make custom eigendecompositions very nice via the "custom op" interface at the C++ level. However, it doesn't seem like irlba offers the same functionality, even though it seems like irlba may be more appropriate for SVDs (yixuan/spectra#11).
I know this is a large ask, but would you consider (possibly in the long term) refactoring the C/C++ code to a structure more like spectra so that we can take advantage of irlba's SVD implementation?
The text was updated successfully, but these errors were encountered:
FWIW there is a pure C++ implementation at https://github.com/LTLA/CppIrlba, derived from the code here. I have used it to implement custom multiplications at the C++ level, see e.g. here and here.
Hey there!
My lab spends a lot of time taking SVDs of, let's say, "nearly nice" matrices. For these matrices, we can often compute
t(A) %*% x
andA %*% x
in a reasonable amount of time if we giveA
a custom class and then implement the multiplication inC++
viaRcppEigen
. In our cases,A
is often sparse, and this introduces a problem. While we can implement matrix multiplication inC++
and make it fast, using sparse matrices incurs a copying cost. This makesirlba
slow for us: either we implement matrix multiplication in R, which is slow in our case, or we do it in C++, and pay many copying costs for each SVD. We have to take the SVD many times since we're doing matrix completion work, and anyway this all adds up.Ideally,
irlba
would expose a C++ level interface, so that we could copyA
just once for each SVD, or even better, just once for the whole matrix completion algorithm if we implemented it in C++. For example,spectra
does this for eigendecompositions, and make custom eigendecompositions very nice via the "custom op" interface at the C++ level. However, it doesn't seem likeirlba
offers the same functionality, even though it seems likeirlba
may be more appropriate for SVDs (yixuan/spectra#11).I know this is a large ask, but would you consider (possibly in the long term) refactoring the C/C++ code to a structure more like
spectra
so that we can take advantage ofirlba
's SVD implementation?The text was updated successfully, but these errors were encountered: