"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/Bad.pm" 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).

Bad.pm  (PDL-2.074):Bad.pm  (PDL-2.075)
skipping to change at line 17 skipping to change at line 17
our %EXPORT_TAGS = (Func=>\@EXPORT_OK); our %EXPORT_TAGS = (Func=>\@EXPORT_OK);
use PDL::Core; use PDL::Core;
use PDL::Exporter; use PDL::Exporter;
use DynaLoader; use DynaLoader;
our @ISA = ( 'PDL::Exporter','DynaLoader' ); our @ISA = ( 'PDL::Exporter','DynaLoader' );
push @PDL::Core::PP, __PACKAGE__; push @PDL::Core::PP, __PACKAGE__;
bootstrap PDL::Bad ; bootstrap PDL::Bad ;
#line 21 "bad.pd" #line 20 "bad.pd"
=head1 NAME =head1 NAME
PDL::Bad - PDL always processes bad values PDL::Bad - PDL always processes bad values
=head1 DESCRIPTION =head1 DESCRIPTION
This module is loaded when you do C<use PDL>, This module is loaded when you do C<use PDL>,
C<Use PDL::Lite> or C<PDL::LiteF>. C<Use PDL::Lite> or C<PDL::LiteF>.
skipping to change at line 57 skipping to change at line 57
Set to 1 as of PDL 2.040 as always available. Set to 1 as of PDL 2.040 as always available.
=item $PDL::Bad::Status =item $PDL::Bad::Status
Set to 1 as of PDL 2.035 as always available. Set to 1 as of PDL 2.035 as always available.
=back =back
=cut =cut
#line 65 "Bad.pm" #line 66 "Bad.pm"
=head1 FUNCTIONS =head1 FUNCTIONS
=cut =cut
#line 64 "bad.pd" #line 63 "bad.pd"
# really should be constants # really should be constants
$PDL::Bad::Status = 1; $PDL::Bad::Status = 1;
$PDL::Bad::UseNaN = 0; $PDL::Bad::UseNaN = 0;
$PDL::Bad::PerPdl = 1; $PDL::Bad::PerPdl = 1;
use strict; use strict;
use PDL::Types; use PDL::Types;
use PDL::Primitive; use PDL::Primitive;
############################################################ ############################################################
############################################################ ############################################################
#line 93 "Bad.pm" #line 95 "Bad.pm"
#line 114 "bad.pd"
#line 115 "bad.pd"
############################################################ ############################################################
############################################################ ############################################################
*badflag = \&PDL::badflag; *badflag = \&PDL::badflag;
*badvalue = \&PDL::badvalue; *badvalue = \&PDL::badvalue;
*orig_badvalue = \&PDL::orig_badvalue; *orig_badvalue = \&PDL::orig_badvalue;
############################################################ ############################################################
############################################################ ############################################################
skipping to change at line 213 skipping to change at line 214
=cut =cut
*check_badflag = \&PDL::check_badflag; *check_badflag = \&PDL::check_badflag;
sub PDL::check_badflag { sub PDL::check_badflag {
my $pdl = shift; my $pdl = shift;
$pdl->badflag(0) if $pdl->badflag and $pdl->nbad == 0; $pdl->badflag(0) if $pdl->badflag and $pdl->nbad == 0;
return $pdl->badflag; return $pdl->badflag;
} # sub: check_badflag() } # sub: check_badflag()
#line 231 "Bad.pm" #line 234 "Bad.pm"
#line 326 "bad.pd" #line 325 "bad.pd"
# note: # note:
# if sent an ndarray, we have to change its bad values # if sent an ndarray, we have to change its bad values
# (but only if it contains bad values) # (but only if it contains bad values)
# - there's a slight overhead in that the badflag is # - there's a slight overhead in that the badflag is
# cleared and then set (hence propagating to all # cleared and then set (hence propagating to all
# children) but we'll ignore that) # children) but we'll ignore that)
# - we can ignore this for float/double types # - we can ignore this for float/double types
# since we can't change the bad value # since we can't change the bad value
# #
skipping to change at line 263 skipping to change at line 264
$num = $self->enum; $num = $self->enum;
} else { } else {
# assume it's a number # assume it's a number
$num = $self; $num = $self;
} }
PDL::_default_badvalue_int($num); PDL::_default_badvalue_int($num);
} }
############################################################ ############################################################
############################################################ ############################################################
#line 283 "Bad.pm" #line 287 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 isbad =head2 isbad
=for sig =for sig
Signature: (a(); int [o]b()) Signature: (a(); int [o]b())
=for ref =for ref
Returns a binary mask indicating which values of Returns a binary mask indicating which values of
skipping to change at line 297 skipping to change at line 298
print $y, "\n"; print $y, "\n";
[0 1 0] [0 1 0]
=for bad =for bad
This method works with input ndarrays that are bad. The output ndarray This method works with input ndarrays that are bad. The output ndarray
will never contain bad values, but its bad value flag will be the will never contain bad values, but its bad value flag will be the
same as the input ndarray's flag. same as the input ndarray's flag.
=cut =cut
#line 322 "Bad.pm" #line 327 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*isbad = \&PDL::isbad; *isbad = \&PDL::isbad;
#line 328 "Bad.pm" #line 334 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 isgood =head2 isgood
=for sig =for sig
Signature: (a(); int [o]b()) Signature: (a(); int [o]b())
=for ref =for ref
Is a value good? Is a value good?
skipping to change at line 334 skipping to change at line 336
print $y, "\n"; print $y, "\n";
[1 0 1] [1 0 1]
=for bad =for bad
This method works with input ndarrays that are bad. The output ndarray This method works with input ndarrays that are bad. The output ndarray
will never contain bad values, but its bad value flag will be the will never contain bad values, but its bad value flag will be the
same as the input ndarray's flag. same as the input ndarray's flag.
=cut =cut
#line 366 "Bad.pm" #line 373 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*isgood = \&PDL::isgood; *isgood = \&PDL::isgood;
#line 372 "Bad.pm" #line 380 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 nbadover =head2 nbadover
=for sig =for sig
Signature: (a(n); indx [o] b()) Signature: (a(n); indx [o] b())
=for ref =for ref
Find the number of bad elements along the 1st dimension. Find the number of bad elements along the 1st dimension.
skipping to change at line 373 skipping to change at line 376
$spectrum = nbadover $image->transpose $spectrum = nbadover $image->transpose
=for bad =for bad
nbadover processes input values that are bad. The output ndarray will not have nbadover processes input values that are bad. The output ndarray will not have
any bad values, but the bad flag will be set if the input ndarray had its bad any bad values, but the bad flag will be set if the input ndarray had its bad
flag set. flag set.
=cut =cut
#line 412 "Bad.pm" #line 421 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*nbadover = \&PDL::nbadover; *nbadover = \&PDL::nbadover;
#line 418 "Bad.pm" #line 428 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 ngoodover =head2 ngoodover
=for sig =for sig
Signature: (a(n); indx [o] b()) Signature: (a(n); indx [o] b())
=for ref =for ref
Find the number of good elements along the 1st dimension. Find the number of good elements along the 1st dimension.
skipping to change at line 413 skipping to change at line 417
$spectrum = ngoodover $image->transpose $spectrum = ngoodover $image->transpose
=for bad =for bad
ngoodover processes input values that are bad. The output ndarray will not have ngoodover processes input values that are bad. The output ndarray will not have
any bad values, but the bad flag will be set if the input ndarray had its bad any bad values, but the bad flag will be set if the input ndarray had its bad
flag set. flag set.
=cut =cut
#line 459 "Bad.pm" #line 470 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*ngoodover = \&PDL::ngoodover; *ngoodover = \&PDL::ngoodover;
#line 465 "Bad.pm" #line 477 "Bad.pm"
#line 561 "bad.pd" #line 560 "bad.pd"
*nbad = \&PDL::nbad; *nbad = \&PDL::nbad;
sub PDL::nbad { sub PDL::nbad {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->nbadover($tmp=PDL->nullcreate($x) ); $x->clump(-1)->nbadover($tmp=PDL->nullcreate($x) );
return $tmp; return $tmp;
} }
#line 477 "Bad.pm" #line 490 "Bad.pm"
#line 561 "bad.pd" #line 560 "bad.pd"
*ngood = \&PDL::ngood; *ngood = \&PDL::ngood;
sub PDL::ngood { sub PDL::ngood {
my($x) = @_; my $tmp; my($x) = @_; my $tmp;
$x->clump(-1)->ngoodover($tmp=PDL->nullcreate($x) ); $x->clump(-1)->ngoodover($tmp=PDL->nullcreate($x) );
return $tmp; return $tmp;
} }
#line 489 "Bad.pm" #line 503 "Bad.pm"
#line 573 "bad.pd" #line 572 "bad.pd"
=head2 nbad =head2 nbad
=for ref =for ref
Returns the number of bad values in an ndarray Returns the number of bad values in an ndarray
=for usage =for usage
$x = nbad($data); $x = nbad($data);
skipping to change at line 515 skipping to change at line 520
=cut =cut
*setbadat = \&PDL::setbadat; *setbadat = \&PDL::setbadat;
sub PDL::setbadat { sub PDL::setbadat {
barf 'Usage: setbadat($pdl, $x, $y, ...)' if $#_<1; barf 'Usage: setbadat($pdl, $x, $y, ...)' if $#_<1;
my $self = shift; my $self = shift;
PDL::Core::set_c ($self, [@_], $self->badvalue); PDL::Core::set_c ($self, [@_], $self->badvalue);
$self->badflag(1); $self->badflag(1);
return $self; return $self;
} }
#line 569 "Bad.pm" #line 584 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setbadif =head2 setbadif
=for sig =for sig
Signature: (a(); int mask(); [o]b()) Signature: (a(); int mask(); [o]b())
=for ref =for ref
Set elements bad based on the supplied mask, otherwise Set elements bad based on the supplied mask, otherwise
skipping to change at line 561 skipping to change at line 566
The output always has its bad flag set, even if it does not contain The output always has its bad flag set, even if it does not contain
any bad values (use L</check_badflag> to check any bad values (use L</check_badflag> to check
whether there are any bad values in the output). whether there are any bad values in the output).
The input ndarray can have bad values: any bad values in the input ndarrays The input ndarray can have bad values: any bad values in the input ndarrays
are copied across to the output ndarray. are copied across to the output ndarray.
Also see L</setvaltobad> and L</setnantobad>. Also see L</setvaltobad> and L</setnantobad>.
=cut =cut
#line 620 "Bad.pm" #line 636 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setbadif = \&PDL::setbadif; *setbadif = \&PDL::setbadif;
#line 626 "Bad.pm" #line 643 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setvaltobad =head2 setvaltobad
=for sig =for sig
Signature: (a(); [o]b(); double value) Signature: (a(); [o]b(); double value)
=for ref =for ref
Set bad all those elements which equal the supplied value. Set bad all those elements which equal the supplied value.
skipping to change at line 598 skipping to change at line 604
if you want to convert NaN to the bad value. if you want to convert NaN to the bad value.
=for bad =for bad
The output always has its bad flag set, even if it does not contain The output always has its bad flag set, even if it does not contain
any bad values (use L</check_badflag> to check any bad values (use L</check_badflag> to check
whether there are any bad values in the output). whether there are any bad values in the output).
Any bad values in the input ndarrays are copied across to the output ndarray. Any bad values in the input ndarrays are copied across to the output ndarray.
=cut =cut
#line 664 "Bad.pm" #line 682 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setvaltobad = \&PDL::setvaltobad; *setvaltobad = \&PDL::setvaltobad;
#line 670 "Bad.pm" #line 689 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setnantobad =head2 setnantobad
=for sig =for sig
Signature: (a(); [o]b()) Signature: (a(); [o]b())
=for ref =for ref
Sets NaN values (for complex, where either is NaN) in the input ndarray bad Sets NaN values (for complex, where either is NaN) in the input ndarray bad
skipping to change at line 633 skipping to change at line 640
=for bad =for bad
This method can process ndarrays with bad values: those bad values This method can process ndarrays with bad values: those bad values
are propagated into the output ndarray. Any value that is not a number are propagated into the output ndarray. Any value that is not a number
(before version 2.040 the test was for "not finite") (before version 2.040 the test was for "not finite")
is also set to bad in the output ndarray. If all values from the input is also set to bad in the output ndarray. If all values from the input
ndarray are good, the output ndarray will B<not> have its ndarray are good, the output ndarray will B<not> have its
bad flag set. bad flag set.
=cut =cut
#line 706 "Bad.pm" #line 726 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setnantobad = \&PDL::setnantobad; *setnantobad = \&PDL::setnantobad;
#line 712 "Bad.pm" #line 733 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setinftobad =head2 setinftobad
=for sig =for sig
Signature: (a(); [o]b()) Signature: (a(); [o]b())
=for ref =for ref
Sets non-finite values (for complex, where either is non-finite) in Sets non-finite values (for complex, where either is non-finite) in
skipping to change at line 667 skipping to change at line 675
=for bad =for bad
This method can process ndarrays with bad values: those bad values This method can process ndarrays with bad values: those bad values
are propagated into the output ndarray. Any value that is not finite are propagated into the output ndarray. Any value that is not finite
is also set to bad in the output ndarray. If all values from the input is also set to bad in the output ndarray. If all values from the input
ndarray are finite, the output ndarray will B<not> have its ndarray are finite, the output ndarray will B<not> have its
bad flag set. bad flag set.
=cut =cut
#line 747 "Bad.pm" #line 769 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setinftobad = \&PDL::setinftobad; *setinftobad = \&PDL::setinftobad;
#line 753 "Bad.pm" #line 776 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setnonfinitetobad =head2 setnonfinitetobad
=for sig =for sig
Signature: (a(); [o]b()) Signature: (a(); [o]b())
=for ref =for ref
Sets non-finite values (for complex, where either is non-finite) in Sets non-finite values (for complex, where either is non-finite) in
skipping to change at line 701 skipping to change at line 710
=for bad =for bad
This method can process ndarrays with bad values: those bad values This method can process ndarrays with bad values: those bad values
are propagated into the output ndarray. Any value that is not finite are propagated into the output ndarray. Any value that is not finite
is also set to bad in the output ndarray. If all values from the input is also set to bad in the output ndarray. If all values from the input
ndarray are finite, the output ndarray will B<not> have its ndarray are finite, the output ndarray will B<not> have its
bad flag set. bad flag set.
=cut =cut
#line 788 "Bad.pm" #line 812 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setnonfinitetobad = \&PDL::setnonfinitetobad; *setnonfinitetobad = \&PDL::setnonfinitetobad;
#line 794 "Bad.pm" #line 819 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setbadtonan =head2 setbadtonan
=for sig =for sig
Signature: (a(); [o] b();) Signature: (a(); [o] b();)
=for ref =for ref
Sets Bad values to NaN Sets Bad values to NaN
skipping to change at line 735 skipping to change at line 745
$x->inplace->setbadtonan; $x->inplace->setbadtonan;
=for bad =for bad
This method processes input ndarrays with bad values. The output ndarrays will This method processes input ndarrays with bad values. The output ndarrays will
not contain bad values (insofar as NaN is not Bad as far as PDL is concerned) not contain bad values (insofar as NaN is not Bad as far as PDL is concerned)
and the output ndarray does not have its bad flag set. As an inplace and the output ndarray does not have its bad flag set. As an inplace
operation, it clears the bad flag. operation, it clears the bad flag.
=cut =cut
#line 829 "Bad.pm" #line 855 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setbadtonan = \&PDL::setbadtonan; *setbadtonan = \&PDL::setbadtonan;
#line 835 "Bad.pm" #line 862 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 setbadtoval =head2 setbadtoval
=for sig =for sig
Signature: (a(); [o]b(); double newval) Signature: (a(); [o]b(); double newval)
=for ref =for ref
Replace any bad values by a (non-bad) value. Replace any bad values by a (non-bad) value.
skipping to change at line 769 skipping to change at line 780
print "a badflag: ", $x->badflag, "\n"; print "a badflag: ", $x->badflag, "\n";
a badflag: 0 a badflag: 0
=for bad =for bad
The output always has its bad flag cleared. The output always has its bad flag cleared.
If the input ndarray does not have its bad flag set, then If the input ndarray does not have its bad flag set, then
values are copied with no replacement. values are copied with no replacement.
=cut =cut
#line 870 "Bad.pm" #line 898 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*setbadtoval = \&PDL::setbadtoval; *setbadtoval = \&PDL::setbadtoval;
#line 876 "Bad.pm" #line 905 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 copybad =head2 copybad
=for sig =for sig
Signature: (a(); mask(); [o]b()) Signature: (a(); mask(); [o]b())
=for ref =for ref
Copies values from one ndarray to another, setting them Copies values from one ndarray to another, setting them
skipping to change at line 812 skipping to change at line 824
$c = $x + $mask * 0 $c = $x + $mask * 0
=for bad =for bad
This handles input ndarrays that are bad. If either C<$x> This handles input ndarrays that are bad. If either C<$x>
or C<$mask> have bad values, those values will be marked or C<$mask> have bad values, those values will be marked
as bad in the output ndarray and the output ndarray will have as bad in the output ndarray and the output ndarray will have
its bad value flag set to true. its bad value flag set to true.
=cut =cut
#line 920 "Bad.pm" #line 950 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*copybad = \&PDL::copybad; *copybad = \&PDL::copybad;
#line 926 "Bad.pm" #line 957 "Bad.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 locf =head2 locf
=for sig =for sig
Signature: (a(n); [o]b(n)) Signature: (a(n); [o]b(n))
=for ref =for ref
Last Observation Carried Forward - replace Last Observation Carried Forward - replace
every BAD value with the most recent non-BAD value prior to it. every BAD value with the most recent non-BAD value prior to it.
Any leading BADs will be set to 0. Any leading BADs will be set to 0.
=for bad =for bad
locf processes bad values. locf 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 953 "Bad.pm" #line 985 "Bad.pm"
#line 1060 "../../blib/lib/PDL/PP.pm"
#line 1061 "../../blib/lib/PDL/PP.pm"
*locf = \&PDL::locf; *locf = \&PDL::locf;
#line 959 "Bad.pm" #line 992 "Bad.pm"
#line 1143 "bad.pd" #line 1142 "bad.pd"
=head1 AUTHOR =head1 AUTHOR
Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006. Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006.
The per-ndarray bad value support is by Heiko Klein (2006). The per-ndarray bad value support is by Heiko Klein (2006).
CPAN documentation fixes by David Mertens (2010, 2013). CPAN documentation fixes by David Mertens (2010, 2013).
All rights reserved. There is no warranty. You are allowed to All rights reserved. There is no warranty. You are allowed to
redistribute this software / documentation under certain conditions. For redistribute this software / documentation under certain conditions. For
details, see the file COPYING in the PDL distribution. If this file is details, see the file COPYING in the PDL distribution. If this file is
separated from the PDL distribution, the copyright notice should be separated from the PDL distribution, the copyright notice should be
included in the file. included in the file.
=cut =cut
#line 982 "Bad.pm" #line 1016 "Bad.pm"
# Exit with OK status # Exit with OK status
1; 1;
 End of changes. 68 change blocks. 
68 lines changed or deleted 82 lines changed or added

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