This could give a bit of a speed boost since some operations support SIMD instruction sets (parallelising the operation within a single core, kind of).
Should I create an issue and look at implementing these, or is apply_scalar_unary preferred here?
… but I recommend to benchmark your changes to make sure that the additional complication of the code is worth it as compilers are good at guessing stuff… you will want to get familiar with the performance cmdstan git repo.
I would guess that the difference in improvement is because Eigen’s exp supports AVX for doubles, whereas log only supports AVX for floats. Either way, interesting to see the performance boosts that are available.