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

Sturla Molden sturla@molden...
Sat Jul 14 00:54:30 CDT 2012

I am more or less finished with cleaning up Patrick's cKDTree code.

Here are the main changes I have made so far to Patrick's cKDTree  

- Integer sizes are correct for 32 and 64 bit (it was totally confused) 
and npy_intp are used consistently.
- np.float64_t instead of double
- All variables are properly declared (many were left undeclared).
- All for loops with a range are Cython loops (none of Patrick's loops 
were correct...).
- Python exceptions propagate correctly through cdef functions.
- Memory leaks are prevented with try/finally.
- MemoryError is raised on malloc or realloc failure (Cython handles 
"raise MemoryError" correctly).
- PyArray_DATA is used for future compatibility with NumPy.
- Made sure the common case of Euclidian distance is processed faster.

I believe it should be more or less OK, but it needs testing before it's 
worthy of a pull request to SciPy master.

The code is here:



Den 13.07.2012 19:15, skrev Sturla Molden:
> On 13.07.2012 01:34, Patrick Varilly wrote:
>> Alright, I've uploaded the last bit of cKDTree that was missing for it
>> to be functionally equivalent to KDTree.  As it stands, I think it's a
>> useful addition in its own right, so it would be nice if someone else
>> could look the code over and see if it can be merged in.
>> Over the coming weeks, I will look into the issues that Sturla has
>> brought up and see if I can make some progress on these.
> Your changes + mine:
> https://github.com/sturlamolden/scipy/blob/master/scipy/spatial/ckdtree.pyx
> Sturla
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

More information about the SciPy-Dev mailing list