Fast Two-Sample Testing with Analytic Representations of Probability Measures
Paper: http://arxiv.org/abs/1506.04725 . My (Kacper Chwialkowski) web page: http://www0.cs.ucl.ac.uk/staff/K.Chwialkowski/
If you find this code confusing, drop me an email.