Below is a documented test script which I hope explains the situation. If I have multiple piddles that I concatenate with pdl($thing1, $thing2), and those things have bad values, the result will copy the value representing bad values, but will not copy the bad flag. This is not a problem with cat($thing1, $thing2).
I originally encountered this problem on a Linux machine running PDL v2.007 (from Ubuntu repositories), but could reproduce the problem on a Mac running v2.016. I will attach perldl -V for both systems.
use strict;
use warnings;
use PDL;
use Test::More;
# First create a piddle with bad data:
my $foo = pdl(1, 2, 3, 1);
$foo = $foo->setvaltobad(1);
ok($foo->badflag, 'Able to create piddle with bad flag')
or diag "foo is $foo, expected [BAD 2 3 BAD]";
is($foo->nbad, 2, 'We have a bad values')
or diag "foo is $foo, expected [BAD 2 3 BAD]";
# Use pdl($foo) to copy it:
my $bar = pdl($foo);
ok($bar->badflag, 'pdl($bad_thing) copies bad flag')
or diag "bar is $bar, expected [BAD 2 3 BAD]";
is($bar->nbad, 2, 'pdl($bad_thing) copies bad values')
or diag "bar is $bar, expected [BAD 2 3 BAD]";
# Create a combined piddle with cat()
my $quux = cat($foo, $bar);
ok($quux->badflag, 'cat($bad_thing, $bad_thing) copies bad flag')
or diag "quux is ${quux}expected\n[\n [BAD 2 3 BAD]\n [BAD 2 3 BAD]\n]";
is($quux->nbad, 4, 'cat($bad_thing, $bad_thing) copies bad values')
or diag "quux is ${quux}expected\n[\n [BAD 2 3 BAD]\n [BAD 2 3 BAD]\n]";
# Create a combined piddle with pdl()
my $baz = pdl($foo, $bar);
ok($baz->badflag, 'pdl($bad_thing, $bad_thing) copies bad flag')
or diag "baz is ${baz}expected\n[\n [BAD 2 3 BAD]\n [BAD 2 3 BAD]\n]";
is($baz->nbad, 4, 'pdl($bad_thing, $bad_thing) copies bad values')
or diag "baz is ${baz}expected\n[\n [BAD 2 3 BAD]\n [BAD 2 3 BAD]\n]";
done_testing;
Here's the perldl -V for the Mac
In case it isn't clear, the problem is that the first six tests pass, but the last two do not. :-)
Possibly related to #308 (https://sourceforge.net/p/pdl/bugs/308/), especially if pdl( $pdla, $pdlb) works by creating the destination piddle and .= the source piddles into it.
See the previous bug/feature request:
#308 propagate badflag with .=
https://sourceforge.net/p/pdl/bugs/308/
On Fri, Jun 10, 2016 at 12:38 PM, Derek Lamb lambd@users.sf.net wrote:
Related
Bugs:
#424works for me on current master -- thanks Craig & Zaki!