Skip to content
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

Replace numpy linalg with scipy linalg #15

Open
magsol opened this issue Mar 20, 2020 · 2 comments
Open

Replace numpy linalg with scipy linalg #15

magsol opened this issue Mar 20, 2020 · 2 comments

Comments

@magsol
Copy link
Member

magsol commented Mar 20, 2020

NumPy's linear algebra library is subpar. SciPy's uses LAPACK which is well-verified and excellent.

It works the same way. Just import scipy.linalg instead.

https://github.com/quinngroup/ornet/blob/eigenspectrum/src/analysis/util.py#L51

@magsol
Copy link
Member Author

magsol commented Mar 20, 2020

Also, use the eigh function instead of the generic eig, because you are indeed using a Hermitian/symmetric matrix. As a result--and as you can see from the documentation--the eigenvalues and eigenvectors will already be ordered for you.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html#scipy.linalg.eigh

@magsol
Copy link
Member Author

magsol commented Mar 20, 2020

Don't even need sort_eigens anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant