Math::Vector::Real::Neighbors - find nearest neighbor for a set of points
use Math::Vector::Real::Neighbors; use Math::Vector::Real::Random; my @v = map Math::Vector::Real->random_normal(2), 0..1000; my @nearest_ixs = Math::Vector::Real::Neighbors->neighbors(@v);
This module is able to find for every point in a given set its nearest neighbour from the same set.
Two methods are currently available:
Given a set of points returns the indexes on the set for the nearest neighbor for every point.
Does the same using a brute force algorithm. This method is mostly for testing purposes.
The wikipedia entry for Nearest Neighbor Search http://en.wikipedia.org/wiki/Nearest_neighbor_search.
<image src="http://cloud.github.com/downloads/salva/p5-Math-Vector-Real-Neighbors/nearest_neighbors.png" alt="some nearest neighbor graphical representation" width="1000" heigh="1000"></image>
Copyright (C) 2011 by Salvador Fandiño <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.