"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/ops.t" between
PDL-2.078.tar.gz and PDL-2.079.tar.gz

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

ops.t  (PDL-2.078):ops.t  (PDL-2.079)
skipping to change at line 23 skipping to change at line 23
&& PDL::Core::Dev::got_complex_version('exp', 1); && PDL::Core::Dev::got_complex_version('exp', 1);
approx(pdl(0), pdl(0), 0.01); # set eps approx(pdl(0), pdl(0), 0.01); # set eps
{ {
my $pa = xvals zeroes 3,5; my $pa = xvals zeroes 3,5;
my $pb = yvals zeroes 3,5; my $pb = yvals zeroes 3,5;
my $pc = $pa + $pb; my $pc = $pa + $pb;
ok($pc->at(2,2) == 4, 'pdl addition 1'); ok($pc->at(2,2) == 4, 'pdl addition 1');
ok($pc->at(2,3) == 5, 'pdl addition 2'); ok($pc->at(2,3) == 5, 'pdl addition 2');
throws_ok { $pc->at(3,3); } qr/Position\s*\d+\s*out of range/, 'invalid position '; throws_ok { $pc->at(3,3); } qr/Position.*out of range/, 'invalid position';
} }
{ {
my $pd = pdl 5,6; my $pd = pdl 5,6;
my $pe = $pd - 1; my $pe = $pd - 1;
ok($pe->at(0) == 4, 'pdl - scalar 1'); ok($pe->at(0) == 4, 'pdl - scalar 1');
ok($pe->at(1) == 5, 'pdl - scalar 2'); ok($pe->at(1) == 5, 'pdl - scalar 2');
my $pf = 1 - $pd; my $pf = 1 - $pd;
ok($pf->at(0) == -4, 'scalar - pdl 1'); ok($pf->at(0) == -4, 'scalar - pdl 1');
ok($pf->at(1) == -5, 'scalar - pdl 2'); ok($pf->at(1) == -5, 'scalar - pdl 2');
skipping to change at line 47 skipping to change at line 47
{ {
my @w; my @w;
local $SIG{__WARN__} = sub { push @w, @_ }; local $SIG{__WARN__} = sub { push @w, @_ };
my $pa = xvals(cdouble, 3, 5)+10 - 2*xvals(3, 5)*i; my $pa = xvals(cdouble, 3, 5)+10 - 2*xvals(3, 5)*i;
my $pb = yvals(cdouble, 3, 5)+10 - 2*yvals(3, 5)*i; my $pb = yvals(cdouble, 3, 5)+10 - 2*yvals(3, 5)*i;
my $pc = $pa + $pb; my $pc = $pa + $pb;
ok(approx(cdouble(25 - 10*i) - cdouble(25 - 10*i), 0), 'pdl complex subtraction' ); ok(approx(cdouble(25 - 10*i) - cdouble(25 - 10*i), 0), 'pdl complex subtraction' );
ok(approx($pc->double->at(2,2), 24), 'pdl complex addition 1'); ok(approx($pc->double->at(2,2), 24), 'pdl complex addition 1');
is $pc->at(2,3), '25-10i', 'at stringifies complex'; is $pc->at(2,3), '25-10i', 'at stringifies complex';
ok(approx($pc->slice([2], [3]), cdouble(25 - 10*i)), 'pdl complex addition 2'); ok(approx($pc->slice([2], [3]), cdouble(25 - 10*i)), 'pdl complex addition 2');
throws_ok { $pc->at(3,3); } qr/Position\s*\d+\s*out of range/, 'invalid position '; throws_ok { $pc->at(3,3); } qr/Position.*out of range/, 'invalid position';
is_deeply \@w, [], 'no warnings' or diag explain \@w; is_deeply \@w, [], 'no warnings' or diag explain \@w;
} }
{ {
my @w; my @w;
local $SIG{__WARN__} = sub { push @w, @_ }; local $SIG{__WARN__} = sub { push @w, @_ };
my $pd = cdouble 5,6; my $pd = cdouble 5,6;
my $pe = $pd - 1; my $pe = $pd - 1;
is($pe->at(0), '4', 'pdl - scalar 1'); is($pe->at(0), '4', 'pdl - scalar 1');
is($pe->at(1), '5', 'pdl - scalar 2'); is($pe->at(1), '5', 'pdl - scalar 2');
skipping to change at line 291 skipping to change at line 291
cmp_ok longlong(9000000000000000002) - longlong(9000000000000000001), '==', 1 , "longlong precision/2"; cmp_ok longlong(9000000000000000002) - longlong(9000000000000000001), '==', 1 , "longlong precision/2";
cmp_ok longlong(-8999999999999999998) + longlong(8999999999999999999), '==', 1 , "longlong precision/3"; cmp_ok longlong(-8999999999999999998) + longlong(8999999999999999999), '==', 1 , "longlong precision/3";
cmp_ok longlong(1000000000000000001) - longlong(1000000000000000000), '==', 1 , "longlong precision/4"; cmp_ok longlong(1000000000000000001) - longlong(1000000000000000000), '==', 1 , "longlong precision/4";
cmp_ok longlong(9223372036854775807) - longlong(9223372036854775806), '==', 1 , "longlong precision/5"; cmp_ok longlong(9223372036854775807) - longlong(9223372036854775806), '==', 1 , "longlong precision/5";
cmp_ok longlong(9223372036854775807) + longlong(-9223372036854775808), '==',-1 , "longlong precision/6"; cmp_ok longlong(9223372036854775807) + longlong(-9223372036854775808), '==',-1 , "longlong precision/6";
} }
is(~pdl(1,2,3) ."", '[-2 -3 -4]', 'bitwise negation'); is(~pdl(1,2,3) ."", '[-2 -3 -4]', 'bitwise negation');
is((pdl(1,2,3) ^ pdl(4,5,6))."", '[5 7 5]' , 'bitwise xor' ); is((pdl(1,2,3) ^ pdl(4,5,6))."", '[5 7 5]' , 'bitwise xor' );
# Check badflag propagation with .= (Ops::assgn) sf.net bug 3543056 {
$a = sequence(10); my $startgood = sequence(10);
$b = sequence(5); my $hasbad = sequence(5);
$b->inplace->setvaltobad(3); $hasbad->inplace->setvaltobad(3);
$a->slice('0:4') .= $b; $startgood->slice('0:4') .= $hasbad;
$a->badflag(1); ok $startgood->badflag, 'startgood badflag now true';
$a->check_badflag(); ok $startgood->nbad == 1, 'badflag propagation with .=';
ok($a->badflag == 1 && $a->nbad == 1, 'badflag propagation with .='); }
done_testing; done_testing;
 End of changes. 3 change blocks. 
10 lines changed or deleted 10 lines changed or added

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