Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hypertiling
hypertiling
Commits
7f0d7766
Commit
7f0d7766
authored
Nov 10, 2021
by
Manuel Schrauth
Browse files
provide flag for starting indices at zero
parent
e3b89c85
Changes
1
Hide whitespace changes
Inline
Side-by-side
hypertiling/neighbours.py
View file @
7f0d7766
...
...
@@ -2,7 +2,7 @@ import numpy as np
from
.distance
import
weierstrass_distance
# wrapper to provide a nicer interface
def
find
(
tiling
,
nn_dist
=
None
,
which
=
"optimized_slice"
,
verbose
=
False
):
def
find
(
tiling
,
nn_dist
=
None
,
which
=
"optimized_slice"
,
index_from_zero
=
True
,
verbose
=
False
):
if
nn_dist
==
None
:
if
verbose
:
...
...
@@ -21,6 +21,16 @@ def find(tiling, nn_dist=None, which="optimized_slice", verbose=False):
print
(
"[Hypertiling] Error:"
,
which
,
" is not a valid algorithm!"
)
nbrs
=
[]
if
index_from_zero
:
for
sublist
in
retval
:
new_sublist
=
[
x
-
1
for
x
in
sublist
]
nbrs
.
append
(
new_sublist
)
return
nbrs
else
:
return
retval
# find nearest neighbours by brute force comparison of all-to-all distances
...
...
Write
Preview
Supports
Markdown
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