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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -