Algorithm-KNN-XS
view release on metacpan or search on metacpan
t/03lib_ann_interface.t view on Meta::CPAN
use strict;
use warnings;
use Data::Dumper;
use Algorithm::KNN::XS;
use Test::More tests => 119;
my @points = (
[1.1345, 2.657],
[4.023, 5.2389],
[7.589, 8.124],
[6.89, 11.065],
[8.1954, 12.785],
[9.723, 13.357],
[10.285, 14.1435],
);
my $tree_print_header = "ANN Version 1.1.2\n";
my $tree_dump_header = "#ANN 1.1.2\n";
my $tree_print_points = " Points:
0: 1.1345 2.657
1: 4.023 5.2389
2: 7.589 8.124
3: 6.89 11.065
4: 8.1954 12.785
5: 9.723 13.357
6: 10.285 14.1435\n";
my $tree_dump_points = "points 2 7
0 1.1345 2.657
1 4.023 5.2389
2 7.589 8.124
3 6.89 11.065
4 8.1954 12.785
5 9.723 13.357
6 10.285 14.1435\n";
my @tree_print_structure = (
" ........Leaf n=1 <6>
......Split cd=0 cv=9.723 lbnd=6.89 hbnd=10.285
........Leaf n=1 <5>
....Split cd=1 cv=12.785 lbnd=8.40025 hbnd=14.1435
......Leaf n=1 <4>
..Split cd=0 cv=6.89 lbnd=1.1345 hbnd=10.285
....Leaf n=1 <3>
Split cd=1 cv=8.40025 lbnd=2.657 hbnd=14.1435
....Leaf n=1 <2>
..Split cd=0 cv=5.70975 lbnd=1.1345 hbnd=10.285
......Leaf n=1 <1>
....Split cd=1 cv=5.2389 lbnd=2.657 hbnd=8.40025
......Leaf n=1 <0>\n",
" ....Leaf (trivial)
..Shrink
([0]>=6.89) ([1]>=11.065)
........Leaf (trivial)
......Shrink
([0]>=9.723) ([1]>=13.357)
..........Leaf n=1 <6>
........Split cd=1 cv=13.7502 lbnd=13.357 hbnd=14.1435
..........Leaf n=1 <5>
....Split cd=0 cv=8.5875 lbnd=6.89 hbnd=10.285
........Leaf n=1 <4>
......Split cd=1 cv=12.6043 lbnd=11.065 hbnd=14.1435
( run in 2.317 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )