Code written by Iain

None of this code comes with any warranty of any kind. Except where stated otherwise, the code is copyright Iain Murray and may be redistributed under at least the GPL (version 2 or 3). If you ask me, I’ll probably agree to a simpler more permissive license.

Code associated with my papers might be found on my publications page.

My personal Github profile has a few things on it.

See also my group’s Github profile.

Matlab / Octave utilities

Some Matlab/Octave utility functions: imurray-matlab-1.037.tar.gz, browse, Contents.m. They’re simple functions that at some point I thought were general enough to warrant copying out of whatever project directory I was working in at the time.

I also have a collection of potentially-missing or replacement functions for people without certain toolboxes, or (older versions of) Octave.

If you are interested in neat Matlab utility functions, I recommend Tom Minka’s lightspeed Matlab toolbox. From V2.8 it changed back to a permissive (MIT) license.

Fast numerics

Updated June 2012: I have written mex files to do sum(log(X)) fast and accurately in Matlab. With a bit of tweaking, the C code should work elsewhere too. It works by bit-twiddling the IEEE floating point representation, but these days that is pretty portable. The code is reasonably careful to deal with infinities and NaNs correctly. This should be usable as a general, drop-in replacement for sum(log(X)).

Approximate exp for Matlab/Octave, two different versions with different time/accuracy/memory tradeoffs. They are written in C and could easily be adapted for use in any environment. They are less recommended than the sum(log(X)) code because the approximations make these routines less safe for general use. Updated March 2011: fixed a problem with compiler options that could cause crashes; added an OpenMP version that allows you to use multiple CPUs; added explicit Octave support.

Finally, although not recommended, “Softmax”: C/C++ code to evaluate log(exp(a)+exp(b)) or log(1+exp(-x)) (for x>0) approximately, but more quickly than using standard routines. Uses a bad implementation of a Taylor expansion. Possibly useful somewhere, but I never use this now.

Swendsen–Wang

Swendsen–Wang is a sampling algorithm which is amazing on some Ising model distributions. When I was first working out the details of Swensen–Wang sampling I put a hacked together implementation on the web. I’ve since documented and put up a faster and more general Matlab/mex implementation. The README gives lots more information. You can download an archive containing all of the above: swendsen_wang.tar.gz.

Unsorted / Misc

The following miscellaneous blobs of code are not packaged up very nicely. There’s a small chance something will be useful.

Miscellaneous scripting hacks:

Before running any of these take a quick look at the source and see if it is what you want. I take no responsibility for any damage, some of these (eg rmx) are potentially very dangerous!

Obsolete

Bad postscript hacks:

Quines

Last and definitely least in usefulness, some old quine attempts: