Skip to content

BUG: prevent underflow/overflow when finding roots in IRR #25

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

Merged
merged 1 commit into from
Nov 4, 2019

Conversation

person142
Copy link
Member

NumPy's roots function uses the companion matrix to find polynomial
roots. In the process it makes the polynomial monic by dividing by the
leading coefficient, which can cause overflow/underflow. This can be
avoided by working with a scaled version of the companion matrix
instead. Since scaling the matrix simply scales the eigenvalues
(i.e. the roots of the polynomial in this case), the original roots
can easily be recovered.

Closes gh-15.

NumPy's roots function uses the companion matrix to find polynomial
roots. In the process it makes the polynomial monic by dividing by the
leading coefficient, which can cause overflow/underflow. This can be
avoided by working with a scaled version of the companion matrix
instead. Since scaling the matrix simply scales the eigenvalues
(i.e. the roots of the polynomial in this case), the original roots
can easily be recovered.

Closes numpygh-15.
Copy link
Member

@Kai-Striega Kai-Striega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍 for neatening the tests to. It's nice to see all of these bugs being fixed.

@Kai-Striega Kai-Striega merged commit 9b2cb63 into numpy:master Nov 4, 2019
@person142 person142 deleted the irr branch November 4, 2019 03:42
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

Successfully merging this pull request may close these issues.

Bizarre linalg errors with IRR
2 participants