I know that numpy stores numbers in contiguous memory. So is it possible to take
a = np.array([127,127,127,127,127,127,127,127], dtype=np.uint8)
the binary representation of 'a' is all ones
to this:
b = np.array([72057594037927935], dtype=np.uint64)
as well as back again from b->a.
The binary representation is all ones however the number of elements is combined to one single 64 bit int the representation should be the same in Numpy only the metadata should change.
This sounds like a job for stride tricks but my best guess is:
np.lib.stride_tricks.as_strided(a, shape=(1,), strides=(8,8))
and
np.lib.stride_tricks.as_strided(b, shape=(8,), strides=(1,8))
only to get ValueError: mismatch in length of strides and shape
This only needs to be read only so I have no delusions thinking that I need to change the data.
a.tobytes()which contains\x7frather than\xffblocks.