Salvador Fandiño García > Math-Vector-Real-Neighbors > Math::Vector::Real::Neighbors

Download:
Math-Vector-Real-Neighbors-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Math::Vector::Real::Neighbors - find nearest neighbor for a set of points

SYNOPSIS ^

  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);

DESCRIPTION ^

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.

API

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.

SEE ALSO ^

Math::Vector::Real.

The wikipedia entry for Nearest Neighbor Search http://en.wikipedia.org/wiki/Nearest_neighbor_search.

http://cloud.github.com/downloads/salva/p5-Math-Vector-Real-Neighbors/nearest_neighbors.png

some nearest neighbor graphical representation

COPYRIGHT AND LICENSE ^

Copyright (C) 2011, 2014 by Salvador Fandiño <sfandino@yahoo.com>

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.

syntax highlighting: