stumpy icon indicating copy to clipboard operation
stumpy copied to clipboard

Suggesting a minor enhancement in `mpdist.py:: _mpdist_vect`

Open NimaSarajpoor opened this issue 6 months ago • 1 comments

I think we can replace

https://github.com/TDAmeritrade/stumpy/blob/423c679fdfcdd547744d2b9a2aed7565124fd6e1/stumpy/mpdist.py#L100-L106

with

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) 

NimaSarajpoor avatar Apr 19 '25 21:04 NimaSarajpoor