Line-of-sight integrations are currently calculated in los_integrate as
$$I_l(k,\tau_0) = \int_0^{\tau_0} d\tau S(k,\tau) j_l(k(\tau_0-\tau)).$$
This is done over
- a grid of $k$ that depends on $l/\tau_0$,
- a grid of $\tau$ that depends on $\tau_0$.
Both of these grids depend on cosmological parameters (e.g. the age of universe changes with parameters).
I think it would be better to rewrite the integral by defining $y = k\tau_0$ and $x=\tau/\tau_0$ and calculating
$$I_l(k,\tau_0) = \tau_0 \int_0^1 dx S(y,x) j_l\left(y \left(1-x\right)\right). $$
This should be equivalent. It could be done over
- a grid of $y$ that depends only on $l$ (i.e. angular scales the user requests independent of cosmology),
- a grid of $x \in [0, 1]$.
Both of these grids are independent of cosmological parameters.
Even better, the argument of $j_l(y(1-x))$ is also cosmology-independent, so a cosmology-independent SphericalBesselCache(x, y, l) struct could be created that precomputes values (not splines/functions) of $j_l(y(1-x))$ on given grids of $l$, $y$ and $x$ for efficient reuse in line-of-sight integrating solutions with different cosmological parameters.
Line-of-sight integrations are currently calculated in
los_integrateasThis is done over
Both of these grids depend on cosmological parameters (e.g. the age of universe changes with parameters).
I think it would be better to rewrite the integral by defining$y = k\tau_0$ and $x=\tau/\tau_0$ and calculating
This should be equivalent. It could be done over
Both of these grids are independent of cosmological parameters.
Even better, the argument of$j_l(y(1-x))$ is also cosmology-independent, so a cosmology-independent $j_l(y(1-x))$ on given grids of $l$ , $y$ and $x$ for efficient reuse in line-of-sight integrating solutions with different cosmological parameters.
SphericalBesselCache(x, y, l)struct could be created that precomputes values (not splines/functions) of