-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: add support for array-likes in polynomial evaluation #18662
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Add support for array-likes in polynomial evaluation | ||
---------------------------------------------------------------------------- | ||
|
||
Polynomial evaluation now accepts array-likes (e.g. lists) as its | ||
input argument, in addition to NumPy arrays. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,6 +479,7 @@ def __setstate__(self, dict): | |
|
||
def __call__(self, arg): | ||
off, scl = pu.mapparms(self.domain, self.window) | ||
arg = np.asarray(arg) | ||
arg = off + scl*arg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A simpler way to do the same thing might be to make sure |
||
return self._val(arg, self.coef) | ||
|
||
|
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.
With this, previously working calls using masked arrays would stop working - e.g.,
That particular part could be solved by making this
np.asanyarray
- though I guess it is possible the polynomials are also used by, e.g., dask, in which case this would still be a problem.