-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: Take advantage of symmetry in leggauss. #5985
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
Conversation
The calculation of points and weights for Gauss-Legendre quadrature can take advantage of the symmetry of the companion matrix when computing its eigenvalues in order to speed up the computation.
The CI error looks unrelated.
|
Looks mostly good to me. The leggauss function calls legcompanion whose docstring recommends using eigvalsh to find the eigenvalues for the basis polynomials, and the leggauss comment says that it uses the fact that the companion matrix is symmetric to get better eigenvalues... so something must have been lost somewhere. Also, the |
Oops ;) Might be worth checking the other polynomial types to see if the error is generic. |
Looks like Laguerre suffers from the same problem. |
And they all have the extra sort. EDIT: but the |
The |
oh you're right, I must have been looking at the scipy eigvalsh docs. |
Well the docs say that _ssyevd and _heevd are used and those docs both say that the returned eigenvalues are sorted in ascending order |
ENH: Take advantage of symmetry in leggauss.
Thanks @ajdawson! |
The calculation of points and weights for Gauss-Legendre quadrature can take advantage of the symmetry of the companion matrix when computing its eigenvalues. This can significantly speed up the computation even for moderately small values of the input degree.