Skip to content

Instantly share code, notes, and snippets.

@mchouza
mchouza / dot_prod_perf.txt
Last active November 8, 2017 13:09
Type promotion
In [1]: import numpy as np
In [2]: A = np.random.normal(size=(5000, 5000))
In [3]: x = np.random.normal(size=5000) + 1j * np.random.normal(size=5000)
In [4]: %timeit np.dot(A, x)
1 loop, best of 3: 280 ms per loop
In [5]: %timeit np.dot(A, x.real) + 1j * np.dot(A, x.imag)
import ghalton
from pylab import *
from scipy.stats import gamma
def qmc_gamma(alpha, N):
M = len(alpha)
sequencer = ghalton.Halton(2*M)
valid = ones(shape=(N,), dtype=bool)
hs = array(sequencer.get(N)).transpose()
@mchouza
mchouza / twitter-cubes-puzzle.md
Last active November 9, 2015 01:32
Twitter cubes puzzle
@mchouza
mchouza / fizzbuzz.s
Created October 8, 2015 17:10
FizzBuzz in x86-64 ASM without conditional branches
;; FizzBuzz in x86-64 ASM without conditional branches
section .data
fizz: db 'Fizz'
buzz: db 'Buzz'
nl: db 10
section .bss
digits: resb 2