[SciPy-user] Fast Gauss Transform

Cournapeau David cournape at atr.jp
Tue Mar 21 20:26:41 EST 2006


On Tue, 2006-03-21 at 14:56 -0600, Robert Kern wrote:
> David Huard wrote:
> > Hi Robert,
> > I finally followed the path of least resistance and tried to wrap Yang's
> > package using Swig but it seems like I'm out of my depth here. I managed
> > to create a python module, but when I call the FastGauss class, it
> > complains that the class asks for double * and that it receives a
> > numpy.array. I guess the interface I provided is not correct, but I
> > couldn't find any example that I could follow step by step. 
> > 
> > I also tried to wrap the class with f2py, but python complains :
> > ImportError: dynamic module does not define init function (initfgt)
What is meant by fast gauss ? I have a small module to compute gaussian
densities in C, meant as a speed up for EM algorithm for Gaussian
mixture models under matlab which works OK (the C module is totally
independant of matlab). It doesn't use any fancy techniques, but is
quite fast (can definitely handle 4 * 1e5 samples), and tested against
valgrind for any potential memory misuse. It depends on LAPACK for full
covariance matrices cases (I need Cholesky decomposition), but this is
not a problem with scipy :)

As an exemple, used under matlab, computing 4 different 4 dimension
gaussian a posteriori densities with full covariance matrices, takes
around 0.5 s on my PIV 3Ghz for 1e6 samples; and matlab overhead is not
negligeable (re-arranging array layout, etc...). I can definitely see
usage cases where this would be too slow, but for many practical cases,
this is definitely enough (it is at least for me :) )

David




More information about the SciPy-User mailing list