Skip to content

Instantly share code, notes, and snippets.

View compare_products.py
import numpy as np
import quantecon
from numba import jit
from numba import njit, prange
@njit
def cartesian_2d(x,y,out=None):
p = x.shape[0]
q = y.shape[0]
View test_mul_22.py
from numpy import *
from numba import jit
N = 1000000
A = random.random((N,2,2))
B = random.random((N,2,2))
@jit(nopython=True)
def mulvec(A,B):
N = A.shape[0]
View interpolation_performance_comparison
# 2d comparison
import numpy as np
x = np.linspace(-1,1,100)
y = np.linspace(-1,1,100)
f = lambda x,y: np.sinc(x**2+y**2)
vals = np.array( [[f(xx,yy) for yy in y] for xx in x] )
N = 1000000 # number of points to evaluate
eval_points = -1+2*np.random.rand(N*2).reshape((N,2))