[SciPy-Dev] Enhancements to scipy.spatial.cKDTree
Sat Jul 14 06:17:52 CDT 2012
On Sat, Jul 14, 2012 at 7:54 AM, Sturla Molden <email@example.com> wrote:
> 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:
I took your edits and committed them as a diff to Patricks last commit.
Then I added a few style fixes:
https://github.com/rgommers/scipy/tree/fixes-sturla. The best way to get
this in would be for Patrick to add these commits to his branch so they
show up in his PR (after finding a bug, see below).
I did some testing (python 2.6, 32-bit, OS X 10.6), I get one test failure
with Sturla's edits. Patrick's branch given me no failures.
Traceback (most recent call last):
line 197, in runTest
line 496, in test_multiple_radius
assert_equal(self.T1.count_neighbors(self.T2, r), result)
File "/Users/rgommers/Code/numpy/numpy/testing/utils.py", line 313, in
Items are not equal:
The actual and desired numbers change due to random numbers without a seed
being used, but it fails consistently. The missing seed is no real problem
here, because the code simply does the same twice; it only tests if the "r"
input to count_neighbors is correctly vectorized.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-Dev