Skip to content

Commit c6e1791

Browse files
authored
Merge pull request #22 from mortacious/bugfix/flipped_compact_balanced
Bugfix/flipped compact balanced
2 parents edd7393 + 8275527 commit c6e1791

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

numba_kdtree/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

numba_kdtree/kd_tree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def KDTree(data: DataArray, leafsize: int = 10, compact: bool = False, balanced:
473473

474474
idx = np.arange(n_data, dtype=INT_TYPE)
475475

476-
kdtree = _make_kdtree(data, root_bbox, idx, leafsize, compact, balanced)
476+
kdtree = _make_kdtree(data, root_bbox, idx, leafsize, balanced, compact)
477477
return kdtree
478478

479479

@@ -511,7 +511,7 @@ def KDTree_impl(data, leafsize=10, compact=False, balanced=False, root_bbox=None
511511

512512
idx = np.arange(n_data, dtype=INT_TYPE)
513513

514-
kdtree = _make_kdtree(data, root_bbox, idx, leafsize, compact, balanced)
514+
kdtree = _make_kdtree(data, root_bbox, idx, leafsize, balanced, compact)
515515

516516
return kdtree
517517

tests/test_kdtree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ def query_numba_parallel(data, kdtree, k):
242242

243243
def test_construct_in_numba_function(data):
244244
@nb.njit(nogil=True, fastmath=True)
245-
def construct_kdtree_in_numba(data):
246-
kdtree = KDTree(data, leafsize=10)
245+
def construct_kdtree_in_numba(data, compact=False, balanced=False):
246+
kdtree = KDTree(data, leafsize=10, compact=compact, balanced=balanced)
247247
return kdtree
248248

249249
num_executions = 10
250-
runtime_kdtree_numba = timeit(lambda: construct_kdtree_in_numba(data),
250+
runtime_kdtree_numba = timeit(lambda: construct_kdtree_in_numba(data, compact=True, balanced=True),
251251
number=num_executions) / num_executions
252252

253253
runtime_kdtree_python = timeit(lambda: KDTree(data), number=num_executions) / num_executions

0 commit comments

Comments
 (0)