Skip to content

Instantly share code, notes, and snippets.

@rvaghefi
Created January 14, 2021 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvaghefi/0a387d89a6eac731d730232bed5fd26c to your computer and use it in GitHub Desktop.
Save rvaghefi/0a387d89a6eac731d730232bed5fd26c to your computer and use it in GitHub Desktop.
numba_for_loop.py
from numba import jit
@jit(nopython=True)
def numba_for_loop(X,Y):
m = X.shape[0]
k = Y.shape[0]
D = np.zeros((m,k))
for i in range(m):
for j in range(k):
D[i,j] = np.sum((X[i] - Y[j])**2)**0.5
return D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment