[SciPy-Dev] Enhancements to scipy.spatial.cKDTree

Sturla Molden sturla@molden...
Tue Jul 10 06:01:00 CDT 2012

On 07.07.2012 01:36, Patrick Varilly wrote:

> I was writing to gauge if there's actually any interest in cleaning up
> KDTrees and Cythonizing the rest of the KDTree interface.  If so, I'd be
> willing to put a bit of effort into doing so.  A delicate question that
> comes up is whether anyone relies on the subtle differences between
> KDTree.query() and cKDTree.query() (e.g., passing k = None), so that
> bringing the two interfaces exactly in line with each other would break
> existing code.  How is this issue usually dealt with?

At least cKDTree have to be fixed, it will break as soon as the move to
PyArray_DATA is mandatory.

Preferably we should use Cython memoryviews and multidimensional arrays 
in the code, instead of just C pointer artithmetics (which is harder to 
understand). That will make the Cython code more readable to NumPy users.

The GIL issue should also be fixed, as searching might take a while.

I don't have time to do this now, but I might in the summer vacation.

Preferably I'd like to see KDTree inherit from cKDTree.

(I have numerous versions of cKDTree on my computer, including one that 
works with Python lists and a multithreaded versions.)


More information about the SciPy-Dev mailing list