This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # # Integrating Agents.jl with CellListMap.jl | |
| # ```@raw html | |
| # <video width="auto" controls autoplay loop> | |
| # <source src="../celllistmap.mp4" type="video/mp4"> | |
| # </video> | |
| # ``` | |
| # This example illustrates how to integrate Agents.jl with | |
| # [CellListMap.jl](https:://github.com/m3g/CellListMap.jl), to accelerate the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| julia> function min_max(xs::AbstractVector, n::Int) | |
| nmin = fill(typemax(Int), n) | |
| nmin_xmax, nmin_imax = nmin[1], 1 | |
| nmax = fill(typemin(Int), n) | |
| nmax_xmin, nmax_imin = nmax[1], 1 | |
| for val in xs | |
| if val < nmin_xmax | |
| nmin[nmin_imax] = val | |
| nmin_xmax, nmin_imax = findmax(nmin) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct OneHotCode{T} <: AbstractVector{T} | |
| i::T | |
| length::T | |
| end | |
| Base.getindex(o::OneHotCode,i) = i == o.i ? 1 : 0 | |
| Base.size(o::OneHotCode) = (o.length,) | |
| Base.length(o::OneHotCode) = o.length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import seaborn; seaborn.set_style('whitegrid') | |
| import time | |
| import scipy | |
| import numpy as np | |
| from numba import njit | |
| from numba import prange | |
| from sklearn.datasets import fetch_covtype | |
| digits_data = fetch_covtype() |