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

Check for no solution in np.irr Fixes #6744 #7332

Merged
merged 1 commit into from
Feb 29, 2016

Conversation

simongibbons
Copy link
Contributor

This implements the proposed fix for #6744

@@ -651,7 +651,7 @@ def irr(values):
"""
res = np.roots(values[::-1])
mask = (res.imag == 0) & (res.real > 0)
if res.size == 0:
if res.size == 0 or res[mask].size == 0:
Copy link
Member

Choose a reason for hiding this comment

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

I think you can do this more simply with

if not mask.any():
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do'h yea that makes sense. I've updated the PR with that change.

@charris
Copy link
Member

charris commented Feb 29, 2016

Coffee is the foundation of civilization. A few more hoops to traverse. Could you squash the commits? You can do that with git rebase -i HEAD^^^ followed by a force push git push --force origin <your branch>. Make sure the resulting commit message is as it should be.

@simongibbons
Copy link
Contributor Author

Squashed.

@charris
Copy link
Member

charris commented Feb 29, 2016

Thanks. LGTM pending tests.

charris added a commit that referenced this pull request Feb 29, 2016
Check for no solution in np.irr Fixes #6744
@charris charris merged commit 682a691 into numpy:master Feb 29, 2016
@simongibbons simongibbons deleted the irr_empty_check branch February 29, 2016 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants