[Numpy-discussion] Calculating density based on distance

Sturla Molden sturla@molden...
Sat Jan 14 15:21:48 CST 2012


Den 14.01.2012 21:52, skrev Thiago Franco de Moraes:
> Is there a better and faster way of doing that? Is there something in my
> Cython implementation I can do to perform better?
>
>

You need to use a kd-tree to make the computation run in O(n log n) time 
instead of O(n**2).

scipy.spatial.cKDTree is very fast.

Sturla



More information about the NumPy-Discussion mailing list