Further investigation of what I agree are bugs. I was already aware of issues with dataflow and clump, thanks to the progenitor of PDL, the mighty Karl Glazebrook himself. See
https://sourceforge.net/p/pdl/mailman/message/58730063/ for my initial thoughts, though since that email, I've made decent progress in tracking that down, and am just about at the stage where I think I've fixed the 3rd point in my list there (deliberately doing it in that order). That's involved finding subtle behaviours that downstream modules, especially Data::Frame, rely on, but weren't in the main-PDL tests (they are now).
Here is the test I've constructed from your cases above. Interestingly, only the [0,1] case (don't physicalise the clump-ee, and mutate the clump-ee rather than the original) works perfectly, as you note above. Also interestingly, my first go at this using $pdl->flat->unpdl produced different results from $pdl->unpdl.
for ([0,0], [0,1], [1,0], [1,1]) {
my ($phys_clump, $mutate_orig) = @$_;
my $orig = zeroes 3,2,1;
my $clump = $orig->clump(1,2);
$clump->make_physvaffine if $phys_clump;
($mutate_orig ? $orig : $clump) .= 3;
my $got = $orig->unpdl;
is_deeply $got, [[[(3)x3],[(3)x3]]], "phys_clump=$phys_clump mutate_
+orig=$mutate_orig orig" or diag explain $got;
$got = $clump->unpdl;
is_deeply $got, [[(3)x3],[(3)x3]], "phys_clump=$phys_clump mutate_or
+ig=$mutate_orig clump" or diag explain $got;
$got = $clump->uniqvec->unpdl;
is_deeply $got, [[(3)x3]], "phys_clump=$phys_clump mutate_orig=$muta
+te_orig uniqvec" or diag explain $got;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.