Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kdtree
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cython-plus
kdtree
Commits
228d5de5
Commit
228d5de5
authored
Nov 02, 2021
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct comments
parent
bccfff3d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
kdtree.pyx
kdtree.pyx
+26
-26
No files found.
kdtree.pyx
View file @
228d5de5
...
...
@@ -76,7 +76,7 @@ cdef cypclass Counter activable:
This can be useful for synchronisation for the caller after
triggering the actors logic as it wait for the value of
the Cou
tn
er to reach a given one before moving on.
the Cou
nt
er to reach a given one before moving on.
"""
I_t
_n
...
...
@@ -332,7 +332,7 @@ cdef cypclass NeighborsHeap activable:
cdef
cypclass
Node
activable
:
"""A KDTree Node
Node delegate tasks to their children Nodes.
Node delegate
s
tasks to their children Nodes.
Some Nodes are set as Leaves when they are associated
to ``leaf_size`` or less points.
...
...
@@ -396,19 +396,19 @@ cdef cypclass Node activable:
if
(
end
-
start
<=
leaf_size
):
self
.
_is_leaf
=
True
# Adding to the global counter the number
# of samples the leaf is responsible of
# of samples the leaf is responsible of
.
counter
.
add
(
NULL
,
end
-
start
)
return
# We partition the samples in two nodes on a given dimension,
# with the middle point as a pivot
# with the middle point as a pivot
.
partition_node_indices
(
data_ptr
,
indices_ptr
,
start
,
mid
,
end
,
dim
,
n_dims
)
self
.
_point
=
data_ptr
+
mid
self
.
_left
=
consume
Node
()
self
.
_right
=
consume
Node
()
# Recursing on both partition
# Recursing on both partition
s.
self
.
_left
.
build_node
(
NULL
,
data_ptr
,
indices_ptr
,
leaf_size
,
n_dims
,
next_dim
,
...
...
@@ -429,7 +429,7 @@ cdef cypclass Node activable:
D_t
tmp
if
self
.
_is_leaf
:
# Computing all the euclideans distances here
# Computing all the euclideans distances here
.
for
j
in
range
(
self
.
_start
,
self
.
_end
):
dist
=
0
for
k
in
range
(
self
.
_n_dims
):
...
...
@@ -439,13 +439,13 @@ cdef cypclass Node activable:
)
dist
+=
tmp
*
tmp
# The heap is
doing the smart work of keeping
#
the closest points for each query point i
# The heap is
responsible for keeping the closest
#
points for each query point i.
heaps
.
push
(
NULL
,
i
,
dist
,
self
.
_indices_ptr
[
j
])
return
# TODO: one can implement a pruning strategy here
# TODO: one can implement a pruning strategy here
.
self
.
_left
.
query
(
NULL
,
query_points
,
i
,
heaps
)
self
.
_right
.
query
(
NULL
,
query_points
,
i
,
heaps
)
...
...
@@ -509,7 +509,7 @@ cdef cypclass KDTree:
# When object are activated (set as Actors), methods
# are reified. When using those reified methods
# a new argument is prepredend for a predicate,
# which we aren't using
using
here, hence the extra NULL.
# which we aren't using here, hence the extra NULL.
#
# Also using this separate method allowing using actors
# because __init__ can't be reified.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment