TDAmeritrade / stumpy

STUMPY is a powerful and scalable Python library for modern time series analysis
https://stumpy.readthedocs.io/en/latest/
Other
3.66k stars 319 forks source link

Check fastmath=True #708

Open seanlaw opened 2 years ago

seanlaw commented 2 years ago

In many @njit cases, we use fastmath=True. However, this might be bad when the input arguments and/or output results contain np.nan or np.inf (see Numba fastmath). In those cases, we should use more specific but slower fastmath flags like @njit(fastmath={"nsz", "arcp", "contract", "afn", "reassoc"})

We should spend some time to reassessing whether all of the fastmath specifications are accurate or if they need to be updated

seanlaw commented 1 year ago

There is a nice article here on some of the differences in the fastmath flags. I wonder if it is possible/might be worth to go down a path where we assume that all njit functions must contain finite inputs/outputs. This will require some further preprocessing of the inputs AND post-processing of the outputs but it might be well worth the effort.