in reply to Re^5: Imagecat - show color images in a terminal ('Memoization' for PDL)
in thread Imagecat - show color images in a terminal

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; }