"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Libtmp/Image2D/t/image2d.t" between
PDL-2.080.tar.gz and PDL-2.081.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

image2d.t  (PDL-2.080):image2d.t  (PDL-2.081)
skipping to change at line 17 skipping to change at line 17
my $mask = pdl( my $mask = pdl(
[[0,0,0,0,0],[0,0,1,1,0],[0,0,0,0,0],[0,0,1,1,0],[0,0,0,0,0]], [[0,0,0,0,0],[0,0,1,1,0],[0,0,0,0,0],[0,0,1,1,0],[0,0,0,0,0]],
[[0,0,0,0,0],[0,1,0,1,0],[0,0,1,1,0],[0,0,0,0,0],[0,0,0,0,0]], [[0,0,0,0,0],[0,1,0,1,0],[0,0,1,1,0],[0,0,0,0,0],[0,0,0,0,0]],
); );
my $crops = pdl(indx, my $crops = pdl(indx,
[2,3,1,3], [2,3,1,3],
[1,3,1,2], [1,3,1,2],
); );
my $got = crop($mask->slice(':,:,(1)')); my $got = crop($mask->slice(':,:,(1)'));
diag $got;
ok all($got == $crops->slice(':,(1)')), 'mask non-broadcast' or diag "got=$got"; ok all($got == $crops->slice(':,(1)')), 'mask non-broadcast' or diag "got=$got";
$got = crop($mask); $got = crop($mask);
ok all($got == $crops), 'mask broadcast' or diag "got=$got"; ok all($got == $crops), 'mask broadcast' or diag "got=$got";
my $ans = pdl( my $ans = pdl(
[ 3, 7, 11, 21, 27, 33, 39, 45, 51, 27], [ 3, 7, 11, 21, 27, 33, 39, 45, 51, 27],
[ 3, 5, 13, 21, 27, 33, 39, 45, 51, 27], [ 3, 5, 13, 21, 27, 33, 39, 45, 51, 27],
[ 3, 9, 15, 21, 27, 33, 39, 45, 51, 27] [ 3, 9, 15, 21, 27, 33, 39, 45, 51, 27]
); );
skipping to change at line 98 skipping to change at line 97
} }
{ {
# conv2d: boundary => truncate # conv2d: boundary => truncate
my $ans = pdl ([8,15,12],[21,36,27],[20,33,24]); my $ans = pdl ([8,15,12],[21,36,27],[20,33,24]);
ok all( approx( conv2d($pb,$pa,{Boundary => 'Truncate'}), $ans )), "conv2d trunc ate"; #5 ok all( approx( conv2d($pb,$pa,{Boundary => 'Truncate'}), $ans )), "conv2d trunc ate"; #5
} }
} }
{ {
my $realmask=ones(3,3)/9;
my $realseq=sequence(3,3);
my $imagmask=$realmask*i();
my $imagseq=$realseq*i();
my $real_exp = <<EOF;
\n[
[4 4 4]
[4 4 4]
[4 4 4]
]
EOF
my $neg_exp = <<EOF;
\n[
[-4 -4 -4]
[-4 -4 -4]
[-4 -4 -4]
]
EOF
my $imag_exp = <<EOF;
\n[
[4i 4i 4i]
[4i 4i 4i]
[4i 4i 4i]
]
EOF
is $realseq->conv2d($realmask).'', $real_exp, "Real matrix real mask";
is $imagseq->conv2d($realmask).'', $imag_exp, "Imag matrix real mask";
is $realseq->conv2d($imagmask).'', $imag_exp, "Real matrix imag mask";
is $imagseq->conv2d($imagmask).'', $neg_exp, "Imag matrix imag mask";
}
{
# max2d_ind # max2d_ind
my $pa = 100 / (1.0 + rvals(5,5)); my $pa = 100 / (1.0 + rvals(5,5));
$pa = $pa * ( $pa < 90 ); $pa = $pa * ( $pa < 90 );
my @ans = $pa->max2d_ind(); my @ans = $pa->max2d_ind();
note "max2d_ind: " . join( ',', @ans ) . "\n"; note "max2d_ind: " . join( ',', @ans ) . "\n";
ok( ($ans[0] == 50) & ($ans[1] == 1) & ($ans[2] == 2), "max2d_ind" ); ok( ($ans[0] == 50) & ($ans[1] == 1) & ($ans[2] == 2), "max2d_ind" );
} }
{ {
# centroid2d # centroid2d
 End of changes. 2 change blocks. 
1 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)