Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iraikov/kdtree
KD tree implementation in Standard ML / MLton
https://github.com/iraikov/kdtree
kd-tree kdtree mlton spatial-index standard-ml
Last synced: about 2 months ago
JSON representation
KD tree implementation in Standard ML / MLton
- Host: GitHub
- URL: https://github.com/iraikov/kdtree
- Owner: iraikov
- License: other
- Created: 2013-05-30T23:46:41.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-07T21:57:03.000Z (about 8 years ago)
- Last Synced: 2024-10-19T17:44:12.059Z (3 months ago)
- Topics: kd-tree, kdtree, mlton, spatial-index, standard-ml
- Language: Standard ML
- Size: 50.8 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
kdtree
======Standard ML implementation of the K-d tree spatial indexing data structure.
http://en.wikipedia.org/wiki/K-d_treeThe k-d tree is a binary search tree in which every branching node
contains a k-dimensional point, and every leaf node contains a set of
points. Every branching node represents a splitting hyperplane that
divides the space into two parts, known as half-spaces.Points to the left of the splitting hyperplane are contained in the
left subtree of the node and points right of the hyperplane are
contained in the right subtree. The splitting hyperplane is chosen so
as to be perpendicular to one of the axes in the k-dimensional
space. The axis at each branching level is chosen in a round-robin
fashion. For instance, in 3-D space, at level 0, the chosen axis is X,
so points are divided according to their X-coordinates; at level 1,
the chosen axis is Y, so the points are divided according to their
Y-coordinates; at the next branch level the chosen axis is Z, and so
on.KDTREE -Signature-
type point
type kdtreeval empty: kdtree -> bool
Returns true if the given tree is empty, false otherwise.
val app: (point -> unit) -> kdtree -> unit
Applies the given procedure to every point in the tree.
val appi: (int * point -> unit) -> kdtree -> unit
Applies the given procedure to every point in the tree and its index.
val foldl: ((point * 'a) -> 'a) -> 'a -> kdtree -> 'a
val foldli: ((int * point * 'a) -> 'a) -> 'a -> kdtree -> 'a
val foldr: ((point * 'a) -> 'a) -> 'a -> kdtree -> 'a
val foldri: ((int * point * 'a) -> 'a) -> 'a -> kdtree -> 'aFolds over the tree.
val ifoldr: ((int * 'a) -> 'a) -> 'a -> kdtree -> 'a
Folds over the tree using only point indices.
val size: kdtree -> int
Returns the size of the tree.
val toList: kdtree -> point list
Returns the list of points contained in the tree.
val toIndexList: kdtree -> int list
Returns the list of points indices contained in the tree.
val fromTensor: RTensor.tensor -> kdtree
Given a tensor of dimensionality [N,K], constructs a KD-tree.
val nearestNeighbor: kdtree -> real list -> int option
val nearNeighbors: kdtree -> real -> real list -> int list
val remove: kdtree -> real -> real list -> kdtree
val kNearestNeighbors: kdtree -> int -> real list -> int list
KDtreeFn -Functor-
functor KDTreeFn (val K : int
val distanceSquared : (real list) * (real list) -> real): KDTREE