@numba.njit(parallel=True, fastmath=True)
def w(M, a):
n = len(a)
for i in numba.prange(n):
for j in range(n):
M[i,j] = np.exp(1j*k * np.sqrt(a[i]**2 + a[j]**2))
and timed it like this: %%timeit
n = len(a)
M = np.zeros((n,n), dtype=complex)
w(M, a)
On my 8-core system, this ends up more than 10x as fast as the numpy version he listed (which seems to lack the sqrt, though), which would place it close to the multithreaded Julia, even considering that ran it on a 4-core system. As an added bonus, it can also pretty much automatically translate to GPU as well. function start() {
[...]
If=32*1024*1024;
ya.phys_mem_resize(If);
ya.load_binary("vmlinux26.bin",0x00100000);
Jf=ya.load_binary("root.bin",0x00400000);
start=0x10000;
ya.load_binary("linuxstart.bin",start);
ya.eip=start;
The files vmlinux26.bin, root.bin and linuxstart.bin are fetched from the server.
I just cancelled my NYT subscription because of their actions, detailing the reason for doing so. It’s a very small action, but the best I can do right now.