Skip to content

Instantly share code, notes, and snippets.

View FedericoStra's full-sized avatar

Federico Stra FedericoStra

  • Politecnico di Torino
  • Torino, Italy
View GitHub Profile
@FedericoStra
FedericoStra / IteratedFunctions.jl
Last active April 10, 2021 18:07
Iterated functions in Julia
module IteratedFunctions
export IteratedFunction, iterated
struct IteratedFunction{F} <: Function
f::F
n::UInt # ensure non-negative
end
IteratedFunction(f, n::Integer) = IteratedFunction(f, UInt(n))
@FedericoStra
FedericoStra / numba_global.py
Created October 23, 2019 09:42
Usage of global variables with numba
from numba import jit, njit
# Define a global variable.
g = 0
# foo doesn't care about the value of g at the time of definition.
@njit
def foo():
# foo uses the global variable.
return g