Skip to content

Instantly share code, notes, and snippets.

@cicdw
Created November 10, 2017 16:06
Show Gist options
  • Save cicdw/b5f95e6ade28f18e1ca390d9711cb21f to your computer and use it in GitHub Desktop.
Save cicdw/b5f95e6ade28f18e1ca390d9711cb21f to your computer and use it in GitHub Desktop.
Code snippets for Medium blog post
from numba import guvectorize
@guvectorize('i8, f8, f8, b1, f8[:], f8[:]',
'(), (), (), (), (s) -> (s)')
def fast_predict_over_time(x, y, z, overlay, _, out):
adj = 1.5 if overlay else 1.0
for t in range(len(out)):
out[t] = adj * (t * x ** 2 + y - 2 * z - 2 * t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment