Subject: | Bug report |
Date: | Fri, 15 Feb 2013 00:55:47 +0000 |
To: | "bug-Math-Vector-Real-kdTree [...] rt.cpan.org" <bug-Math-Vector-Real-kdTree [...] rt.cpan.org> |
From: | "Bronevetsky, Greg" <bronevetsky1 [...] llnl.gov> |
I'm trying to use Math::Vector::Real::kdTree with Perl 5.14.2 to insert a sequence of 1-dimensional vectors with increasing values. As you can see, many of the values that I'm inserting do not appear in the output of ordered_by_proximity(). Further, they do not appear in the output of find_in_ball().
Code:
#!/usr/bin/perl
use strict;
package cm;
use Math::Vector::Real::kdTree;
my $tree = Math::Vector::Real::kdTree->new();
for(my $i=0; $i<40; $i++) {
$tree->insert(Math::Vector::Real->new($i));
print "$i:";
my @all = $tree->ordered_by_proximity();
foreach my $v (sort {$a <=> $b} @all)
{ print " $v"; }
print "\n";
}
Result:
0: 0
1: 0 1
2: 0 1 2
3: 0 1 2 3
4: 0 1 2 3 4
5: 0 1 2 3 4 5
6: 0 1 2 3 4 5 6
7: 0 1 2 3 4 5 6 7
8: 0 1 2 3 4 5 6 7 8
9: 0 1 2 3 4 5 6 7 8 9
10: 0 1 2 3 4 5 6 7 8 9 10
11: 0 1 2 3 4 5 6 7 8 9 10 11
12: 0 1 2 3 4 5 6 7 8 9 10 11 12
13: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
14: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
15: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
18: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
19: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
20: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
22: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
23: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
24: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
25: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
26: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
27: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
28: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
29: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
30: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
31: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31
32: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32
33: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33
34: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34
35: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34 35
36: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34 35 36
37: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34 35 36 37
38: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34 35 36 37
39: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 32 33 34 35 36 37
Greg Bronevetsky
Lawrence Livermore National Lab
(925) 424-5756
bronevetsky@llnl.gov<mailto:bronevetsky@llnl.gov>
http://greg.bronevetsky.com