Skip to content

Commit

Permalink
Merge pull request #59 from jorenham/quicksort-default
Browse files Browse the repository at this point in the history
changed default sorting method from `'stable'` to `None`, i.e. `'quicksort'` (which actually is introsort)
  • Loading branch information
jorenham committed Oct 30, 2023
2 parents 4435832 + 76dabdc commit 9f5fbf4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lmo/_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def l_moment(
dtype: np.dtype[T] | type[T] = np.float64,
fweights: IntVector | None = None,
aweights: npt.ArrayLike | None = None,
sort: SortKind | None = 'stable',
sort: SortKind | None = None,
cache: bool = False,
) -> npt.NDArray[T] | T:
r"""
Expand Down Expand Up @@ -1058,7 +1058,7 @@ def l_moment_influence(
/,
trim: AnyTrim = (0, 0),
*,
sort: SortKind | None = 'stable',
sort: SortKind | None = None,
tol: float = 1e-8,
) -> Callable[[V], V]:
r"""
Expand Down Expand Up @@ -1124,7 +1124,7 @@ def l_ratio_influence(
/,
trim: AnyTrim = (0, 0),
*,
sort: SortKind | None = 'stable',
sort: SortKind | None = None,
tol: float = 1e-8,
) -> Callable[[V], V]:
r"""
Expand All @@ -1151,7 +1151,7 @@ def l_ratio_influence(
The (vectorized) empirical influence function.
"""
_x = np.sort(a, kind=sort)
_x = np.sort(a, kind=sort) # type: ignore
_r, _k = clean_order(r), clean_order(k)
n = len(_x)

Expand Down
2 changes: 1 addition & 1 deletion lmo/_lm_co.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def l_comoment(
*,
dtype: np.dtype[T] | type[T] = np.float64,
rowvar: bool = True,
sort: SortKind | None = 'stable',
sort: SortKind | None = None,
cache: bool = False,
) -> npt.NDArray[T]:
r"""
Expand Down
6 changes: 3 additions & 3 deletions lmo/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def ordered(
*,
fweights: IntVector | None = None,
aweights: npt.ArrayLike | None = None,
sort: SortKind | None = 'stable',
sort: SortKind | None = None,
) -> npt.NDArray[np.floating[Any]]:
"""
Calculate `n = len(x)` order stats of `x`, optionally weighted.
Expand All @@ -165,12 +165,12 @@ def _clean_array(a: npt.ArrayLike) -> npt.NDArray[np.floating[Any]]:
_x = _clean_array(x)

if aweights is None and y is None:
return np.sort(_x, axis=axis, kind=sort)
return np.sort(_x, axis=axis, kind=sort) # type: ignore
if y is not None:
_y = _clean_array(y)
i_k = np.argsort(_y, axis=axis if _y.ndim > 1 else -1, kind=sort)
else:
i_k = np.argsort(_x, axis=axis, kind=sort)
i_k = np.argsort(_x, axis=axis, kind=sort) # type: ignore

def _sort_like(a: npt.NDArray[T]) -> npt.NDArray[T]:
return (
Expand Down

0 comments on commit 9f5fbf4

Please sign in to comment.