Popular recipes by Matteo Dell'Amico http://code.activestate.com/recipes/users/2433284/2010-12-23T12:51:27-08:00ActiveState Code Recipeskd-tree for nearest neighbor search in a k-dimensional space (Python)
2010-12-17T15:49:08-08:00Matteo Dell'Amicohttp://code.activestate.com/recipes/users/2433284/http://code.activestate.com/recipes/577497-kd-tree-for-nearest-neighbor-search-in-a-k-dimensi/
<p style="color: grey">
Python
recipe 577497
by <a href="/recipes/users/2433284/">Matteo Dell'Amico</a>
(<a href="/recipes/tags/nearest/">nearest</a>, <a href="/recipes/tags/neighbor/">neighbor</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/tree/">tree</a>).
Revision 5.
</p>
<p>The kd-tree can be used to organize efficient search for nearest neighbors in a k-dimensional space.</p>
An interval mapping data structure (Python)
2010-12-23T12:51:27-08:00Matteo Dell'Amicohttp://code.activestate.com/recipes/users/2433284/http://code.activestate.com/recipes/577515-an-interval-mapping-data-structure/
<p style="color: grey">
Python
recipe 577515
by <a href="/recipes/users/2433284/">Matteo Dell'Amico</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/interval/">interval</a>, <a href="/recipes/tags/mapping/">mapping</a>).
</p>
<p>This structure is a kind of dictionary which allows you to map data intervals to values. You can then query the structure for a given point, and it returns the value associated to the interval which contains the point. Boundary values don't need to be an integer.</p>
<p>In this version, the excellent <a href="http://pypi.python.org/pypi/blist/">blist</a> library by Daniel Stutzbach is used for efficiency. By using the collections.MutableMapping abstract base class, the whole signature of mappings is supported.</p>