Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import quantecon
from numba import jit
from numba import njit, prange
def cartesian_2d(x,y,out=None):
p = x.shape[0]
q = y.shape[0]
from numpy import *
from numba import jit
N = 1000000
A = random.random((N,2,2))
B = random.random((N,2,2))
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))