(1) can't be vectorized yet. But because there are
no derivatives in fmax and loops are just compiled to C++,
the loop will be fast. You can put it in a function if you
want the code to be simpler.
(2) will break continuous differentiability and may cause
problems for sampling or optimization if beta crosses x during
an iteration. To answer your question:
mu = x > beta ? my_equation : 0;
But if this is in a loop for mu[n], then you want to pull
our any shared subexpressions in my_equation so that you
only compute them once and reuse the result.
- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.
> To post to this group, send email to
stan-...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.