Thanks to all for their investigation, and also for reporting this!

This is indeed a fascinating problem. The reason why the higher-dim output ndarrays have dims that start with 1, then are powers of the original size, is because the pdl struct has a def_dims array, size 6. Straight after that is the def_dimincs (stride-size at each dimension), also size 6 (the API has code to allocate memory if >6 dims, clearly that's not getting called here). Both are being used, even though there are more than 6 dims. Reading the array of dims will therefore give data that starts out correct, then looks crackers. It's almost certainly a bug in the rangeb code, since higher-dim ndarrays surely get tested elsewhere and the API ought to be solid.

Further discussion etc on the GitHub issue, but I thought I'd give an insight here into what's going on.


In reply to Re^2: PDL range on 4-d piddles by etj
in thread PDL range on 4-d piddles by jo37

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.