Skip to content

Commit

Permalink
Merge pull request numpy#18203 from anntzer/fq
Browse files Browse the repository at this point in the history
MAINT: Speedup np.quantile.
  • Loading branch information
seberg authored Nov 5, 2021
2 parents a3e8a75 + f9c2573 commit 46ef519
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numpy/lib/function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4567,7 +4567,8 @@ def _quantile(
# The dimensions of `q` are prepended to the output shape, so we need the
# axis being sampled from `arr` to be last.
DATA_AXIS = 0
arr = np.moveaxis(arr, axis, destination=DATA_AXIS)
if axis != DATA_AXIS: # But moveaxis is slow, so only call it if axis!=0.
arr = np.moveaxis(arr, axis, destination=DATA_AXIS)
# --- Computation of indexes
# Index where to find the value in the sorted array.
# Virtual because it is a floating point value, not an valid index.
Expand Down

0 comments on commit 46ef519

Please sign in to comment.