-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,13 @@ def clip(val): | |
return val | ||
|
||
|
||
@numba.njit("f4(f4[:],f4[:])", fastmath=True) | ||
@numba.njit("f4(f4[::1],f4[::1])", | ||
fastmath=True, | ||
cache=True, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lmcinnes
Author
Owner
|
||
locals={"result": numba.types.float32, | ||
"diff": numba.types.float32, | ||
"dim": numba.types.int32}, | ||
) | ||
def rdist(x, y): | ||
"""Reduced Euclidean distance. | ||
|
@@ -40,8 +46,10 @@ def rdist(x, y): | |
The squared euclidean distance between x and y | ||
""" | ||
result = 0.0 | ||
for i in range(x.shape[0]): | ||
result += (x[i] - y[i]) ** 2 | ||
dim = x.shape[0] | ||
for i in range(dim): | ||
diff = x[i] - y[i] | ||
result += diff * diff | ||
|
||
return result | ||
|
||
|
@lmcinnes
After this change I get the following error on Windows:
RuntimeError: cannot cache function 'rdist': no locator available for file 'C:\\Users\\<user>\\Anaconda3\\lib\\site-packages\\umap_learn-0.4.0-py3.7.egg\\umap\\layouts.py'