bad.pd (PDL-2.080) | : | bad.pd (PDL-2.081) | ||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
use warnings; | use warnings; | |||
use PDL::Types qw(ppdefs_all types); | use PDL::Types qw(ppdefs_all types); | |||
my $A = [ppdefs_all()]; | my $A = [ppdefs_all()]; | |||
my $AF = [map $_->ppsym, grep !$_->integer, types()]; # all including complex | my $AF = [map $_->ppsym, grep !$_->integer, types()]; # all including complex | |||
######################################################### | ######################################################### | |||
pp_addhdr(' | pp_addhdr(' | |||
#include <math.h> | #include <math.h> | |||
#include "pdlperl.h" | ||||
'); | '); | |||
pp_add_exported( '', | pp_add_exported( '', | |||
'badflag check_badflag badvalue orig_badvalue nbad nbadover ngoo d ngoodover ' . | 'badflag check_badflag badvalue orig_badvalue nbad nbadover ngoo d ngoodover ' . | |||
'setbadat ' ); | 'setbadat ' ); | |||
## Header | ## Header | |||
pp_addpm({At=>'Top'},<<'!NO!SUBS!'); | pp_addpm({At=>'Top'},<<'!NO!SUBS!'); | |||
=head1 NAME | =head1 NAME | |||
skipping to change at line 176 | skipping to change at line 175 | |||
$x->badvalue (3); $x->badflag (1); | $x->badvalue (3); $x->badflag (1); | |||
$y = sequence (10); | $y = sequence (10); | |||
$y->badvalue (4); $y->badflag (1); | $y->badvalue (4); $y->badflag (1); | |||
will set $x to be C<[0 1 2 BAD 4 5 6 7 8 9]> and $y to be | will set $x to be C<[0 1 2 BAD 4 5 6 7 8 9]> and $y to be | |||
C<[0 1 2 3 BAD 5 6 7 8 9]>. | C<[0 1 2 3 BAD 5 6 7 8 9]>. | |||
=for bad | =for bad | |||
This method does not care if you call it on an input ndarray | This method does not care if you call it on an input ndarray | |||
that has bad values. It always returns a Perl scalar | that has bad values. It always returns an ndarray | |||
with the current or new bad value. | with the current or new bad value. | |||
=head2 orig_badvalue | =head2 orig_badvalue | |||
=for ref | =for ref | |||
returns the original value used to represent bad values for | returns the original value used to represent bad values for | |||
a given type. | a given type. | |||
This routine operates the same as L</badvalue>, | This routine operates the same as L</badvalue>, | |||
skipping to change at line 201 | skipping to change at line 200 | |||
=for example | =for example | |||
$orig_badval = orig_badvalue( float ); | $orig_badval = orig_badvalue( float ); | |||
$x = ones(ushort,10); | $x = ones(ushort,10); | |||
print "The original bad data value for ushort is: ", | print "The original bad data value for ushort is: ", | |||
$x->orig_badvalue(), "\n"; | $x->orig_badvalue(), "\n"; | |||
=for bad | =for bad | |||
This method does not care if you call it on an input ndarray | This method does not care if you call it on an input ndarray | |||
that has bad values. It always returns a Perl scalar | that has bad values. It always returns an ndarray | |||
with the original bad value for the associated type. | with the original bad value for the associated type. | |||
=head2 check_badflag | =head2 check_badflag | |||
=for ref | =for ref | |||
Clear the badflag of an ndarray if it does not | Clear the badflag of an ndarray if it does not | |||
contain any bad values | contain any bad values | |||
Given an ndarray whose bad flag is set, check whether it | Given an ndarray whose bad flag is set, check whether it | |||
skipping to change at line 559 | skipping to change at line 558 | |||
=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); | |||
=for bad | =for bad | |||
Accepts good and bad input ndarrays; output is a Perl scalar | Accepts good and bad input ndarrays; output is an ndarray | |||
and therefore is always good. | and is always good. | |||
=head2 ngood | =head2 ngood | |||
=for ref | =for ref | |||
Returns the number of good values in an ndarray | Returns the number of good values in an ndarray | |||
=for usage | =for usage | |||
$x = ngood($data); | $x = ngood($data); | |||
=for bad | =for bad | |||
Accepts good and bad input ndarrays; output is a Perl scalar | Accepts good and bad input ndarrays; output is an ndarray | |||
and therefore is always good. | and is always good. | |||
=head2 setbadat | =head2 setbadat | |||
=for ref | =for ref | |||
Set the value to bad at a given position. | Set the value to bad at a given position. | |||
=for usage | =for usage | |||
setbadat $ndarray, @position | setbadat $ndarray, @position | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 6 lines changed or added |