Math::Vector::Real::Neighbors - find nearest neighbor for a set of points
use Math::Vector::Real 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.
Note: currently the
neighbors method is just a thin wrapper for the neighbor look-up algorithm provided in Math::Vector::Real::kdTree which is a couple of orders of magnitude faster than the old one formerly used here.
Two methods are currently available:
- @ixs = Math::Vector::Real::Neighbors->neighbors(@p)
Given a set of points returns the indexes on the set for the nearest neighbor for every point.
- @ixs = Math::Vector::Real::Neighbors->neighbors_bruteforce(@p)
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.
COPYRIGHT AND LICENSE
Copyright (C) 2011, 2014 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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 161:
Unterminated B<...> sequence