etj has asked for the wisdom of the Perl Monks concerning the following question:

I'm toying with the idea of adding a bitfield type to PDL, so that along the zeroth dimension it's not a whole number of bytes, but a calculated bit read (when it's used as an rvalue) or write (probably needs a function to set that, since PDL can't parse the C code yet to spot an lvalue).

Feedback on whether that would be valuable enough welcome!

Replies are listed 'Best First'.
Re: PDL bitfield type - wanted?
by swl (Prior) on May 13, 2024 at 00:46 UTC
      You assume correctly! If you are prepared to help out (if you are, obviously I'd be very pleased to give lots and lots of help). I think the way forward would be for me to add (and use, to shake out bugs) the type implementation, then these algorithms would be in a separate PDL::BitOps or similar distro.

      My immediate "itch" was to use a bitmap to implement seenmap in the fancy new contour_polylines; it annoyed me a bit that while I'd made that be a byte (i.e. 8-bit) ndarray, I was only using 2 of the bits in each of those. It's not a vast amount of memory being wasted, but that has an impact on cache usage.

        I can help with testing and debugging. Any initial implementation is of course best done by yourself given familiarity with the innards of PDL.