Skip to content

Instantly share code, notes, and snippets.

@dgleich
dgleich / gexpmq.py
Last active August 29, 2015 13:58
A Gauss-Seidel based method to approximate the matrix exponential of a stochastic matrix using a queue
"""
demo_gexpmq.py
A demonstration of the Gauss-Seidel coordinate relaxation scheme
to estimate a column of the matrix exponential that operates
only on significant entries.
Written by Kyle Kloster and David F. Gleich
"""
# Read in the data without any processing
data <- read.table('http://www.dartmouth.edu/~chance/teaching_aids/data/birthday.txt',as.is=1)
data[,1] <- as.Date(data[,1],format='%m/%d/%y')
plot(data,xlab='Date',ylab='Live Births',main='Live Births by Date')
# save the plot
png('dob-distribution.png',width=700)
plot(data,xlab='Date',ylab='Live Births',main='Live Births by Date')
dev.off() # write it
# Two groups?
data[,3] <- as.factor(weekdays(data[,1]))
plot(data[,3],data[,2],main='Live Births by Day of Week')
png('dob-dayofweek.png',width=700)
plot(data[,3],data[,2],main='Live Births by Day of Week')
dev.off() # write it
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Google Translate API code
Based on http://code.activestate.com/recipes/576890/ but heavily modified.
"""
__author__ = 'David F. Gleich'
__version__ = 1
#!/usr/bin/env python
"""
tweets.py
=========
Implement a cached tweet database with all the rate limiting
and message filting.
Usage
#!/usr/bin/env python
import sys
import array
import itertools
import random
def test(memsize):
print "allocating"
a = array.array('d')

Keybase proof

I hereby claim:

  • I am dgleich on github.
  • I am dgleich (https://keybase.io/dgleich) on keybase.
  • I have a public key whose fingerprint is D734 F90F 005B 5BEB 993A EFA4 47D9 CBF5 CC13 99D7

To claim this, I am signing this object:

#if defined(_WIN32) || defined(_WIN64)
#pragma warning(disable:4996)
#include <random>
#define tr1ns std::tr1
#elif defined __GNUC__
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#if GCC_VERSION < 40300
#include <tr1/random>
@dgleich
dgleich / exact_modularity.cc
Created May 26, 2011 19:29
A benchmark problem for enumeration of graph subsets
/**
* @file exact_modularity.cc
* Find the cluster of largest modularity in a small graph by exhaustive
* enumeration.
* @author David F. Gleich
*/
/**
* History
* -------
@dgleich
dgleich / minicards.tex
Created June 15, 2012 15:09
A latex file for SIAM mini-symposium hand-out cards
\documentclass[10pt]{article}
\usepackage{labels}
\usepackage{url}
\newcommand{\brk}{$\cdot$ }
%\LabelGridtrue % Enable this to
\LabelCols=2% Number of columns of labels per page
\LabelRows=6% Number of rows of labels per page
\begin{document}
\numberoflabels=12