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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…