xzackli / Bolt.jl

differentiable boltzmann code
MIT License
42 stars 5 forks source link

improve RECFAST routine #60

Open xzackli opened 2 years ago

xzackli commented 2 years ago

This PR will improve the RECFAST routine and make it compatible with reverse-mode AD like Zygote. In RECFAST, certain analytic approximations are applied during different epochs. I don't really want to make changes to the actual calculations, because RECFAST is really an emulator of the real recombination calculation.

We eliminate the loop. Instead, there are two choices for this PR.

  1. Maybe I should try to break up the calculation into distinct redshift epochs and then stack the results together.
  2. Maybe I find the derivative of the analytic approximations using AD and feed them into the ODE solver. Since it will be a simple linear behavior with redshift, it should behave nicely. This moves the complexity to the ODE's LHS expression.
xzackli commented 2 years ago

image