Just wanted to respond to #1:
On Sep 23, 2015 11:54 AM, "Tamas Papp" <tkp...@gmail.com> wrote:
> 1. I need to implement a function that is very complex, and uses a
> numerical, iterative algorithm. My understanding is that I need to
> program a C++ function for this, that implements the function and its
> Jacobian, compile and link it to Stan. However, this is just a broad
> outline, and I am wondering if there is a tutorial or an example.
You can write the function in Stan. If there's an iterative algorithm, that doesn't necessarily pose a problem. The autodiff will work through the iterative algorithm. (One of the benefits of autodiff compared to symbolic differentiation.)
There might be some speed gains if you implemented it in c++ directly, especially if you have the gradients with respect to all the parameters of the model, but if it were me, I'd start with a full Stan implementation.
I'm not quite following what you mean by the Jacobian.
For Stan, we need the gradients with respect to all parameters of the Stan program (not necessarily x). So, we really need d f(x) / d theta for all thetas of the model.
Do you have those in closed form?
Daniel
1. I need to implement a function that is very complex, and uses a
numerical, iterative algorithm. My understanding is that I need to
program a C++ function for this, that implements the function and its
Jacobian, compile and link it to Stan. However, this is just a broad
outline, and I am wondering if there is a tutorial or an example.
Yes, absolutely. Ignore my last email.