-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
MAINT: Improve performance of common_type and use result_type internally #24668
base: main
Are you sure you want to change the base?
Conversation
355105a
to
0f066cc
Compare
Using |
Ohh, now I see that the reason I must have hesitated is the behavior change. Which may be fine, but would maybe need a shout-out.
as logic, so that we can avoid that one change? I am OK to not worry about (I hate this function, but not sure I want to change it...) |
With your suggestion we still have the behaviour change right? The result of I see now that the documentation of I think that if we want to enforce that a single integer input type enforces the output is 64-bit float (at minimum) we have no alternative than to check each argument for being integer. In that case we fall back to #24467 or some combination that I suspect will be slower than the current implementation. |
Cleanup implementation of
np.common_type
usingnp.result_type
and improve performance.np.common_type(x, x)
withx=np.array([1.])
goes from 1.6952696400003333 (main) to 1.1668818179987284 (this PR).now returns
float32
instead offloat64
.