You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggesting a minor enhancement in mpdist.py:: _mpdist_vect #1082
P_ABBA = np.empty(2 * j, dtype=np.float64)
if k is None:
percentage = np.clip(percentage, 0.0, 1.0)
k = math.ceil(percentage * (2 * Q.shape[0])) # BECAUSE `P_ABBA.shape[0] == 2 * j`, see the first line
k = min(int(k), P_ABBA.shape[0] - 1)
Opened #1158 with this, including the aampdist counterpart you mentioned. Since P_ABBA = np.empty(2 * j), the following k = min(int(k), P_ABBA.shape[0] - 1) already applies the same 2 * j - 1 bound, so the inner min is redundant. Verified it's behaviour-preserving over 20,000 randomised (n, m, percentage) combinations (including out-of-range percentages so the clip path is hit) — identical k every time — and test_mpdist.py/test_aampdist.py pass (82 tests).
I think we can replace
https://github.com/TDAmeritrade/stumpy/blob/423c679fdfcdd547744d2b9a2aed7565124fd6e1/stumpy/mpdist.py#L100-L106
with