electronic-structure / SIRIUS

Domain specific library for electronic structure calculations
BSD 3-Clause "New" or "Revised" License
121 stars 40 forks source link

Fix ScaLAPACK p*syevd #898

Closed RMeli closed 11 months ago

RMeli commented 11 months ago

While working on DLA-Future integration in SIRIUS, I stumbled upon what looks like a spurious recursion. Fixing it also uncovered some missing reinterpret_cast in solve_ (for the eigenvalues and the workspace).

RMeli commented 11 months ago

cscs-ci run default

simonpintarelli commented 11 months ago

Thanks @RMeli . Afaik the full scalapack eigensolver is not used in the code, only the routines which find n-lowest eigenvalues.

I don't like the reinterpret_cast in the if(std::is_same<T, X>::value), we can now actually use constexpr if. ~I'll try to fix it in a separate PR.~

Ah actually, we can first merge this PR and then I can work on the rest, there are numerous reinterpret_casts to be removed ...

RMeli commented 11 months ago

the full scalapack eigensolver is not used in the code

If it's not used another approach would be to remove it?

I don't like the reinterpret_cast in the if(std::is_same<T, X>::value), we can now actually use constexpr if.

Good point. Now that we use C++17 we could also use the less verbose std::is_same_v instead.