-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
ENH: add PPoly.solve(y) for solving p(x) == y
#4356
Conversation
@@ -247,7 +247,7 @@ def integrate(double_or_complex[:,:,::1] c, | |||
@cython.wraparound(False) | |||
@cython.boundscheck(False) | |||
@cython.cdivision(True) | |||
def real_roots(double[:,:,::1] c, double[::1] x, int report_discont, | |||
def real_roots(double[:,:,::1] c, double[::1] x, double y, int report_discont, | |||
int extrapolate): |
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.
While you're at it, maybe change these to bint
to indicate boolean?
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.
What is bint
? --- it's an actual question, not a confrontational one.
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.
Same as int in C, but cython does automatic conversions to/from python booleans when necessary.
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.
Done, here and elsewhere in the file.
Rebased and fixed two corner case issues for polynomials which are identically constant and for discontinuities across a breakpoint. Now the behavior of |
@@ -579,11 +584,15 @@ cdef int croots_poly1(double[:,:,::1] c, int ci, int cj, double* wr, double* wi, | |||
return -1 |
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.
Also needs to be changed
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.
Indeed! Done in a77ece8.
@@ master #4356 diff @@
======================================
Files 235 235
Stmts 43282 43285 +3
Branches 8155 8155
Methods 0 0
======================================
+ Hit 33664 33667 +3
Partial 2591 2591
Missed 7027 7027
|
extrapolate : int, optional | ||
Whether to extrapolate to out-of-bounds points based on first | ||
extrapolate : bint, optional | ||
Whether to extrapolate to ouf-of-bounds points based on first |
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.
The ouf typo has become endemic, it cannot be eradicated! #5704
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.
Darwin hardest hit.
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.
Sometimes they hide in them old PRs... Eradicated.
For a polynomial p(x) which is identically equal const at an interval, report solutions of `p(x) = const`. Also handle discontinuities across the r.h.s. of `p(x) = y`.
ENH: interpolate: add PPoly.solve(y) for solving ``p(x) == y``
Thanks, merged. |
Doesn't necessarily solve the problem discussed in gh-3260, because |
Yeah, extending it handle an array_like |
closes gh-3261
Regarding the API, I don't have a strong opinion with respect to whether to have a separate method,
PPoly.solve(y)
or to fold the offset parameter to theroots
method. At the moment it's implemented as a separate method, but it might be still OK to break backwards compat and make theroots
signature bePPoly.roots(y=0, discontinuity=True, extrap=False)
.