I&#39;m not sure 20 dimensions is such a good idea, 2mb shared object file?  that does sound excessive.   Maybe instead, just do a reasonable number of dimensions and document how to increase the number for those who need more?<br>

<br><div class="gmail_quote">2009/3/21 Willi Richert <span dir="ltr">&lt;<a href="mailto:w.richert@gmx.net">w.richert@gmx.net</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi,<br>
<br>
here they are.<br>
<br>
Regards,<br>
wr<br>
<div><div></div><div class="h5"><br>
On Freitag 20 März 2009 18:29:55 Willi Richert wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; nice to hear. So stay tuned. I have just finished my template based swig<br>
&gt; system that creates dim \in [1,20] for (int, float). I think that nobody<br>
&gt; will use NN for more than 20 dimensions. Nevertheless the stuff then gets<br>
&gt; quite big:<br>
&gt;<br>
&gt; -rw-r--r-- 1 wr wr     756 2009-03-20 13:03 CMakeLists.txt<br>
&gt; -rwxr-xr-x 1 wr wr    8754 2009-03-20 18:27 gen-swig-hpp.py<br>
&gt; -rw-r--r-- 1 wr wr   54260 2009-03-20 18:27 kdtree.py<br>
&gt; -rw-r--r-- 1 wr wr    4822 2009-03-20 18:27 kdtree.pyc<br>
&gt; -rwxr-xr-x 1 wr wr 2119152 2009-03-20 18:28 _kdtree.so<br>
&gt; -rw-r--r-- 1 wr wr    1328 2009-03-20 18:20 Makefile<br>
&gt; -rw-r--r-- 1 wr wr   51603 2009-03-20 18:27 py-kdtree.hpp<br>
&gt; -rw-r--r-- 1 wr wr    4054 2009-03-20 18:09 py-kdtree.hpp.tmpl<br>
&gt; -rw-r--r-- 1 wr wr  130817 2009-03-20 18:27 py-kdtree.i<br>
&gt; -rw-r--r-- 1 wr wr     380 2009-03-20 16:54 py-kdtree.i.tmpl<br>
&gt; -rw-r--r-- 1 wr wr    2808 2009-03-20 13:03 py-kdtree_test.cpp<br>
&gt; -rw-r--r-- 1 wr wr   15353 2009-03-20 18:13 py-kdtree_test.py<br>
&gt; -rw-r--r-- 1 wr wr   18796 2009-03-20 18:17 py-kdtree_test.pyc<br>
&gt; -rw-r--r-- 1 wr wr 1146062 2009-03-20 18:27 py-kdtree_wrap.cxx<br>
&gt; -rw-r--r-- 1 wr wr 2386768 2009-03-20 18:28 py-kdtree_wrap.o<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Regards,<br>
&gt; wr<br>
&gt;<br>
&gt; On Freitag 20 März 2009 18:24:16 Michal J. Gajda wrote:<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; Indeed KD-tree data structure seems designed to use &#39;taxi-cab&#39; metric<br>
&gt; &gt; instead of euclidean metric. That&#39;s why I used the same distance type as<br>
&gt; &gt; COORD_T in my patch.<br>
&gt; &gt; I work around this in my code by filtering points with euclidean distance<br>
&gt; &gt; afterwards.<br>
&gt; &gt;<br>
&gt; &gt; On the other hand I would love to beta test code for other dimensions<br>
&gt; &gt; than 1f, 3f, and 6f. For now I&#39;ve got surprising result of 3f projection<br>
&gt; &gt; being faster for 20k points than 6f one. It may be because runtime grows<br>
&gt; &gt; as O(2^dim*log(n)). It may be that nobody has enough points to usefully<br>
&gt; &gt; exploit anything beyond 10D? --<br>
&gt; &gt;   Best regards<br>
&gt; &gt;     Michal<br>
&gt; &gt;<br>
&gt; &gt; -original message-<br>
&gt; &gt; Subject: Re: Python bindings for libkdtree: FIX of find_within_range...<br>
&gt; &gt; From: Paul Harris &lt;<a href="mailto:paulharris@computer.org">paulharris@computer.org</a>&gt;<br>
&gt; &gt; Date: 20-03-2009 15:15<br>
&gt; &gt;<br>
&gt; &gt; Hrm.<br>
&gt; &gt;<br>
&gt; &gt; It may be the same reason that find_within_range() would return 4 as<br>
&gt; &gt; well.<br>
&gt; &gt;<br>
&gt; &gt; See email in archives, subject &quot;Accuracy of libkdtree&quot;, 29 Jan 2009.<br>
&gt; &gt;<br>
&gt; &gt; This will need to be confirmed, I&#39;ll put it on my list to try and do<br>
&gt; &gt; asap. My theory is that it may only be checking in each dimension<br>
&gt; &gt; individually (a Manhattan distance check), and not doing a final<br>
&gt; &gt; Euclidean distance check. That would be my initial guess.   I&#39;m not sure<br>
&gt; &gt; what the logic would be behind that, maybe just speed.  Anyway enough<br>
&gt; &gt; guess-work, next step is to confirm.<br>
&gt; &gt;<br>
&gt; &gt; If anyone wants to step up and figure out what is going on, and to have<br>
&gt; &gt; some input into what should be done about it, be my guest :)<br>
&gt; &gt;<br>
&gt; &gt; cheers,<br>
&gt; &gt; Paul<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; 2009/3/20 Willi Richert &lt;<a href="mailto:w.richert@gmx.net">w.richert@gmx.net</a>&gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; alright, I can do that.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; However, I just found out that the range measurement is somehow<br>
&gt; &gt; &gt; &quot;illogic&quot;:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;    def test_count_within_range(self):<br>
&gt; &gt; &gt;        nn = KDTree_2Int()<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;        for p in [(0,0), (1,0), (0,1), (1,1)]:<br>
&gt; &gt; &gt;             nn.add((p, id(p)))<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;         res = nn.count_within_range((0,0), 1.0)<br>
&gt; &gt; &gt;        self.assertEqual(3, res, &quot;Counted %i points instead of %i&quot;%(res,<br>
&gt; &gt; &gt; 3))<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;         res = nn.count_within_range((0,0), 1.9)<br>
&gt; &gt; &gt;         self.assertEqual(4, res, &quot;Counted %i points instead of<br>
&gt; &gt; &gt; %i&quot;%(res, 4))<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; libkdtree_new/python-bindings&gt; python -m unittest<br>
&gt; &gt; &gt; py-kdtree_test.KDTree_2IntTestCase.test_count_within_range<br>
&gt; &gt; &gt; F<br>
&gt; &gt; &gt; ======================================================================<br>
&gt; &gt; &gt; FAIL: test_count_within_range (py-kdtree_test.KDTree_2IntTestCase)<br>
&gt; &gt; &gt; ----------------------------------------------------------------------<br>
&gt; &gt; &gt; Traceback (most recent call last):<br>
&gt; &gt; &gt;  File &quot;py-kdtree_test.py&quot;, line 110, in test_count_within_range<br>
&gt; &gt; &gt;     self.assertEqual(3, res, &quot;Counted %i points instead of %i&quot;%(res,<br>
&gt; &gt; &gt; 3)) AssertionError: Counted 4 points instead of 3<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; ----------------------------------------------------------------------<br>
&gt; &gt; &gt; Ran 1 test in 0.001s<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Any suggestion why that is the case? The point (1,1) should not be<br>
&gt; &gt; &gt; counted as its distance to (0,0) is sqrt(2)&gt;1.0<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; wr<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Freitag 20 März 2009 11:56:16 Paul Harris wrote:<br>
&gt; &gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; 2009/3/20 Willi Richert &lt;<a href="mailto:w.richert@gmx.net">w.richert@gmx.net</a>&gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; One more thing: The current state of having one explicit template<br>
&gt; &gt; &gt; &gt; &gt; realization<br>
&gt; &gt; &gt; &gt; &gt; in the python/swig part annoys me a little bit. Some weeks ago<br>
&gt; &gt; &gt; &gt; &gt; there<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; was<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; a discussion on the ML about whether or not dynamically supporting<br>
&gt; &gt; &gt; &gt; &gt; the specification of the dimension and type. How is the status<br>
&gt; &gt; &gt; &gt; &gt; here, Paul?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; If<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; you<br>
&gt; &gt; &gt; &gt; &gt; have decided against it, I will provide a python file that<br>
&gt; &gt; &gt; &gt; &gt; generates&lt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; all<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; the<br>
&gt; &gt; &gt; &gt; &gt; stuff for float, double and int for dim \in [1, .., 20]. That will<br>
&gt; &gt; &gt; &gt; &gt; ease the maintenance a lot.  In the other case the situation for<br>
&gt; &gt; &gt; &gt; &gt; the python bindings will be much smoother. But the performance will<br>
&gt; &gt; &gt; &gt; &gt; maybe suffer. Can you shed some light on this decision, Paul?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Its still on the list, but I haven&#39;t had the time to do anything on<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; kdtree<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; for a while now, so i&#39;m just focusing pushing through bug fixes to<br>
&gt; &gt; &gt; &gt; ensure that the results are correct.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I would guess it&#39;ll be at least a month before I can do anything,<br>
&gt; &gt; &gt; &gt; unless<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; manage to find a small random window of time where I can attack that<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; issue.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Would it be too much to ask if you write the python file that<br>
&gt; &gt; &gt; &gt; generates<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; all<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; the variants, and then we can do the dynamic version later?  I don&#39;t<br>
&gt; &gt; &gt; &gt; know how much work that would involve, if its not too much then I<br>
&gt; &gt; &gt; &gt; would prefer if you set yourself up with a low-maintenance solution<br>
&gt; &gt; &gt; &gt; first.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; cheers,<br>
&gt; &gt; &gt; &gt; Paul<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; libkdtree-devel mailing list<br>
&gt; <a href="mailto:libkdtree-devel@lists.alioth.debian.org">libkdtree-devel@lists.alioth.debian.org</a><br>
&gt; <a href="http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel" target="_blank">http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel</a><br>
<br>
</blockquote></div><br>