I have written several functions with @vectorize/guvectorize, it works very well. The performance is very good.
Now, I would like to pass as an argument a numpy array of lists…and I know it is not supported by Numba as it is an array of pyobjects.
In my code, I need an array that is able to contain data with different lengths. I am implementing a Physics problem where objects (molecules) can have a different number of components (eg H2O, C4H6O2, …) and I would like all this to be contained in a Numpy array. Each element of the array represents a molecule with its various components. So far, the idea that I had is to use an array declared as follows:
array = np.zeros(size, dtype = object)
This allows me to do something like this:
array = [2,1]
array = [4,6,2]
Each list corresponds to the components of a molecule.
However, now I need to pass this array as an argument of a @guvectorize function, and I now that Numba does not accept this type of data (pyobject).
Any idea? A work-around?
Or any alternative to replace this array of lists by something that could be accepted by Numba?
Many thanks in advance :-).