"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/Ufunc.pm" between
PDL-2.076.tar.gz and PDL-2.077.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.pm  (PDL-2.076):Ufunc.pm  (PDL-2.077)
skipping to change at line 908 skipping to change at line 908
=for usage =for usage
$y = minimum($x); $y = minimum($x);
=for example =for example
$spectrum = minimum $image->transpose $spectrum = minimum $image->transpose
=for bad =for bad
Output is set bad if all elements of the input are 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; 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::Math/badmask>
for ways of masking NaNs. for ways of masking NaNs.
=cut =cut
#line 1152 "Ufunc.pm" #line 1152 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*minimum = \&PDL::minimum; *minimum = \&PDL::minimum;
#line 1159 "Ufunc.pm" #line 1159 "Ufunc.pm"
skipping to change at line 950 skipping to change at line 950
=for sig =for sig
Signature: (a(n); indx [o] c()) Signature: (a(n); indx [o] c())
=for ref =for ref
Like minimum but returns the index rather than the value Like minimum but returns the index rather than the value
=for bad =for bad
Output is set bad if all elements of the input are 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>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask>
for ways of masking NaNs.
=cut =cut
#line 1198 "Ufunc.pm" #line 1203 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*minimum_ind = \&PDL::minimum_ind; *minimum_ind = \&PDL::minimum_ind;
#line 1205 "Ufunc.pm" #line 1210 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 minover_ind =head2 minover_ind
=for ref =for ref
Synonym for minimum_ind. Synonym for minimum_ind.
=cut =cut
*PDL::minover_ind = *minover_ind = \&PDL::minimum_ind; *PDL::minover_ind = *minover_ind = \&PDL::minimum_ind;
#line 1220 "Ufunc.pm" #line 1225 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 minimum_n_ind =head2 minimum_n_ind
=for sig =for sig
Signature: (a(n); indx [o]c(m)) Signature: (a(n); indx [o]c(m); PDL_Indx m_size => m)
=for ref =for ref
Returns the index of C<m> minimum elements Returns the index of C<m_size> minimum elements. As of 2.077, you can
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
be set to that), or just the size, or a null and the size.
=for usage
minimum_n_ind($pdl, $out = zeroes(5)); # DEPRECATED
$out = minimum_n_ind($pdl, 5);
minimum_n_ind($pdl, $out = null, 5);
=for bad =for bad
Not yet been converted to ignore bad values Output bad flag is cleared for the output ndarray if sufficient non-bad elements
found,
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>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask>
for ways of masking NaNs.
=cut =cut
#line 1243 "Ufunc.pm" #line 1265 "Ufunc.pm"
#line 1059 "../../blib/lib/PDL/PP.pm"
#line 416 "ufunc.pd"
sub PDL::minimum_n_ind {
my ($a, $c, $m_size) = @_;
$m_size //= ref($c) ? $c->dim(0) : $c; # back-compat with pre-2.077
my $set_out = 1;
$set_out = 0, $c = null if !ref $c;
$c = $c->indx if !$c->isnull;
PDL::_minimum_n_ind_int($a, $c, $m_size);
$set_out ? $_[1] = $c : $c;
}
#line 1071 "../../blib/lib/PDL/PP.pm"
#line 1283 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*minimum_n_ind = \&PDL::minimum_n_ind; *minimum_n_ind = \&PDL::minimum_n_ind;
#line 1250 "Ufunc.pm" #line 1290 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 minover_n_ind =head2 minover_n_ind
=for ref =for ref
Synonym for minimum_n_ind. Synonym for minimum_n_ind.
=cut =cut
*PDL::minover_n_ind = *minover_n_ind = \&PDL::minimum_n_ind; *PDL::minover_n_ind = *minover_n_ind = \&PDL::minimum_n_ind;
#line 1265 "Ufunc.pm" #line 1305 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 maximum =head2 maximum
=for sig =for sig
Signature: (a(n); [o]c()) Signature: (a(n); [o]c())
=for ref =for ref
skipping to change at line 1039 skipping to change at line 1072
=for usage =for usage
$y = maximum($x); $y = maximum($x);
=for example =for example
$spectrum = maximum $image->transpose $spectrum = maximum $image->transpose
=for bad =for bad
Output is set bad if all elements of the input are 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; 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::Math/badmask>
for ways of masking NaNs. for ways of masking NaNs.
=cut =cut
#line 1313 "Ufunc.pm" #line 1353 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*maximum = \&PDL::maximum; *maximum = \&PDL::maximum;
#line 1320 "Ufunc.pm" #line 1360 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 maxover =head2 maxover
=for ref =for ref
Synonym for maximum. Synonym for maximum.
=cut =cut
*PDL::maxover = *maxover = \&PDL::maximum; *PDL::maxover = *maxover = \&PDL::maximum;
#line 1335 "Ufunc.pm" #line 1375 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 maximum_ind =head2 maximum_ind
=for sig =for sig
Signature: (a(n); indx [o] c()) Signature: (a(n); indx [o] c())
=for ref =for ref
Like maximum but returns the index rather than the value Like maximum but returns the index rather than the value
=for bad =for bad
Output is set bad if all elements of the input are 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>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask>
for ways of masking NaNs.
=cut =cut
#line 1359 "Ufunc.pm" #line 1404 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*maximum_ind = \&PDL::maximum_ind; *maximum_ind = \&PDL::maximum_ind;
#line 1366 "Ufunc.pm" #line 1411 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 maxover_ind =head2 maxover_ind
=for ref =for ref
Synonym for maximum_ind. Synonym for maximum_ind.
=cut =cut
*PDL::maxover_ind = *maxover_ind = \&PDL::maximum_ind; *PDL::maxover_ind = *maxover_ind = \&PDL::maximum_ind;
#line 1381 "Ufunc.pm" #line 1426 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 maximum_n_ind =head2 maximum_n_ind
=for sig =for sig
Signature: (a(n); indx [o]c(m)) Signature: (a(n); indx [o]c(m); PDL_Indx m_size => m)
=for ref =for ref
Returns the index of C<m> maximum elements Returns the index of C<m_size> maximum elements. As of 2.077, you can
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
be set to that), or just the size, or a null and the size.
=for usage
maximum_n_ind($pdl, $out = zeroes(5)); # DEPRECATED
$out = maximum_n_ind($pdl, 5);
maximum_n_ind($pdl, $out = null, 5);
=for bad =for bad
Not yet been converted to ignore bad values Output bad flag is cleared for the output ndarray if sufficient non-bad elements
found,
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>;
see L<isfinite|PDL::Math/isfinite> and L<badmask|PDL::Math/badmask>
for ways of masking NaNs.
=cut =cut
#line 1404 "Ufunc.pm" #line 1466 "Ufunc.pm"
#line 1059 "../../blib/lib/PDL/PP.pm"
#line 416 "ufunc.pd"
sub PDL::maximum_n_ind {
my ($a, $c, $m_size) = @_;
$m_size //= ref($c) ? $c->dim(0) : $c; # back-compat with pre-2.077
my $set_out = 1;
$set_out = 0, $c = null if !ref $c;
$c = $c->indx if !$c->isnull;
PDL::_maximum_n_ind_int($a, $c, $m_size);
$set_out ? $_[1] = $c : $c;
}
#line 1071 "../../blib/lib/PDL/PP.pm"
#line 1484 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*maximum_n_ind = \&PDL::maximum_n_ind; *maximum_n_ind = \&PDL::maximum_n_ind;
#line 1411 "Ufunc.pm" #line 1491 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 maxover_n_ind =head2 maxover_n_ind
=for ref =for ref
Synonym for maximum_n_ind. Synonym for maximum_n_ind.
=cut =cut
*PDL::maxover_n_ind = *maxover_n_ind = \&PDL::maximum_n_ind; *PDL::maxover_n_ind = *maxover_n_ind = \&PDL::maximum_n_ind;
#line 1426 "Ufunc.pm" #line 1506 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 minmaximum =head2 minmaximum
=for sig =for sig
Signature: (a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_ind( )) Signature: (a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_ind( ))
=for ref =for ref
skipping to change at line 1171 skipping to change at line 1237
See also L</minmax>, which clumps the ndarray together. See also L</minmax>, which clumps the ndarray together.
=for bad =for bad
If C<a()> contains only bad data, then the output ndarrays will If C<a()> contains only bad data, then the output ndarrays will
be set bad, along with their bad flag. be set bad, along with their bad flag.
Otherwise they will have their bad flags cleared, Otherwise they will have their bad flags cleared,
since they will not contain any bad values. since they will not contain any bad values.
=cut =cut
#line 1464 "Ufunc.pm" #line 1544 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*minmaximum = \&PDL::minmaximum; *minmaximum = \&PDL::minmaximum;
#line 1471 "Ufunc.pm" #line 1551 "Ufunc.pm"
#line 309 "ufunc.pd" #line 309 "ufunc.pd"
=head2 minmaxover =head2 minmaxover
=for ref =for ref
Synonym for minmaximum. Synonym for minmaximum.
=cut =cut
*PDL::minmaxover = *minmaxover = \&PDL::minmaximum; *PDL::minmaxover = *minmaxover = \&PDL::minmaximum;
#line 1486 "Ufunc.pm" #line 1566 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 avg =head2 avg
=for ref =for ref
Return the average of all elements in an ndarray. Return the average of all elements in an ndarray.
See the documentation for L</average> for more information. See the documentation for L</average> for more information.
=for usage =for usage
skipping to change at line 1217 skipping to change at line 1283
This routine handles bad values. This routine handles bad values.
=cut =cut
*avg = \&PDL::avg; *avg = \&PDL::avg;
sub PDL::avg { sub PDL::avg {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->average( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->average( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1516 "Ufunc.pm" #line 1596 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 sum =head2 sum
=for ref =for ref
Return the sum of all elements in an ndarray. Return the sum of all elements in an ndarray.
See the documentation for L</sumover> for more information. See the documentation for L</sumover> for more information.
=for usage =for usage
skipping to change at line 1245 skipping to change at line 1311
This routine handles bad values. This routine handles bad values.
=cut =cut
*sum = \&PDL::sum; *sum = \&PDL::sum;
sub PDL::sum { sub PDL::sum {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->sumover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->sumover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1546 "Ufunc.pm" #line 1626 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 prod =head2 prod
=for ref =for ref
Return the product of all elements in an ndarray. Return the product of all elements in an ndarray.
See the documentation for L</prodover> for more information. See the documentation for L</prodover> for more information.
=for usage =for usage
skipping to change at line 1273 skipping to change at line 1339
This routine handles bad values. This routine handles bad values.
=cut =cut
*prod = \&PDL::prod; *prod = \&PDL::prod;
sub PDL::prod { sub PDL::prod {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->prodover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->prodover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1576 "Ufunc.pm" #line 1656 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 davg =head2 davg
=for ref =for ref
Return the average (in double precision) of all elements in an ndarray. Return the average (in double precision) of all elements in an ndarray.
See the documentation for L</daverage> for more information. See the documentation for L</daverage> for more information.
=for usage =for usage
skipping to change at line 1301 skipping to change at line 1367
This routine handles bad values. This routine handles bad values.
=cut =cut
*davg = \&PDL::davg; *davg = \&PDL::davg;
sub PDL::davg { sub PDL::davg {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->daverage( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->daverage( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1606 "Ufunc.pm" #line 1686 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 dsum =head2 dsum
=for ref =for ref
Return the sum (in double precision) of all elements in an ndarray. Return the sum (in double precision) of all elements in an ndarray.
See the documentation for L</dsumover> for more information. See the documentation for L</dsumover> for more information.
=for usage =for usage
skipping to change at line 1329 skipping to change at line 1395
This routine handles bad values. This routine handles bad values.
=cut =cut
*dsum = \&PDL::dsum; *dsum = \&PDL::dsum;
sub PDL::dsum { sub PDL::dsum {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->dsumover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->dsumover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1636 "Ufunc.pm" #line 1716 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 dprod =head2 dprod
=for ref =for ref
Return the product (in double precision) of all elements in an ndarray. Return the product (in double precision) of all elements in an ndarray.
See the documentation for L</dprodover> for more information. See the documentation for L</dprodover> for more information.
=for usage =for usage
skipping to change at line 1357 skipping to change at line 1423
This routine handles bad values. This routine handles bad values.
=cut =cut
*dprod = \&PDL::dprod; *dprod = \&PDL::dprod;
sub PDL::dprod { sub PDL::dprod {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->dprodover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->dprodover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1666 "Ufunc.pm" #line 1746 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 zcheck =head2 zcheck
=for ref =for ref
Return the check for zero of all elements in an ndarray. Return the check for zero of all elements in an ndarray.
See the documentation for L</zcover> for more information. See the documentation for L</zcover> for more information.
=for usage =for usage
skipping to change at line 1385 skipping to change at line 1451
This routine handles bad values. This routine handles bad values.
=cut =cut
*zcheck = \&PDL::zcheck; *zcheck = \&PDL::zcheck;
sub PDL::zcheck { sub PDL::zcheck {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->zcover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->zcover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1696 "Ufunc.pm" #line 1776 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 and =head2 and
=for ref =for ref
Return the logical and of all elements in an ndarray. Return the logical and of all elements in an ndarray.
See the documentation for L</andover> for more information. See the documentation for L</andover> for more information.
=for usage =for usage
skipping to change at line 1413 skipping to change at line 1479
This routine handles bad values. This routine handles bad values.
=cut =cut
*and = \&PDL::and; *and = \&PDL::and;
sub PDL::and { sub PDL::and {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->andover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->andover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1726 "Ufunc.pm" #line 1806 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 band =head2 band
=for ref =for ref
Return the bitwise and of all elements in an ndarray. Return the bitwise and of all elements in an ndarray.
See the documentation for L</bandover> for more information. See the documentation for L</bandover> for more information.
=for usage =for usage
skipping to change at line 1441 skipping to change at line 1507
This routine handles bad values. This routine handles bad values.
=cut =cut
*band = \&PDL::band; *band = \&PDL::band;
sub PDL::band { sub PDL::band {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->bandover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->bandover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1756 "Ufunc.pm" #line 1836 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 or =head2 or
=for ref =for ref
Return the logical or of all elements in an ndarray. Return the logical or of all elements in an ndarray.
See the documentation for L</orover> for more information. See the documentation for L</orover> for more information.
=for usage =for usage
skipping to change at line 1469 skipping to change at line 1535
This routine handles bad values. This routine handles bad values.
=cut =cut
*or = \&PDL::or; *or = \&PDL::or;
sub PDL::or { sub PDL::or {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->orover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->orover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1786 "Ufunc.pm" #line 1866 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 bor =head2 bor
=for ref =for ref
Return the bitwise or of all elements in an ndarray. Return the bitwise or of all elements in an ndarray.
See the documentation for L</borover> for more information. See the documentation for L</borover> for more information.
=for usage =for usage
skipping to change at line 1497 skipping to change at line 1563
This routine handles bad values. This routine handles bad values.
=cut =cut
*bor = \&PDL::bor; *bor = \&PDL::bor;
sub PDL::bor { sub PDL::bor {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->borover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->borover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1816 "Ufunc.pm" #line 1896 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 min =head2 min
=for ref =for ref
Return the minimum of all elements in an ndarray. Return the minimum of all elements in an ndarray.
See the documentation for L</minimum> for more information. See the documentation for L</minimum> for more information.
=for usage =for usage
skipping to change at line 1525 skipping to change at line 1591
This routine handles bad values. This routine handles bad values.
=cut =cut
*min = \&PDL::min; *min = \&PDL::min;
sub PDL::min { sub PDL::min {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->minimum( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->minimum( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1846 "Ufunc.pm" #line 1926 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 max =head2 max
=for ref =for ref
Return the maximum of all elements in an ndarray. Return the maximum of all elements in an ndarray.
See the documentation for L</maximum> for more information. See the documentation for L</maximum> for more information.
=for usage =for usage
skipping to change at line 1553 skipping to change at line 1619
This routine handles bad values. This routine handles bad values.
=cut =cut
*max = \&PDL::max; *max = \&PDL::max;
sub PDL::max { sub PDL::max {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->maximum( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->maximum( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1876 "Ufunc.pm" #line 1956 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 median =head2 median
=for ref =for ref
Return the median of all elements in an ndarray. Return the median of all elements in an ndarray.
See the documentation for L</medover> for more information. See the documentation for L</medover> for more information.
=for usage =for usage
skipping to change at line 1581 skipping to change at line 1647
This routine handles bad values. This routine handles bad values.
=cut =cut
*median = \&PDL::median; *median = \&PDL::median;
sub PDL::median { sub PDL::median {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->medover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->medover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1906 "Ufunc.pm" #line 1986 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 mode =head2 mode
=for ref =for ref
Return the mode of all elements in an ndarray. Return the mode of all elements in an ndarray.
See the documentation for L</modeover> for more information. See the documentation for L</modeover> for more information.
=for usage =for usage
skipping to change at line 1609 skipping to change at line 1675
This routine handles bad values. This routine handles bad values.
=cut =cut
*mode = \&PDL::mode; *mode = \&PDL::mode;
sub PDL::mode { sub PDL::mode {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->modeover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->modeover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1936 "Ufunc.pm" #line 2016 "Ufunc.pm"
#line 550 "ufunc.pd" #line 568 "ufunc.pd"
=head2 oddmedian =head2 oddmedian
=for ref =for ref
Return the oddmedian of all elements in an ndarray. Return the oddmedian of all elements in an ndarray.
See the documentation for L</oddmedover> for more information. See the documentation for L</oddmedover> for more information.
=for usage =for usage
skipping to change at line 1637 skipping to change at line 1703
This routine handles bad values. This routine handles bad values.
=cut =cut
*oddmedian = \&PDL::oddmedian; *oddmedian = \&PDL::oddmedian;
sub PDL::oddmedian { sub PDL::oddmedian {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->oddmedover( $tmp=PDL->nullcreate($x) ); $x->clump(-1)->oddmedover( $tmp=PDL->nullcreate($x) );
$tmp; $tmp;
} }
#line 1966 "Ufunc.pm" #line 2046 "Ufunc.pm"
#line 580 "ufunc.pd" #line 598 "ufunc.pd"
=head2 any =head2 any
=for ref =for ref
Return true if any element in ndarray set Return true if any element in ndarray set
Useful in conditional expressions: Useful in conditional expressions:
=for example =for example
skipping to change at line 1698 skipping to change at line 1764
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> broadcast 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,
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";
-2 5 -2 5
=cut =cut
*minmax = \&PDL::minmax; *minmax = \&PDL::minmax;
sub PDL::minmax { sub PDL::minmax {
my ($x)=@_; my $tmp; my ($x)=@_; my $tmp;
my @arr = $x->clump(-1)->minmaximum; my @arr = $x->clump(-1)->minmaximum;
map $_->sclr, @arr[0,1]; # as scalars ! map $_->sclr, @arr[0,1]; # as scalars !
} }
#line 2048 "Ufunc.pm" #line 2128 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 medover =head2 medover
=for sig =for sig
Signature: (a(n); [o]b(); [t]tmp(n)) Signature: (a(n); [o]b(); [t]tmp(n))
=for ref =for ref
skipping to change at line 1750 skipping to change at line 1816
=for example =for example
$spectrum = medover $image->transpose $spectrum = medover $image->transpose
=for bad =for bad
medover processes bad values. medover processes bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 2092 "Ufunc.pm" #line 2172 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*medover = \&PDL::medover; *medover = \&PDL::medover;
#line 2099 "Ufunc.pm" #line 2179 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 oddmedover =head2 oddmedover
=for sig =for sig
Signature: (a(n); [o]b(); [t]tmp(n)) Signature: (a(n); [o]b(); [t]tmp(n))
=for ref =for ref
skipping to change at line 1796 skipping to change at line 1862
value. The lower-odd median is just the lower of these two values value. The lower-odd median is just the lower of these two values
and so it ALWAYS sits on an actual data value which is useful in and so it ALWAYS sits on an actual data value which is useful in
some circumstances. some circumstances.
=for bad =for bad
oddmedover processes bad values. oddmedover processes bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 2151 "Ufunc.pm" #line 2231 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*oddmedover = \&PDL::oddmedover; *oddmedover = \&PDL::oddmedover;
#line 2158 "Ufunc.pm" #line 2238 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 modeover =head2 modeover
=for sig =for sig
Signature: (data(n); [o]out(); [t]sorted(n)) Signature: (data(n); [o]out(); [t]sorted(n))
=for ref =for ref
skipping to change at line 1845 skipping to change at line 1911
C<modeover> treats BAD the same as any other value: if C<modeover> treats BAD the same as any other value: if
BAD is the most common element, the returned value is also BAD. BAD is the most common element, the returned value is also BAD.
=for bad =for bad
modeover does not process bad values. modeover does not process bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 2212 "Ufunc.pm" #line 2292 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*modeover = \&PDL::modeover; *modeover = \&PDL::modeover;
#line 2219 "Ufunc.pm" #line 2299 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 pctover =head2 pctover
=for sig =for sig
Signature: (a(n); p(); [o]b(); [t]tmp(n)) Signature: (a(n); p(); [o]b(); [t]tmp(n))
=for ref =for ref
skipping to change at line 1892 skipping to change at line 1958
implemented here is based on the interpolation variant described at implemented here is based on the interpolation variant described at
L<http://en.wikipedia.org/wiki/Percentile> as used by Microsoft Excel L<http://en.wikipedia.org/wiki/Percentile> as used by Microsoft Excel
and recommended by NIST. and recommended by NIST.
=for bad =for bad
pctover processes bad values. pctover processes bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 2270 "Ufunc.pm" #line 2350 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*pctover = \&PDL::pctover; *pctover = \&PDL::pctover;
#line 2277 "Ufunc.pm" #line 2357 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 oddpctover =head2 oddpctover
=for sig =for sig
Signature: (a(n); p(); [o]b(); [t]tmp(n)) Signature: (a(n); p(); [o]b(); [t]tmp(n))
=for ref =for ref
skipping to change at line 1937 skipping to change at line 2003
falls between two values, the nearest data value is the result. falls between two values, the nearest data value is the result.
The algorithm implemented is from the textbook version described The algorithm implemented is from the textbook version described
first at L<http://en.wikipedia.org/wiki/Percentile>. first at L<http://en.wikipedia.org/wiki/Percentile>.
=for bad =for bad
oddpctover processes bad values. oddpctover processes bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 2326 "Ufunc.pm" #line 2406 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*oddpctover = \&PDL::oddpctover; *oddpctover = \&PDL::oddpctover;
#line 2333 "Ufunc.pm" #line 2413 "Ufunc.pm"
#line 985 "ufunc.pd" #line 1003 "ufunc.pd"
=head2 pct =head2 pct
=for ref =for ref
Return the specified percentile of all elements in an ndarray. The Return the specified percentile of all elements in an ndarray. The
specified percentile (p) must be between 0.0 and 1.0. When the specified percentile (p) must be between 0.0 and 1.0. When the
specified percentile falls between data points, the result is specified percentile falls between data points, the result is
interpolated. interpolated.
skipping to change at line 1967 skipping to change at line 2033
$x = pct($data, $pct); $x = pct($data, $pct);
=cut =cut
*pct = \&PDL::pct; *pct = \&PDL::pct;
sub PDL::pct { sub PDL::pct {
my($x, $p) = @_; my($x, $p) = @_;
$x->clump(-1)->pctover($p, my $tmp=PDL->nullcreate($x)); $x->clump(-1)->pctover($p, my $tmp=PDL->nullcreate($x));
$tmp; $tmp;
} }
#line 2360 "Ufunc.pm" #line 2440 "Ufunc.pm"
#line 1010 "ufunc.pd" #line 1028 "ufunc.pd"
=head2 oddpct =head2 oddpct
=for ref =for ref
Return the specified percentile of all elements in an ndarray. The Return the specified percentile of all elements in an ndarray. The
specified percentile must be between 0.0 and 1.0. When the specified specified percentile must be between 0.0 and 1.0. When the specified
percentile falls between two values, the nearest data value is the percentile falls between two values, the nearest data value is the
result. result.
skipping to change at line 1992 skipping to change at line 2058
$x = oddpct($data, $pct); $x = oddpct($data, $pct);
=cut =cut
*oddpct = \&PDL::oddpct; *oddpct = \&PDL::oddpct;
sub PDL::oddpct { sub PDL::oddpct {
my($x, $p) = @_; my($x, $p) = @_;
$x->clump(-1)->oddpctover($p, my $tmp=PDL->nullcreate($x)); $x->clump(-1)->oddpctover($p, my $tmp=PDL->nullcreate($x));
$tmp; $tmp;
} }
#line 2387 "Ufunc.pm" #line 2467 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 qsort =head2 qsort
=for sig =for sig
Signature: (a(n); [o]b(n)) Signature: (a(n); [o]b(n))
=for ref =for ref
skipping to change at line 2020 skipping to change at line 2086
=for bad =for bad
Bad values are moved to the end of the array: Bad values are moved to the end of the array:
pdl> p $y pdl> p $y
[42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD] [42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD]
pdl> p qsort($y) pdl> p qsort($y)
[22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD] [22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD]
=cut =cut
#line 2423 "Ufunc.pm" #line 2503 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*qsort = \&PDL::qsort; *qsort = \&PDL::qsort;
#line 2430 "Ufunc.pm" #line 2510 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 qsorti =head2 qsorti
=for sig =for sig
Signature: (a(n); indx [o]indx(n)) Signature: (a(n); indx [o]indx(n))
=for ref =for ref
skipping to change at line 2054 skipping to change at line 2120
=for bad =for bad
Bad elements are moved to the end of the array: Bad elements are moved to the end of the array:
pdl> p $y pdl> p $y
[42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD] [42 47 98 BAD 22 96 74 41 79 76 96 BAD 32 76 25 59 BAD 96 32 BAD]
pdl> p $y->index( qsorti($y) ) pdl> p $y->index( qsorti($y) )
[22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD] [22 25 32 32 41 42 47 59 74 76 76 79 96 96 96 98 BAD BAD BAD BAD]
=cut =cut
#line 2467 "Ufunc.pm" #line 2547 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*qsorti = \&PDL::qsorti; *qsorti = \&PDL::qsorti;
#line 2474 "Ufunc.pm" #line 2554 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 qsortvec =head2 qsortvec
=for sig =for sig
Signature: (a(n,m); [o]b(n,m)) Signature: (a(n,m); [o]b(n,m))
=for ref =for ref
skipping to change at line 2102 skipping to change at line 2168
pdl> p $p = pdl("[0 0] [-100 0] [BAD 0] [100 0]")->qsortvec pdl> p $p = pdl("[0 0] [-100 0] [BAD 0] [100 0]")->qsortvec
[ [
[-100 0] [-100 0]
[ 0 0] [ 0 0]
[ 100 0] [ 100 0]
[ BAD 0] [ BAD 0]
] ]
=cut =cut
#line 2525 "Ufunc.pm" #line 2605 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*qsortvec = \&PDL::qsortvec; *qsortvec = \&PDL::qsortvec;
#line 2532 "Ufunc.pm" #line 2612 "Ufunc.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 qsortveci =head2 qsortveci
=for sig =for sig
Signature: (a(n,m); indx [o]indx(m)) Signature: (a(n,m); indx [o]indx(m))
=for ref =for ref
skipping to change at line 2138 skipping to change at line 2204
Additional dimensions are broadcasted 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).
=for bad =for bad
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>.
=cut =cut
#line 2571 "Ufunc.pm" #line 2651 "Ufunc.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*qsortveci = \&PDL::qsortveci; *qsortveci = \&PDL::qsortveci;
#line 2578 "Ufunc.pm" #line 2658 "Ufunc.pm"
#line 1280 "ufunc.pd" #line 1298 "ufunc.pd"
=head1 AUTHOR =head1 AUTHOR
Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu). Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu).
Contributions by Christian Soeller (c.soeller@auckland.ac.nz) Contributions by Christian Soeller (c.soeller@auckland.ac.nz)
and Karl Glazebrook (kgb@aaoepp.aao.gov.au). All rights and Karl Glazebrook (kgb@aaoepp.aao.gov.au). All rights
reserved. There is no warranty. You are allowed to redistribute this reserved. There is no warranty. You are allowed to redistribute this
software / documentation under certain conditions. For details, see software / documentation under certain conditions. For details, see
the file COPYING in the PDL distribution. If this file is separated the file COPYING in the PDL distribution. If this file is separated
from the PDL distribution, the copyright notice should be included in from the PDL distribution, the copyright notice should be included in
the file. the file.
=cut =cut
#line 2599 "Ufunc.pm" #line 2679 "Ufunc.pm"
# Exit with OK status # Exit with OK status
1; 1;
 End of changes. 91 change blocks. 
89 lines changed or deleted 161 lines changed or added

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