numpy - hard code exact float values in python -
this overkill problem, curious answer.
i have matrix of np.float32
values want put code. it's 50x3 want put in source directly - it's not change often. it's little sensitive rounding, want encode data exactly if possible. there way in source while preserving matrix format?
i'm thinking along lines of putting [[0xc45b36f3, ...],...] , somehow encoding np.float32
.
if chose encode integer values, do:
int_data = np.array([[0xc45b36f3, ...],...], dtype=np.uint32) floats = int_data.view(np.float32)
Comments
Post a Comment