[SciPy-Dev] Enhancements to scipy.spatial.cKDTree
Sturla Molden
sturla at molden.no
Thu Jul 12 12:42:42 EDT 2012
On 12.07.2012 00:26, Patrick Varilly wrote:
> On Tue, Jul 10, 2012 at 12:01 PM, Sturla Molden <sturla at molden.no
> <mailto:sturla at molden.no>> wrote:
>
> 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'm relatively new to Cython. Could you tell me where I could read up
> on these issues?
The main issue is the use of the .data attribute. See here:
http://wiki.cython.org/tutorials/NumpyPointerToC
Another is that Cython's ndarray interface is (more or less) deprecated
in favour of typed memoryviews:
http://docs.cython.org/src/userguide/memoryviews.html
So preferably the cKDTree code should use these, but I my experience
they can generate compile-time warnings.
There is also a 64-bit issue with cKDTree if I remember correctly. And
the only dtype it supports is float64. We should replace the current
pointer artimetics with multidimensional arrays. It had (or still has)
non-portable code like dependency on unions and binary layout (tree and
heap nodes). And there the issue of making it release the GIL whenever
it should. So several things needs be fixed.
Sturla
More information about the SciPy-Dev
mailing list