-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add CRootsOf incrementally for eigenvalues #25283
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
✅ Hi, I am the SymPy bot (v170). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
sympy/matrices/eigen.py
Outdated
@@ -258,7 +258,7 @@ def _eigenvals_dict( | |||
f = charpoly.as_expr() | |||
x = charpoly.gen | |||
try: | |||
eigs = {CRootOf(f, x, idx): 1 for idx in range(degree)} | |||
eigs = Counter(CRootOf(f, x, idx) for idx in range(degree)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be charpoly.all_roots(multiple=False)
Maybe use |
Thanks for the PR! There are CI failures, which however don't seem to be related to this PR. Have you considered using factorization of the characteristic polynomial to compute the eigenvalues with their algebraic multiplicities? That approach seems much faster according to my test on my example:
Output:
Once we get the irreducible factors, we can populate the eigenvalue dict with roots of the irreducible factors ( |
The 2.7 failing backlog prevents the merges though |
The |
References to other Issues or PRs
Fixes #25282
Brief description of what is fixed or changed
Other comments
Release Notes
Matrix.eigenvals
gives wrong result whenmultiplicity=False
.