"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Ufunc/ufunc.pd" 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.pd  (PDL-2.078):ufunc.pd  (PDL-2.079)
skipping to change at line 113 skipping to change at line 113
EOD EOD
} # sub: cumuprojectdocs() } # sub: cumuprojectdocs()
# it's a bit unclear what to do with the comparison operators, # it's a bit unclear what to do with the comparison operators,
# since the return value could be bad because all elements are bad, # since the return value could be bad because all elements are bad,
# which needs checking for since the bad value could evaluate to # which needs checking for since the bad value could evaluate to
# true or false (eg if the user has set it to 0) # true or false (eg if the user has set it to 0)
# #
# by setting CopyBadStatusCode to '', we stop the output ndarray
# from automatically being set bad if any of the input ndarrays are bad.
# - we can set the flag within BadCode if necessary
#
# This may NOT be sensible. Only time, and comments, will tell... # This may NOT be sensible. Only time, and comments, will tell...
# #
my %over = my %over =
( (
sumover => { name => 'sum', op => '+=', init => 0, }, sumover => { name => 'sum', op => '+=', init => 0, },
prodover => { name => 'product', op => '*=', init => 1, }, prodover => { name => 'product', op => '*=', init => 1, },
); );
foreach my $func ( sort keys %over ) { foreach my $func ( sort keys %over ) {
skipping to change at line 234 skipping to change at line 230
int flag = 0; int flag = 0;
loop(n) %{ loop(n) %{
PDL_IF_BAD(if ( \$ISGOOD(a()) ) { flag = 1;,) PDL_IF_BAD(if ( \$ISGOOD(a()) ) { flag = 1;,)
$op $op
if ( $check ) break; if ( $check ) break;
PDL_IF_BAD(},) PDL_IF_BAD(},)
%} %}
PDL_IF_BAD(if ( !flag ) { \$SETBAD(b()); \$PDLSTATESETBAD(b); } else ,) PDL_IF_BAD(if ( !flag ) { \$SETBAD(b()); \$PDLSTATESETBAD(b); } else ,)
\$b() = tmp; \$b() = tmp;
}, },
CopyBadStatusCode => '',
Doc => projectdocs( $txt, $func,''), Doc => projectdocs( $txt, $func,''),
BadDoc => BadDoc =>
'If C<a()> contains only bad data (and its bad flag is set), 'If C<a()> contains only bad data (and its bad flag is set),
C<b()> is set bad. Otherwise C<b()> will have its bad flag cleared, C<b()> is set bad. Otherwise C<b()> will have its bad flag cleared,
as it will not contain any bad values.', as it will not contain any bad values.',
); );
} # foreach: $func } # foreach: $func
# this would need a lot of work to support bad values # this would need a lot of work to support bad values
skipping to change at line 370 skipping to change at line 365
Code => Code =>
'$GENERIC() cur = 0; '$GENERIC() cur = 0;
int flag = 0; int flag = 0;
loop(n) %{ loop(n) %{
PDL_IF_BAD(if ($ISBAD(a())) continue;,) PDL_IF_BAD(if ($ISBAD(a())) continue;,)
if( !flag || ($a() '.$op.' cur ) || PDL_ISNAN_$PPSYM()(cur) ) if( !flag || ($a() '.$op.' cur ) || PDL_ISNAN_$PPSYM()(cur) )
{cur = $a(); flag = 1;} {cur = $a(); flag = 1;}
%} %}
if ( flag ) { $c() = cur; } if ( flag ) { $c() = cur; }
else { $SETBAD(c()); $PDLSTATESETBAD(c); }', else { $SETBAD(c()); $PDLSTATESETBAD(c); }',
CopyBadStatusCode => '',
Doc => projectdocs($name,$name,''), Doc => projectdocs($name,$name,''),
BadDoc => BadDoc =>
'Output is set bad if no elements of the input are non-bad, 'Output is set bad if no elements of the input are non-bad,
otherwise the bad flag is cleared for the output ndarray. otherwise the bad flag is cleared for the output ndarray.
Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>; Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask> see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Bad/badmask>
for ways of masking NaNs. for ways of masking NaNs.
', ',
); );
synonym($name, $synonym); synonym($name, $synonym);
pp_def( pp_def(
"${name}_ind", "${name}_ind",
HandleBad => 1, HandleBad => 1,
Pars => 'a(n); indx [o] c();', Pars => 'a(n); indx [o] c();',
Code => Code =>
'$GENERIC() cur = 0; '$GENERIC() cur = 0;
PDL_Indx curind = -1; PDL_Indx curind = -1;
loop(n) %{ loop(n) %{
PDL_IF_BAD(if ($ISBAD(a())) continue;,) PDL_IF_BAD(if ($ISBAD(a())) continue;,)
if(curind == -1 || $a() '.$op.' cur || PDL_ISNAN_$PPSYM()(cur)) if(curind == -1 || $a() '.$op.' cur || PDL_ISNAN_$PPSYM()(cur))
{cur = $a(); curind = n;} {cur = $a(); curind = n;}
%} %}
if ( curind != -1 ) { $c() = curind; } if ( curind != -1 ) { $c() = curind; }
else { $SETBAD(c()); $PDLSTATESETBAD(c); }', else { $SETBAD(c()); $PDLSTATESETBAD(c); }',
CopyBadStatusCode => '',
Doc => "Like $name but returns the index rather than the value", Doc => "Like $name but returns the index rather than the value",
BadDoc => BadDoc =>
'Output is set bad if no elements of the input are non-bad, 'Output is set bad if no elements of the input are non-bad,
otherwise the bad flag is cleared for the output ndarray. otherwise the bad flag is cleared for the output ndarray.
Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>; Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask> see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Bad/badmask>
for ways of masking NaNs. for ways of masking NaNs.
', ',
); );
synonym("${name}_ind", "${synonym}_ind"); synonym("${name}_ind", "${synonym}_ind");
pp_def( pp_def(
"${name}_n_ind", "${name}_n_ind",
HandleBad => 1, HandleBad => 1,
Pars => 'a(n); indx [o]c(m);', Pars => 'a(n); indx [o]c(m);',
OtherPars => 'PDL_Indx m_size => m;', OtherPars => 'PDL_Indx m_size => m;',
skipping to change at line 445 skipping to change at line 438
if($c(m=>nm) == n) {flag=1; break;} if($c(m=>nm) == n) {flag=1; break;}
} }
if(!flag && if(!flag &&
PDL_IF_BAD($ISGOOD(a()) &&,) PDL_IF_BAD($ISGOOD(a()) &&,)
((curind == ns) || $a() '.$op.' cur || PDL_ISNAN_$PPSY M()(cur))) ((curind == ns) || $a() '.$op.' cur || PDL_ISNAN_$PPSY M()(cur)))
{cur = $a(); curind = n;} {cur = $a(); curind = n;}
%} %}
if (curind != ns) { $c() = curind; } if (curind != ns) { $c() = curind; }
else { $SETBAD(c()); $PDLSTATESETBAD(c); } else { $SETBAD(c()); $PDLSTATESETBAD(c); }
%}', %}',
CopyBadStatusCode => '',
Doc => <<EOF, Doc => <<EOF,
=for ref =for ref
Returns the index of C<m_size> $name elements. As of 2.077, you can Returns the index of C<m_size> $name elements. As of 2.077, you can
specify how many by either passing in an ndarray of the given size specify how many by either passing in an ndarray of the given size
(DEPRECATED - will be converted to indx if needed and the input arg will (DEPRECATED - will be converted to indx if needed and the input arg will
be set to that), or just the size, or a null and the size. be set to that), or just the size, or a null and the size.
=for usage =for usage
${name}_n_ind(\$pdl, \$out = zeroes(5)); # DEPRECATED ${name}_n_ind(\$pdl, \$out = zeroes(5)); # DEPRECATED
\$out = ${name}_n_ind(\$pdl, 5); \$out = ${name}_n_ind(\$pdl, 5);
${name}_n_ind(\$pdl, \$out = null, 5); ${name}_n_ind(\$pdl, \$out = null, 5);
EOF EOF
BadDoc => BadDoc =>
'Output bad flag is cleared for the output ndarray if sufficient non-bad element s found, 'Output bad flag is cleared for the output ndarray if sufficient non-bad element s found,
else remaining slots in C<$c()> are set bad. else remaining slots in C<$c()> are set bad.
Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>; Note that C<NaNs> are considered to be valid values and will "win" over non-C<Na N>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask> see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Bad/badmask>
for ways of masking NaNs. for ways of masking NaNs.
', ',
); );
synonym("${name}_n_ind", "${synonym}_n_ind"); synonym("${name}_n_ind", "${synonym}_n_ind");
} # foreach: $which } # foreach: $which
pp_def( pp_def(
'minmaximum', 'minmaximum',
HandleBad => 1, HandleBad => 1,
Pars => 'a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_in d();', Pars => 'a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_in d();',
CopyBadStatusCode => '',
Code => Code =>
'$GENERIC() curmin = 0, curmax = 0; /* Handle null ndarray --CED */ '$GENERIC() curmin = 0, curmax = 0; /* Handle null ndarray --CED */
PDL_Indx curmin_ind = 0, curmax_ind = 0; int flag = 0; PDL_Indx curmin_ind = 0, curmax_ind = 0; int flag = 0;
loop(n) %{ loop(n) %{
PDL_IF_BAD(if ( $ISGOOD(a()) ),) { PDL_IF_BAD(if ( $ISGOOD(a()) ),) {
if ( !flag ) { if ( !flag ) {
curmin = curmax = $a(); curmin = curmax = $a();
curmin_ind = curmax_ind = n; curmin_ind = curmax_ind = n;
flag = 1; flag = 1;
} else { } else {
 End of changes. 9 change blocks. 
12 lines changed or deleted 3 lines changed or added

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