DedalusProject / dedalus

A flexible framework for solving PDEs with modern spectral methods.
http://dedalus-project.org/
GNU General Public License v3.0
489 stars 115 forks source link

Reuse the LU decomposition when solving for left eigenvectors using the sparse solver #277

Closed csskene closed 8 months ago

csskene commented 8 months ago

SuperLU supports solving the transposed system from the LU factorisation of the un-transposed system. This PR adds a solve_adjoint method to the SuperLU matrix solvers so that the LU factorisation from the right eigenvector solve can be reused for the left eigenvector solve. Corresponding changes are made to the sparse evp solver.

The benefits are that only one LU factorisation now needs to be done for each sparse solve which improves efficiency as this is often the slowest part of the evp solve. Furthermore, as matrix factorisations are based on the direct matrices, factorising the transposed system is often slower due to its change in structure. This PR removes this issue.

csskene commented 8 months ago

Thanks for the review, I've tried to address the comments with the latest push.

kburns commented 8 months ago

Thanks! Looks good, I might push a quick change to cleanup the matrix solve stuff a bit, then merge.

csskene commented 8 months ago

Great, thanks!