[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[task #15713] Make quad structure to make unique hashes of 4 objects
From: |
Mohammad Akhlaghi |
Subject: |
[task #15713] Make quad structure to make unique hashes of 4 objects |
Date: |
Fri, 17 Jul 2020 20:36:25 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Follow-up Comment #20, task #15713 (project gnuastro):
Thanks for a nice review of the problem Sachin.
I think I understood the problem, but since my knowledge of kd-trees is very
general and not yet as detailed as yours, please look at the following reply
critically and feel free to correct any mis-understanding you may find ;-).
Given that you already know the number of points you want to put into the
kd-tree before hand, pre-allocating the array/space before the hashes does
generally seem like a good option.
In fact, in Gnuastro, I have done this in several places (for simply-linked
lists
<https://www.gnu.org/software/gnuastro/manual/html_node/Linked-lists.html>):
when I already know the total number of nodes in the list, I just allocate
space once at the start for all of them, then write the values as they come
in. In the end, I also just have to "free" one allocated space! This is also
more efficient than allocating space for each node individually at different
times, because each allocation/free-ing is itself computationally costly.
On a side-note, it would be interesting to see how astrometry.net implements
its kd-tree.
Just one extra thing: try to keep the kd-tree related functions and structure
nicely separate from this particular problem and modular (ideally in a
separate .c and .h file). In this way, we can later generalize the kd-tree
solution for other problems too ;-).
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/task/?15713>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [task #15713] Make quad structure to make unique hashes of 4 objects, (continued)
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/11
- [task #15713] Make quad structure to make unique hashes of 4 objects, Raul Infante-Sainz, 2020/07/14
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/14
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/14
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/15
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/16
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/16
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/16
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/16
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/17
- [task #15713] Make quad structure to make unique hashes of 4 objects,
Mohammad Akhlaghi <=
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/18
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/18
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/28
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/28
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/29
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/30
- [task #15713] Make quad structure to make unique hashes of 4 objects, Mohammad Akhlaghi, 2020/07/30
- [task #15713] Make quad structure to make unique hashes of 4 objects, Sachin Kumar Singh, 2020/07/31
- [task #15713] Make quad structure with hashes and store in kd-tree, Mohammad Akhlaghi, 2020/07/31