My first thought was to use @jitclass, which I did for the numerics module in a4e2e21. However, this approach would be a long and painful road since every single class would have to be a @jitclass since they are all used in Calculator, and thus every single method in the entire package will have to be @njit compatible. This is simply not practical (nor desired, nor necessary).
The best option is a heavy refactoring of the code so that I'm computing the binned rate as a (n_velocities, n_masses, n_modes, n_bins) array, i.e., all the Single[...]Reach classes need to be heavily reworks so that I'm not looping over them and calculating the rate for each (v_e, m_chi) pair individually. Those classes should do all the setup, then the entire rate calculation can be taken outside the classes into an njitted method that does nothing but array operations.
My first thought was to use
@jitclass, which I did for the numerics module in a4e2e21. However, this approach would be a long and painful road since every single class would have to be a@jitclasssince they are all used inCalculator, and thus every single method in the entire package will have to be@njitcompatible. This is simply not practical (nor desired, nor necessary).The best option is a heavy refactoring of the code so that I'm computing the binned rate as a
(n_velocities, n_masses, n_modes, n_bins)array, i.e., all theSingle[...]Reachclasses need to be heavily reworks so that I'm not looping over them and calculating the rate for each(v_e, m_chi)pair individually. Those classes should do all the setup, then the entire rate calculation can be taken outside the classes into an njitted method that does nothing but array operations.