Subject: | Output array contains wrong number of colors in some cases |
Date: | Sat, 14 May 2016 16:17:21 +0200 |
To: | bug-Math-Gradient [...] rt.cpan.org |
From: | Walter Thyselius <walter.thyselius [...] gmail.com> |
Very old module, but anyway... Running this code:
use Math::Gradient qw(multi_gradient multi_array_gradient);
# Ugly POC: wrong # of colors in output array
my @hot_spots = ([0,0,0]);
print " Steps =>";
for my $g (2 .. 10) {
printf("%4i ", $g);
}
print "\n";
for my $i (1 .. 10) {
printf("Values %2i: ", $i+1);
push @hot_spots, [$i,$i,$i];
for my $g (2 .. 10) {
my (@gradient) = multi_array_gradient($g, @hot_spots);
printf("%4i%s", $#gradient+1, ($g!=$#gradient+1)?"!":" ");
}
print "\n";
}
exit;
Gives (I hope the fixed width font is preserved):
Steps => 2 3 4 5 6 7 8 9 10
Values 2: 2 3 4 5 6 7 8 9 10
Values 3: 2 3 4 5 6 7 8 9 10
Values 4: 3! 3 4 5 5! 7 7! 9 10
Values 5: 2 3 4 5 6 7 8 9 10
Values 6: 2 4! 4 5 6 7 8 8! 10
Values 7: 2 4! 4 5 7! 7 7! 9 10
Values 8: 3! 4! 5! 5 7! 8! 8 8! 9!
Values 9: 2 3 4 5 6 7 8 9 10
Values 10: 3! 3 5! 5 7! 7 8 9 10
Values 11: 3! 3 5! 6! 6 7 9! 9 11!
Numbers marked "!" are when the output array contains wrong number of
colors.
I have not investigated why.
Best regards,
Walter