Use numpy eigh instead of scipy eigh with driver kwarg #5263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In #5251 we updated the LAPACK driver used for the scipy hermitian
optimized eigensovler to use 'evd' instead of the default 'ev'. However,
this implicitly added a scipy minimum version of 1.5.0 because the
driver kwarg was only added to the eigh() function in that release. [1]
In that PR we didn't bump the minimum scipy version to reflect this.
However, scipy 1.5.0 has a version conflict with our downstream users,
mainly qiskit-aqua/qiskit-chemistry which use PySCF as an optional
dependency. PySCF has a capped version of scipy in their requirements [2]
which makes bumping our minimum scipy version intractable currently. To
avoid this issue, this commit switches to use numpy's eigh()
function [3] instead of scipy's. The numpy function uses the evd driver
and was what we originally used in #5251 but was switched to use scipy's
eigh() with the driver kwarg to avoid bumping the minimum version of
numpy. However, this wasn't actually required and was caused by me
misreading 1.8.0 as 1.18.0 so using the numpy version of the eigh()
function will fix the issue for our users that are running with PySCF.
Details and comments
[1] https://docs.scipy.org/doc/scipy/reference/release.1.5.0.html#scipy-linalg-improvements
[2] https://github.com/pyscf/pyscf/blob/v1.7.5/setup.py#L490
[3] https://numpy.org/doc/stable/reference/generated/numpy.linalg.eigh.html