Content-Length: 240599 | pFad | http://github.com/numpy/numpy/issues/24480

B1 ENH: Reduce overhead of numpy.polynomial · Issue #24480 · numpy/numpy · GitHub
Skip to content

ENH: Reduce overhead of numpy.polynomial #24480

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

Open
eendebakpt opened this issue Aug 21, 2023 · 2 comments
Open

ENH: Reduce overhead of numpy.polynomial #24480

eendebakpt opened this issue Aug 21, 2023 · 2 comments

Comments

@eendebakpt
Copy link
Contributor

eendebakpt commented Aug 21, 2023

Proposed new feature or change:

The numpy.polynomial classes have quite some overhead in the calculations. This is a collection of ideas to reduce the overhead

from numpy.polynomial import Polynomial
import timeit

p = Polynomial([1,2,3])
q = Polynomial([3,2,1])

dt=timeit.timeit('p + p - q', globals={'p': p, 'q': q}, number=40_000)
print(dt)

the timings are

2.51 seconds (main)
2.35 seconds (np.array_equal)
2.2 seconds (.all() )

The fastest option does assume the domain already is a numpy array. Current main and the np.array_equal option cast (with asarray). #24499

  • The numpy.polynomial.polyutils.as_series is called in many places. Also in internal methods where many of the input checks (e.g. on input dimensions) are not required. We can add a flag internal : bool to as_series than will skip several of the checks. Draft PR: MAINT: Improve performance of polynomial operations (2) #24531

Profiling results on main (2023-8-22) for p * q with p=Polynomial([1,2,3]); q=Polynomial([3,0,3]):
np_polynomial_mul

@aijams
Copy link

aijams commented Sep 28, 2023

Hello,
I would like to make a contribution to Numpy and I found this enhancement on the issue list.
I don't have that much free time, so it would likely take a while for me to work on this issue.

I have a couple questions:
Is this enhancement a high priority for Numpy development?
Do you know of other issues that are likely a higher priority than this one?

For context, I'm a first-time contributor to this project, so I'm not really sure what the important issues are.

@aijams
Copy link

aijams commented Oct 7, 2023

I just saw that you already have a PR out for this issue that hasn't yet been merged in.
I will therefore let you continue working on this.

Do you still wish to get this PR merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/issues/24480

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy