Numba: a Python-to-LLVM compiler
From the home page:
Numba is an Open Source NumPy-aware optimizing compiler for Python […]. It uses the remarkable LLVM compiler infrastructure to compile Python byte-code to machine code especially for use in the NumPy run-time and SciPy modules.
I’ve found this article where they compare Numba with Cython, and it seems it gives really good performance by just adding some annotations. This is the code they use:
import numpy as np
from numba import double
from numba.decorators import jit
@jit(arg_types=[double[:,:], double[:,:]])
def pairwise_numba(X, D):
M = X.shape[0]
N = X.shape[1]
for i in range(M):
for j in range(M):
d = 0.0
for k in range(N):
tmp = X[i, k] - X[j, k]
d += tmp * tmp
D[i, j] = np.sqrt(d)
5 Notes/ Hide
-
macarenomarco likes this
-
daisyrosedigital likes this
-
yani12 likes this
-
repejota reblogged this from inercia
-
repejota likes this
-
chelsie101 likes this
-
inercia posted this