"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/ufunc.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).

ufunc.t  (PDL-2.078):ufunc.t  (PDL-2.079)
skipping to change at line 18 skipping to change at line 18
my $d = abs( $x - $y ); my $d = abs( $x - $y );
my $check = ($d <= 0.0001); my $check = ($d <= 0.0001);
diag "diff = [$d]\n" unless my $res = all $check; diag "diff = [$d]\n" unless my $res = all $check;
return $res; return $res;
} }
my $p = pdl([]); $p->setdims([1,0]); $p->qsortvec; # shouldn't segfault! my $p = pdl([]); $p->setdims([1,0]); $p->qsortvec; # shouldn't segfault!
my $p2d = pdl([[1,2],[3,4],[1,3],[1,2],[3,3]]); my $p2d = pdl([[1,2],[3,4],[1,3],[1,2],[3,3]]);
is $p2d->dice_axis(1,$p2d->qsortveci).'', $p2d->qsortvec.'', "qsortveci"; is $p2d->dice_axis(1,$p2d->qsortveci).'', $p2d->qsortvec.'', "qsortveci";
my $ind_double = zeroes($p2d->dim(1));
$p2d->qsortveci($ind_double); # shouldn't segfault!
is $ind_double.'', '[3 0 2 4 1]';
eval { empty()->medover }; # shouldn't segfault eval { empty()->medover }; # shouldn't segfault
isnt $@, '', 'exception for percentile on empty ndarray'; isnt $@, '', 'exception for percentile on empty ndarray';
# set up test arrays # set up test arrays
# #
my $x = pdl(0,0,6,3,5,0,7,14,94,5,5,8,7,7,1,6,7,13,10,2,101,19,7,7,5); # sf.net bug #2019651 my $x = pdl(0,0,6,3,5,0,7,14,94,5,5,8,7,7,1,6,7,13,10,2,101,19,7,7,5); # sf.net bug #2019651
my $a_sort = $x->qsort; my $a_sort = $x->qsort;
my $y = pdl(55); my $y = pdl(55);
my $b_sort = $y->qsort; my $b_sort = $y->qsort;
my $c = cat($x,$x); my $c = cat($x,$x);
skipping to change at line 121 skipping to change at line 125
# #
{ {
my $inf = inf(); my $inf = inf();
my $nan = nan(); my $nan = nan();
my $x = pdl($nan, 0, 1, 2); my $x = pdl($nan, 0, 1, 2);
my $y = pdl(0, 1, 2, $nan); my $y = pdl(0, 1, 2, $nan);
ok($x->min == $y->min, "min with NaNs"); ok($x->min == $y->min, "min with NaNs");
ok($x->max == $y->max, "max with NaNs"); ok($x->max == $y->max, "max with NaNs");
} }
my $empty = which(ones(5)>5); my $empty = empty();
$x = $empty->double->maximum; $x = $empty->maximum;
ok( $x->nelem==1, "maximum over an empty dim yields 1 value"); ok( $x->nelem==1, "maximum over an empty dim yields 1 value");
is $x.'', 'BAD', "max of empty nonbad float gives BAD"; is $x.'', 'BAD', "max of empty nonbad float gives BAD";
# test bad value handling with max # test bad value handling with max
$empty->badflag(1); $empty->badflag(1);
$x = $empty->maximum; $x = $empty->maximum;
ok( $x->isbad, "bad flag gets set on max over an empty dim"); ok( $x->isbad, "bad flag gets set on max over an empty dim");
#Test subroutines directly. #Test subroutines directly.
 End of changes. 2 change blocks. 
2 lines changed or deleted 6 lines changed or added

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