SelectionRule template parameter
Closed this issue · 2 comments
I was wondering why the selection rule was chosen to be a template parameter instead of a constructor argument (or function argument to init()
or compute()
)?
I'm trying to write a C API around Spectra and this makes it hard to create the eigensolver. The solution (or hack) used in RSpectra (i.e. generating all code in a switch statement using macros) is rather inflexible and could be avoided if only SelectionRule
wasn't a template parameter.
Yeah, viewed from today, the original design may be questionable.
I recall that when I wrote this library, I was standing at the user's point of view. Typically when you want to compute eigenvalues, you already have a well-defined problem. You know you need the largest, or the smallest ones.
But I agree that writing a wrapper is an issue. I believe moving the selection rule to compute()
is doable, but that will break existing code. Probably I can create a dynamic version parallel to the current one, after the whole library is stable enough.