Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the kd_tree need SIZE and MAX_LEVEL? #21

Open
wucke13 opened this issue Nov 25, 2021 · 5 comments
Open

Does the kd_tree need SIZE and MAX_LEVEL? #21

wucke13 opened this issue Nov 25, 2021 · 5 comments
Assignees

Comments

@wucke13
Copy link
Member

wucke13 commented Nov 25, 2021

  1. Is there a way to express the one through the other?
  2. Is there a significant performance hit when SIZE is rather an attribute of Tree?
  3. Same question re when MAX_LEVEL is an attribute of Tree?
  4. If the const generics stay, can we use something like static_assertions to ensure that they are not set wrongly (e.g. SIZE=1024, MAX_LEVEL=9)?
@sevenautumns
Copy link
Collaborator

Is there a way to express the one through the other?

Not as long as we can not use const generics to calculate the size of arrays at compile time

Is there a significant performance hit when SIZE is rather an attribute of Tree?

We are not in no_std anymore, should we make it an attribute because we cant allocate arrays from attributes

If the const generics stay, can we use something like static_assertions to ensure that they are not set wrongly (e.g. SIZE=1024, MAX_LEVEL=9)?

Yes

@sevenautumns
Copy link
Collaborator

@wucke13 I am fairly certain, we could get around SIZE as a const generic but not around MAX_LEVEL.
Doing this would enable us to test and benchmark the search function with different tree sizes up to an maximum of 2^(MAX_LEVEL) nodes

@wucke13
Copy link
Member Author

wucke13 commented Nov 26, 2021

That sounds good!

sevenautumns added a commit that referenced this issue Nov 26, 2021
@sevenautumns
Copy link
Collaborator

With this only MAX_LEVEL remains. I do not think there is any way of verifying that MAX_LEVEL is correct at compile time.

@sevenautumns
Copy link
Collaborator

For a given MAX_LEVEL the maximal length of the given Node-Array is 2^(MAX_LEVEL) - 1

wucke13 pushed a commit that referenced this issue Nov 26, 2021
wucke13 added a commit that referenced this issue Nov 26, 2021
+ add nicer error message if `airports.json` doesn't exist
+ remove `SIZE` const generic from Tree
wucke13 pushed a commit that referenced this issue Nov 26, 2021
This reverts commit 9bf8d19.
wucke13 added a commit that referenced this issue Nov 26, 2021
+ add nicer error message if `airports.json` doesn't exist
+ remove `SIZE` const generic from Tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants