Commit 00be98d2 authored by Julien Jerphanion's avatar Julien Jerphanion

[DEBUG] Query

parent 5951d2e3
...@@ -518,6 +518,13 @@ cdef cypclass Node activable: ...@@ -518,6 +518,13 @@ cdef cypclass Node activable:
cdef cypclass QueryActor: cdef cypclass QueryActor:
I_t idx_worker
I_t idx_start
I_t idx_end
KDTree tree
D_t * query_points
NeighborsHeaps heaps
__init__( __init__(
self, self,
D_t * query_points, D_t * query_points,
...@@ -527,16 +534,23 @@ cdef cypclass QueryActor: ...@@ -527,16 +534,23 @@ cdef cypclass QueryActor:
I_t idx_start, I_t idx_start,
I_t idx_end, I_t idx_end,
): ):
printf("QueryActor: (%d, %d, %d)\n", idx_worker, idx_start, idx_end) self.idx_worker = idx_worker
cdef I_t idx_pt self.idx_start = idx_start
cdef D_t * query_point self.idx_end = idx_end
cdef D_t reduced_dist_LB self.tree = tree
self.query_points = query_points
self.heaps = heaps
int query(self) except -1:
cdef:
I_t idx_pt
D_t * query_point
D_t reduced_dist_LB
for idx_pt in range(idx_start, idx_end): for idx_pt in range(idx_start, idx_end):
printf("query %d\n", idx_pt) query_point = self.query_points + idx_pt * self.tree._n_features
query_point = query_points + idx_pt * tree._n_features reduced_dist_LB = self.tree.min_rdist(0, query_point)
reduced_dist_LB = tree.min_rdist(0, query_point) self._query_single_depthfirst(self.tree, 0, self.query_points, idx_pt, self.heaps, reduced_dist_LB)
self._query_single_depthfirst(tree, 0, query_points, idx_pt, heaps, reduced_dist_LB)
int _query_single_depthfirst(self, int _query_single_depthfirst(self,
KDTree tree, KDTree tree,
...@@ -736,6 +750,7 @@ cdef cypclass KDTree: ...@@ -736,6 +750,7 @@ cdef cypclass KDTree:
n_points_worker * idx_worker, n_points_worker * idx_worker,
min(n_points_worker * (idx_worker + 1), n_query), min(n_points_worker * (idx_worker + 1), n_query),
) )
query_actor.query()
heaps.sort() heaps.sort()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment