[Numpy-discussion] Re: [SciPy-user] Fast Gauss Transform

Travis Oliphant oliphant.travis at ieee.org
Wed Mar 22 09:45:59 CST 2006

David Huard wrote:
> While fiddling with new code to compute kde, I noticed that 
> gaussian_kde has an unexpected behavior for 1D arrays.
> For instance :
> x = rand(1000)
> g = gaussian_kde(x)
> g(z)
> returns the same value no matter what z is. The problem disappears for 
> multidimensional data.  The dot product (self.inv_cov, diff) seems to 
> be causing the problem,  doing the product only for the first element 
> of diff and returning zeros for the rest. I guess this is not the 
> intended behavior for dot.

Yet another untested branch of the optimized dot code.  Apparently it's 
been very hard to get this one right after re-writing the 
scalar-multiplication portion.  Scalar multiplication is used in several 
branches but the parameters must be set just right. 

You were exposing a (1,1) x (1,N)  error that uses BLAS scalar 
multiplication at the core but the number of multiplies was set to 1 
rather than N. 

I added a test for this case in numpy and fixed the problem.   Thanks 
for the report.


More information about the Numpy-discussion mailing list