Syntax errors for a user defined function

Hi @martinmodrak, thanks a lot for asking. It was my mistake. I solved it by replacing int evt_idx with int[] evt_idx , since evt_idx is a vector with integers in it.

May I ask another question regarding how to reverse a vector in a user-defined function? I found a similar post Dot products of vectors to perform 1D convolution - #8 by zcai and tried the solutions but they did not work. There is indeed a reverse() function but not yet available in rstan. Let’s say we have a for loop and inside it we just do a dot_product between two vectors a and b, but we reverse the index of b from i to 1 instead of 1 to i. I tried the suggestion in the above post dot_product(a[1:i], b[sort_desc(1:i)]);, but I got syntax error. Do you think I can only do it with a user-defined reverse funciton? or I just missed something here. Sorry I am not familiar with stan lib for user defined functions.