"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Math/math.pd" between
PDL-2.077.tar.gz and PDL-2.078.tar.gz

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

math.pd  (PDL-2.077):math.pd  (PDL-2.078)
skipping to change at line 138 skipping to change at line 138
function. This is useful for determining factorials, amongst other function. This is useful for determining factorials, amongst other
things. things.
EOD EOD
} # if: $^O !~ win32 } # if: $^O !~ win32
pp_addhdr(' pp_addhdr('
#include <tgmath.h> #include <tgmath.h>
#include "protos.h" #include "protos.h"
extern double ndtri(double);
'); ');
if ($^O =~ /MSWin/) { if ($^O =~ /MSWin/) {
pp_addhdr(' pp_addhdr('
#include <float.h> #include <float.h>
#ifdef _MSC_VER #ifdef _MSC_VER
double rint (double); double rint (double);
#endif #endif
'); ');
} }
skipping to change at line 300 skipping to change at line 301
', # what happens to signgam if $a() is bad? ', # what happens to signgam if $a() is bad?
); );
} # elsif: cc =~ /\bgcc/i } # elsif: cc =~ /\bgcc/i
pp_def( pp_def(
'badmask', 'badmask',
Pars => 'a(); b(); [o]c();', Pars => 'a(); b(); [o]c();',
Inplace => [ 'a' ], Inplace => [ 'a' ],
HandleBad => 1, HandleBad => 1,
Code => Code =>
'$c() = isfinite((double) $a()) ? $a() : $b();', '$c() = ( isfinite((double) $a()) PDL_IF_BAD(&& $ISGOOD(a()),) ) ? $a() :
BadCode => $b();',
'$c() = ( isfinite((double) $a()) && $ISGOOD(a()) ) ? $a() : $b();',
CopyBadStatusCode => CopyBadStatusCode =>
'if ( a == c && $ISPDLSTATEBAD(a) ) 'if ( a == c && $ISPDLSTATEBAD(a) )
PDL->propagate_badflag( c, 0 ); /* propagate badflag if inplace AND its changed */ PDL->propagate_badflag( c, 0 ); /* propagate badflag if inplace AND its changed */
$SETPDLSTATEGOOD(c); /* always make sure the output is "good" * / $SETPDLSTATEGOOD(c); /* always make sure the output is "good" * /
', ',
Doc => Doc =>
'=for ref '=for ref
Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>. Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>.
skipping to change at line 329 skipping to change at line 328
BadDoc => BadDoc =>
'If bad values are present, these are also cleared.', 'If bad values are present, these are also cleared.',
); );
pp_def( pp_def(
'isfinite', 'isfinite',
Pars => 'a(); int [o]mask();', Pars => 'a(); int [o]mask();',
Inplace => 1, Inplace => 1,
HandleBad => 1, HandleBad => 1,
Code => Code =>
'$mask() = isfinite((double) $a()) != 0;', '$mask() = isfinite((double) $a()) != 0 PDL_IF_BAD(&& $ISGOOD($a()),);',
BadCode =>
'$mask() = isfinite((double) $a()) != 0 && $ISGOOD($a());',
CopyBadStatusCode => CopyBadStatusCode =>
'if ( a == mask && $ISPDLSTATEBAD(a) ) 'if ( a == mask && $ISPDLSTATEBAD(a) )
PDL->propagate_badflag( mask, 0 ); /* propagate badflag if inplace A ND its changed */ PDL->propagate_badflag( mask, 0 ); /* propagate badflag if inplace A ND its changed */
$SETPDLSTATEGOOD(mask); /* always make sure the output is "good " */ $SETPDLSTATEGOOD(mask); /* always make sure the output is "good " */
', ',
Doc => Doc =>
'Sets C<$mask> true if C<$a> is not a C<NaN> or C<inf> (either positive or negat ive). Works inplace.', 'Sets C<$mask> true if C<$a> is not a C<NaN> or C<inf> (either positive or negat ive). Works inplace.',
BadDoc => BadDoc =>
'Bad values are treated as C<NaN> or C<inf>.', 'Bad values are treated as C<NaN> or C<inf>.',
); );
skipping to change at line 353 skipping to change at line 350
# Extra functions from cephes # Extra functions from cephes
pp_def( pp_def(
"erfi", "erfi",
HandleBad => 1, HandleBad => 1,
NoBadifNaN => 1, NoBadifNaN => 1,
GenericTypes => $F, GenericTypes => $F,
Pars => 'a(); [o]b()', Pars => 'a(); [o]b()',
Inplace => 1, Inplace => 1,
Doc => inplace_doc( "erfi" ), Doc => inplace_doc( "erfi" ),
Code => Code =>
'extern double ndtri(double), SQRTH; 'extern double SQRTH;
$b() = SQRTH*ndtri((1+(double)$a())/2);', PDL_IF_BAD(if ( $ISBAD(a()) ) { $SETBAD(b()); }
BadCode => else,) { $b() = SQRTH*ndtri((1+(double)$a())/2); }',
'extern double ndtri(double), SQRTH;
if ( $ISBAD(a()) ) { $SETBAD(b()); }
else { $b() = SQRTH*ndtri((1+(double)$a())/2); }',
); );
pp_def( pp_def(
"ndtri", "ndtri",
HandleBad => 1, HandleBad => 1,
NoBadifNaN => 1, NoBadifNaN => 1,
GenericTypes => $F, GenericTypes => $F,
Pars => 'a(); [o]b()', Pars => 'a(); [o]b()',
Inplace => 1, Inplace => 1,
Doc => inplace_doc( "ndtri" ), Doc => inplace_doc( "ndtri" ),
Code => Code =>
'extern double ndtri(double); 'PDL_IF_BAD(if ( $ISBAD(a()) ) { $SETBAD(b()); }
$b() = ndtri((double)$a());', else,) { $b() = ndtri((double)$a()); }',
BadCode =>
'extern double ndtri(double);
if ( $ISBAD(a()) ) { $SETBAD(b()); }
else { $b() = ndtri((double)$a()); }',
); );
pp_def("polyroots", pp_def("polyroots",
Pars => 'cr(n); ci(n); [o]rr(m); [o]ri(m);', Pars => 'cr(n); ci(n); [o]rr(m); [o]ri(m);',
RedoDimsCode => '$SIZE(m) = $SIZE(n)-1;', RedoDimsCode => '$SIZE(m) = $SIZE(n)-1;',
GenericTypes => ['D'], GenericTypes => ['D'],
Code => ' Code => '
extern int cpoly( double *cr, double *ci, int deg, extern int cpoly( double *cr, double *ci, int deg,
double *rr, double *ri ); double *rr, double *ri );
int deg = (int)$SIZE(n)-1; int deg = (int)$SIZE(n)-1;
 End of changes. 5 change blocks. 
18 lines changed or deleted 9 lines changed or added

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