Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython_plus_experiments
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
0
Merge Requests
0
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
Julien Jerphanion
cython_plus_experiments
Commits
b8f4a92c
Commit
b8f4a92c
authored
May 27, 2021
by
Julien Jerphanion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove debugging and add doc
parent
e519bcc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
kdtree/kdtree.pyx
kdtree/kdtree.pyx
+8
-8
kdtree/main.py
kdtree/main.py
+2
-2
No files found.
kdtree/kdtree.pyx
View file @
b8f4a92c
...
...
@@ -96,7 +96,6 @@ cdef cypclass Node activable:
self
.
n_dims
=
n_dims
if
(
depth
<
0
)
or
(
end
-
start
<=
1
):
printf
(
"build_node: Adding %d
\
n
"
,
end
-
start
)
self
.
counter
.
add
(
NULL
,
end
-
start
)
return
...
...
@@ -116,6 +115,10 @@ cdef cypclass Node activable:
mid
,
end
)
cdef
cypclass
Counter
activable
:
""" A simple Counter.
Useful for synchronisation, as it can be used as a barrier.
"""
I_t
n
...
...
@@ -125,12 +128,12 @@ cdef cypclass Counter activable:
self
.
_active_queue_class
=
consume
BatchMailBox
(
scheduler
)
void
add
(
self
,
I_t
value
):
printf
(
"Counter: Adding %d
\
n
"
,
value
)
self
.
n
+=
value
printf
(
"Counter: Current val: %d
\
n
"
,
self
.
n
)
void
reset
(
self
):
self
.
n
=
0
I_t
value
(
self
):
printf
(
"Counter: Getting %d
\
n
"
,
self
.
n
)
return
self
.
n
cdef
cypclass
KDTree
:
...
...
@@ -185,7 +188,7 @@ cdef cypclass KDTree:
global
scheduler
scheduler
=
Scheduler
()
self
.
initialised_vec_counter
=
activ
e
Counter
()
self
.
initialised_vec_counter
=
consum
e
Counter
()
self
.
root
=
consume
Node
(
self
.
initialised_vec_counter
)
if
self
.
root
is
NULL
:
printf
(
"Error consuming node
\
n
"
)
...
...
@@ -201,12 +204,9 @@ cdef cypclass KDTree:
initialised
=
self
.
initialised_vec_counter
.
value
(
NULL
).
getIntResult
()
printf
(
"Updated: %d / %d
\
n
"
,
initialised
,
self
.
n
)
while
(
initialised
<
self
.
n
):
initialised
=
self
.
initialised_vec_counter
.
value
(
NULL
).
getIntResult
()
printf
(
"Updated: %d / %d
\
n
"
,
initialised
,
self
.
n
)
printf
(
"!Updated: %d / %d
\
n
"
,
initialised
,
self
.
n
)
scheduler
.
finish
()
...
...
kdtree/main.py
View file @
b8f4a92c
...
...
@@ -2,11 +2,11 @@ import numpy as np
import
kdtree
if
__name__
==
"__main__"
:
n
,
d
=
1000000
,
2
n
,
d
=
1000000
,
10
golden_ratio
=
(
1
+
5
**
0.5
)
/
2
X
=
np
.
zeros
((
n
,
d
))
for
i
in
range
(
n
):
X
[
i
,
0
]
=
(
i
/
golden_ratio
)
%
1
X
[
i
,
1
]
=
i
/
n
tree
=
kdtree
.
KDTree
(
X
,
depth
=
10
)
tree
=
kdtree
.
KDTree
(
X
,
depth
=
2
)
del
tree
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