In this moment, we are evaluating the r_z using gauss quadrature. While perfectly fine from an accuracy point of view, the issue comes when we have to evaluate this for a lot of points (let us say for a SNIA analysis).
In this case, three approaches might be beneficial.
- The
transformed_weights returns a matrix. In this manner, we take advantage of E_z being extremely efficient and we leverage the fact that the whole calculations is done with matrix operations (thanks BLAS).
- We use interpolation techniques. This can be done in two different ways.
3. a. Using splines. We take our function over a grid between z min and z max, and interpolate with splines. The issue is always with jacobians when doing AD (but we now how to deal with that).
3. b. Using Chebyshev polynomials trick. This would additionally benefit from a memoization step, to avoid recomputing the Chebyshev polynomials (and this would be very useful for the SNIA case, as the z array is always the same).
In this moment, we are evaluating the
r_zusing gauss quadrature. While perfectly fine from an accuracy point of view, the issue comes when we have to evaluate this for a lot of points (let us say for a SNIA analysis).In this case, three approaches might be beneficial.
transformed_weightsreturns a matrix. In this manner, we take advantage of E_z being extremely efficient and we leverage the fact that the whole calculations is done with matrix operations (thanks BLAS).3. a. Using splines. We take our function over a grid between z min and z max, and interpolate with splines. The issue is always with jacobians when doing AD (but we now how to deal with that).
3. b. Using Chebyshev polynomials trick. This would additionally benefit from a memoization step, to avoid recomputing the Chebyshev polynomials (and this would be very useful for the SNIA case, as the z array is always the same).