-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Implement a method to calculate only largest eigenvalues #112
Comments
Hi, I am not related to the faer crate but I am curious. Was your 4096x4096 matrix dense in your example? May I suggest taking a look at power iteration and subspace iteration if you want the dominant or the few largest eigenpairs? Otherwise, I think for general dense matrices it is typically not faster to extract less than all of the eigenpairs. I am curious about what would be the faer approach though. |
I've recently been studying iterative solvers so this is on my to-do list for the near future |
Spectra does have methods for dense matrices as well (https://spectralib.org/doc/classspectra_1_1geneigssolver), which I have been using in my example benchmarks (the 4096x4096 matrices have all been dense).
Awesome! Btw, if such a method would also calculate the eigenvectors, that would be even more awesome :) |
Hey there, it's me again. Did you have time yet to look into this? |
@StHagel |
I recently saw commit bb213d1. I think that means it is being worked on. |
Is your feature request related to a problem? Please describe.
faer
is very fast at computing all eigenvalues of a matrix, but oftentimes you only need a few eigenvalues (e.g. the largest/smallest ones). In fact, when I benchmark it against thespectra
C++ library (which is based oneigen3
),faer
outperforms it by a lot when calculating all or almost all eigenvalues of a 4096x4096 matrix (~23s forfaer
, ~650s forspectra
), but when only calculating the largest eigenvalue,spectra
outperformsfaer
by a lot (again 23s forfaer
, ~0.22s forspectra
).Describe the solution you'd like
It would be great, if
faer
would incorporate a pure-rust implementation of an eigenvalue finding algorithm, that is able to calculate only a specified number of the largest/smallest eigenvalues. Typically, other libraries (spectra
,arpack
,slepc
, ...) use methods based on Krylov subspaces, such as Arnoldi iteration, for these tasks. Maybe something along those lines would be a feasible and worthwhile extension to faer?Describe alternatives you've considered
Thus far, I have not found any pure-rust crates to efficiently calculate eigenvalue problems with dense, non-hermitian matrices, where only a few eigenvalues need to be calculated. The ones that come closest are
arpack-ng
, which is essentially a wrapper around the Fortran libraryarpack
, andfaer
.arpack-ng
has its own fair share of problems, which is why I thus far always used thecpp
crate to call into thespectra
library.Additional context
Benchmarks run on a AMD Ryzen 9 5950X processor
https://en.wikipedia.org/wiki/Arnoldi_iteration
https://en.wikipedia.org/wiki/Krylov_subspace
https://spectralib.org/
https://slepc.upv.es/
https://crates.io/crates/arpack-ng
The text was updated successfully, but these errors were encountered: