Skip to content

Instantly share code, notes, and snippets.

View luk-f-a's full-sized avatar

luk-f-a

View GitHub Profile
@luk-f-a
luk-f-a / First-class function semantics.ipynb
Created October 30, 2020 09:49
First-class function semantics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luk-f-a
luk-f-a / fc_subtyping.md
Last active April 23, 2020 14:15
Function subtyping in Numba

Some use-cases of function subtyping

Currently, numba functions display a lot of behaviours expected from true first-class functions. There are, however, 3 behaviours which we see as useful and are currently missing:

  1. iterating over a sequence of functions
  2. avoiding re-compilation of higher-order functions
  3. ability to cache higher-order functions

iterating over a sequence of functions

@luk-f-a
luk-f-a / debug.md
Last active April 18, 2020 16:29
Type problem with function types subtyping

This line comes from the test code, right before the function is executed.

Type of tuple in test code Tuple(type(CPUDispatcher(<function TestBasicSubtyping.test_basic4.<locals>.foo1 at 0x7fdc32df7400>)), type(CPUDispatcher(<function TestBasicSubtyping.test_basic4.<locals>.foo2 at 0x7fdc32df7488>)))  code:  1566

This line comes from _intern. the tuple is created and assigned 1568 as typecode

Creating new tuple  
	 Type: Tuple(type(CPUDispatcher(<function TestBasicSubtyping.test_basic4.<locals>.foo1 at 0x7fdc32df7400>)), type(CPUDispatcher(<function TestBasicSubtyping.test_basic4.<locals>.foo2 at 0x7fdc32df7488>))) 
 id: 140583722982144 
@luk-f-a
luk-f-a / subtyping_numba.ipynb
Created April 13, 2020 12:18
Proposal for subtyping in Numba
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luk-f-a
luk-f-a / gist:6d0eef6534a8aae27a6650093321d833
Last active January 17, 2020 09:28
Class overload proposal for numba-scipy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luk-f-a
luk-f-a / bwn_bridge.py
Created August 8, 2017 15:12
Brownian bridge simulation
def gen_bw_bridge(steps, W, n):
"""
Given a column vector of end values, it will create n brownian bridge
simulations per value for the amount of steps as defined.
Can be easily generalized to include random initial values
and more general start and end times
steps: integer, how many time intervals there will be
between 0 and 1
W: (sims, 1) nump vector with end values of brownian motion