Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • aix-marseille university
  • here
View GitHub Profile
@maedoc
maedoc / fused.c
Last active May 2, 2024 07:34
Fused kernels for simulations
#include<stdbool.h>
#include<stdio.h>
struct sim {
const int rng_seed;
const int num_item;
const int num_node;
const int num_svar;
const int num_time;
@maedoc
maedoc / ahoyn.py
Created March 29, 2024 17:46
simple adaptive Heun integrator
def heun(y, t, dt):
d1 = dfun(y, t)
d2 = dfun(y + dt*d1, t + dt)
err = np.mean(np.abs((d1 - d2)))#/(1e-9+d2)))
return y + dt/2*(d1 + d2), err
def solve_adapt1(y0, ts, tol):
ys = [y0]
max_dt = dt = ts[1] - ts[0]
t0 = ts[0]
@maedoc
maedoc / ndim-visitor-jax.py
Last active December 11, 2023 13:22
Compare visiting N-dimensions with Jax scans vs pre-generated indices with NumPy meshgrid
import os
# use cpu for this
os.environ['CUDA_VISIBLE_DEVICES'] = ''
########################### numpy style
import numpy as np
n = 5
size = 4
@maedoc
maedoc / 23-11-24-localfdr.ipynb
Created November 24, 2023 13:08
a short example of local fdr outlier detection
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-12-gain-ball-geom.ipynb
Created October 12, 2023 11:58
comparing point vs extended geometry for source sensor forward model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-11-taichi-test.ipynb
Created October 12, 2023 08:33
Short test of taichi on tight numerical loops
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / simple-sbi.ipynb
Created October 5, 2023 10:33
Simple examples of simulation based inference
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / discretized-linear-delays.ipynb
Last active September 11, 2023 15:08
discretized linear delays
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / µrwkv.py
Last active January 24, 2024 15:09
Another short take on RWKV, towards use with time series
import numpy as np
import torch
class MyModule(torch.nn.Module):
def add_param(self, key, shape):
val = torch.randn(*shape)/np.prod(shape)
setattr(self, key, torch.nn.Parameter(val))
@maedoc
maedoc / bayes-classifier.ipynb
Last active April 20, 2023 13:22
simple Bayesian classifier
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.