You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Realistically, NumPy is not likely to support this internally but a third-party package could use the hooks in NumPy to supply this. I would be curious how they deal with the performance problems with non-byte aligned arrays: either they would need to "waste" memory and throw away the other bits to align these on byte borders, or use some bit twiddling in __getitem__ and __setitem__. See also gh-14753, gh-12888
mattip
changed the title
New data type recommendation
ENH: 4,5,6 bit ints
Oct 15, 2020
Closing, this is not going to happen in NumPy. An extension (not within NumPy itself) may decide to do this, and I think certain bit-sizes are actually fairly common in certain fields!
Truly bit-sized datatypes are problematic though, since they don't match NumPy's byte-strided memory model.
(I have some hope we could extend support for this for bit sized DTypes. But NumPy itself would have to always use them padded to full bytes for the foreseeable future.)
In any case, it seems far enough of a "Wish List" item, that I am going to close it.
Feature
Can numpy create a new data type using 4 bits, 5 bits or 6 bits such as np.int4, np.int5, np.int6, np.uint4, np.uint5, np.uint6.
Thank you.
The text was updated successfully, but these errors were encountered: