I need to create a lookup table that can be used in an application where speed and efficiency are extremely important. The table will store time values, which are logarithmically distributed so that each order of magnitude has an equal number of time steps. Each time value will point to an array of wavelength values which have a intensity value associated with them. So something like this:
t lambda I
0.0001 -> 0.01 -> 100
. 0.02 -> 300
. . .
. . .
. .
0.0002 -> 0.01 -> 200
. 0.02 -> 400
. . .
. . .
. .
etc...
A function in some C code will be passed a time and wavelength and will look up the corresponding intensity from the table. The function needed to generate the correct intensity is quite taxing, so this is why I have chosen to go with a lookup table. I wish to write the lookup table to a binary file as this file will be loaded in and out of RAM on many nodes on a computing cluster. As I am not familiar with lookup tables I was wondering what would be the best (as in fastest/most efficient) way to implement this.
Also, is it possible to write the binary file from a data structure created in python, that can then be read in C? This would be quite useful in my specific application because I am already interfacing with some python code to generate the values for the table.