Skip to content

Instantly share code, notes, and snippets.

@alexbw
Created August 15, 2012 18:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbw/3362603 to your computer and use it in GitHub Desktop.
Save alexbw/3362603 to your computer and use it in GitHub Desktop.
from numba.decorators import jit as jit
@jit(arg_types=[[['d']], [['d']]], ret_type=[['d']])
def pairwise_numba(X, output):
n_samples, n_dim = X.shape
n_samples1, n_samples2 = output.shape
for ii in range(n_samples):
for jj in range(n_samples):
result = 0.0;
for kk in range(n_dim):
result += (X[ii,kk] - X[jj,kk]) * (X[ii,kk] - X[jj,kk])
output[ii,jj] = result
return output
@mmagnuski
Copy link

Just out of curiosity: why do you "import jit as jit"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment