Saturday, 17 August 2013

How to extract the bits of larger numeric Numpy data types

How to extract the bits of larger numeric Numpy data types

Numpy has a library function, np.unpackbits, which will unpack a uint8
into a bit vector of length 8. Is there a correspondingly fast way to
unpack larger numeric types? E.g. uint16 or uint32. I am working on a
question that involves frequent translation between numbers, for array
indexing, and their bit vector representations, and the bottleneck is our
pack and unpack functions.

No comments:

Post a Comment