This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
OlderNewer