Skip to content

Instantly share code, notes, and snippets.

View twiecki's full-sized avatar

Thomas Wiecki twiecki

View GitHub Profile
@twiecki
twiecki / simplegibbs_cython.pyx
Created May 11, 2012 18:55 — forked from fonnesbeck/simplegibbs_cython.pyx
Simple Gibbs sampler in cython, adapted from http://bit.ly/J3vP63
'''
Gibbs sampler for function:
f(x,y) = x x^2 \exp(-xy^2 - y^2 + 2y - 4x)
using conditional distributions:
x|y \sim Gamma(3, y^2 +4)
y|x \sim Normal(\frac{1}{1+x}, \frac{1}{2(1+x)})
'''
@twiecki
twiecki / fastdm_cdf.pyx
Created March 12, 2012 12:48 — forked from anonymous/fastdm_cdf.pyx
function for censored distrbutions
#!/usr/bin/python
# Cython wrapper for the fast-dm code by Voss & Voss
# (C) by Thomas Wiecki (thomas_wiecki@brown.edu), 2010
# GPLv2 or later.
from __future__ import division
import numpy as np
cimport numpy as np
cimport cython