Which function is faster?

Hi all,

I have a parameter kappa, a number t. In the model block I need the following expression

exp(kappa * t)

The are two ways:
(1) define kappa as a parameter, and use that expression, or
(2) define new_kappa = exp(kappa) and use


Which do you think being faster?

Thank you for reading!

Kind regards,
Trung Dung.

The first way is at least as fast and more clear because Stan has to calculate log(new_kappa) to do the autodiff.


I would suggest testing. It’s more precise than speculating.