dynamically growing array in numba jitted functions
Typically the strategy I employ is to just allocate more than enough array storage to accommodate the calculation and then keep track of the final index/indices used, and then slice the array down to the actual size before returning. This assumes that you know beforehand what the maximum size you could possibly grow the array to is. The thought is that in most of my own applications, memory is cheap but resizing and switching between python and jitted functions a lot is expensive.
It seems that numpy.resize is not supported in numba.
What is the best way to use dynamically growing arrays with numba.jit in nopython mode?
So far the best I could do is define and resize the arrays outside the jitted function, is there a better (and neater) option?