"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Ufunc/ufunc.pd" between
PDL-2.074.tar.gz and PDL-2.075.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.074):ufunc.pd  (PDL-2.075)
skipping to change at line 257 skipping to change at line 257
pp_def( pp_def(
'intover', 'intover',
HandleBad => 0, HandleBad => 0,
Pars => 'a(n); float+ [o]b();', Pars => 'a(n); float+ [o]b();',
Code => Code =>
'$GENERIC(b) tmp = 0; '$GENERIC(b) tmp = 0;
PDL_Indx ns = $SIZE(n), nn; PDL_Indx ns = $SIZE(n), nn;
/* Integration formulae from Press et al 2nd Ed S 4.1 */ /* Integration formulae from Press et al 2nd Ed S 4.1 */
switch (ns) { switch (ns) {
case 1: case 1:
threadloop %{ broadcastloop %{
$b() = 0.; /* not a(n=>0); as interval has zero width */ $b() = 0.; /* not a(n=>0); as interval has zero width */
%} %}
break; break;
case 2: case 2:
threadloop %{ broadcastloop %{
$b() = 0.5*($a(n=>0)+$a(n=>1)); $b() = 0.5*($a(n=>0)+$a(n=>1));
%} %}
break; break;
case 3: case 3:
threadloop %{ broadcastloop %{
$b() = ($a(n=>0)+4*$a(n=>1)+$a(n=>2))/3.; $b() = ($a(n=>0)+4*$a(n=>1)+$a(n=>2))/3.;
%} %}
break; break;
case 4: case 4:
threadloop %{ broadcastloop %{
$b() = ($a(n=>0)+$a(n=>3)+3.*($a(n=>1)+$a(n=>2)))*0.375; $b() = ($a(n=>0)+$a(n=>3)+3.*($a(n=>1)+$a(n=>2)))*0.375;
%} %}
break; break;
case 5: case 5:
threadloop %{ broadcastloop %{
$b() = (14.*($a(n=>0)+$a(n=>4)) $b() = (14.*($a(n=>0)+$a(n=>4))
+64.*($a(n=>1)+$a(n=>3)) +64.*($a(n=>1)+$a(n=>3))
+24.*$a(n=>2))/45.; +24.*$a(n=>2))/45.;
%} %}
break; break;
default: default:
threadloop %{ broadcastloop %{
for (nn=3,tmp=0;nn<ns-3;nn++) { tmp += $a(n=>nn); } for (nn=3,tmp=0;nn<ns-3;nn++) { tmp += $a(n=>nn); }
tmp += (23./24.)*($a(n=>2)+$a(n=>nn));nn++; tmp += (23./24.)*($a(n=>2)+$a(n=>nn));nn++;
tmp += (7./6.) *($a(n=>1)+$a(n=>nn));nn++; tmp += (7./6.) *($a(n=>1)+$a(n=>nn));nn++;
tmp += 0.375 *($a(n=>0)+$a(n=>nn)); tmp += 0.375 *($a(n=>0)+$a(n=>nn));
$b() = tmp; $b() = tmp;
%} %}
} }
', ',
Doc => projectdocs('integral','intover', Doc => projectdocs('integral','intover',
q~Notes: q~Notes:
skipping to change at line 636 skipping to change at line 636
=head2 minmax =head2 minmax
=for ref =for ref
Returns a list with minimum and maximum values of an ndarray. Returns a list with minimum and maximum values of an ndarray.
=for usage =for usage
($mn, $mx) = minmax($pdl); ($mn, $mx) = minmax($pdl);
This routine does I<not> thread over the dimensions of C<$pdl>; This routine does I<not> broadcast over the dimensions of C<$pdl>;
it returns the minimum and maximum values of the whole ndarray. it returns the minimum and maximum values of the whole ndarray.
See L</minmaximum> if this is not what is required. See L</minmaximum> if this is not what is required.
The two values are returned as Perl scalars similar to min/max, The two values are returned as Perl scalars similar to min/max,
and therefore ignore whether the values are bad. and therefore ignore whether the values are bad.
=for example =for example
pdl> $x = pdl [1,-2,3,5,0] pdl> $x = pdl [1,-2,3,5,0]
pdl> ($min, $max) = minmax($x); pdl> ($min, $max) = minmax($x);
pdl> p "$min $max\n"; pdl> p "$min $max\n";
skipping to change at line 785 skipping to change at line 785
sub generic_qsortvec { sub generic_qsortvec {
my $pdl = shift; my $pdl = shift;
my $ndim = shift; my $ndim = shift;
'pdl_qsortvec_$PPSYM() ($P(' . $pdl . '), '. $ndim.', 0, nn);'; 'pdl_qsortvec_$PPSYM() ($P(' . $pdl . '), '. $ndim.', 0, nn);';
} }
# when copying the data over to the temporary array, # when copying the data over to the temporary array,
# ignore the bad values and then only send the number # ignore the bad values and then only send the number
# of good elements to the sort routines # of good elements to the sort routines
# should use threadloop ? # should use broadcastloop ?
my $copy_to_temp_good = ' my $copy_to_temp_good = '
PDL_Indx nn, nn1; PDL_Indx nn, nn1;
loop(n) %{ $tmp() = $a(); %} loop(n) %{ $tmp() = $a(); %}
nn = $SIZE(n)-1; ' . nn = $SIZE(n)-1; ' .
generic_qsort('tmp'); generic_qsort('tmp');
my $copy_to_temp_bad = ' my $copy_to_temp_bad = '
register PDL_Indx nn = 0; register PDL_Indx nn = 0;
loop(n) %{ loop(n) %{
if ( $ISGOOD(a()) ) { $tmp(n=>nn) = $a(); nn++; } if ( $ISGOOD(a()) ) { $tmp(n=>nn) = $a(); nn++; }
%} %}
skipping to change at line 1193 skipping to change at line 1193
if ( nn != 0 ) { if ( nn != 0 ) {
nn -= 1;' . nn -= 1;' .
generic_qsortvec('b','nd') .' generic_qsortvec('b','nd') .'
}', }',
Doc => ' Doc => '
=for ref =for ref
Sort a list of vectors lexicographically. Sort a list of vectors lexicographically.
The 0th dimension of the source ndarray is dimension in the vector; The 0th dimension of the source ndarray is dimension in the vector;
the 1st dimension is list order. Higher dimensions are threaded over. the 1st dimension is list order. Higher dimensions are broadcasted over.
=for example =for example
print qsortvec pdl([[1,2],[0,500],[2,3],[4,2],[3,4],[3,5]]); print qsortvec pdl([[1,2],[0,500],[2,3],[4,2],[3,4],[3,5]]);
[ [
[ 0 500] [ 0 500]
[ 1 2] [ 1 2]
[ 2 3] [ 2 3]
[ 3 4] [ 3 4]
[ 3 5] [ 3 5]
skipping to change at line 1268 skipping to change at line 1268
Sort a list of vectors lexicographically, returning the indices of the Sort a list of vectors lexicographically, returning the indices of the
sorted vectors rather than the sorted list itself. sorted vectors rather than the sorted list itself.
As with C<qsortvec>, the input PDL should be an NxM array containing M As with C<qsortvec>, the input PDL should be an NxM array containing M
separate N-dimensional vectors. The return value is an integer M-PDL separate N-dimensional vectors. The return value is an integer M-PDL
containing the M-indices of original array rows, in sorted order. containing the M-indices of original array rows, in sorted order.
As with C<qsortvec>, the zeroth element of the vectors runs slowest in the As with C<qsortvec>, the zeroth element of the vectors runs slowest in the
sorted list. sorted list.
Additional dimensions are threaded over: each plane is sorted separately, Additional dimensions are broadcasted over: each plane is sorted separately,
so qsortveci may be thought of as a collapse operator of sorts (groan). so qsortveci may be thought of as a collapse operator of sorts (groan).
=cut =cut
', ',
BadDoc => ' BadDoc => '
Vectors with bad components are moved to the end of the array as Vectors with bad components are moved to the end of the array as
for L</qsortvec>. for L</qsortvec>.
', ',
); );
 End of changes. 10 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)