Skip to content

Commit ca20f03

Browse files
authored
PERF: do not use stable sort in nunique (#447)
1 parent feb548a commit ca20f03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/array_api_extra/_lib/_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def nunique(x: Array, /, *, xp: ModuleType | None = None) -> Array:
822822

823823
# xp does not have unique_counts; O(n*logn) complexity
824824
x = xp.reshape(x, (-1,))
825-
x = xp.sort(x)
825+
x = xp.sort(x, stable=False)
826826
mask = x != xp.roll(x, -1)
827827
default_int = default_dtype(xp, "integral", device=_compat.device(x))
828828
return xp.maximum(

0 commit comments

Comments
 (0)