I have a function in Stan that takes as input an array of integers, Index. The function uses the indices to sum over a vector:
I.e.
sum(II[Index[i]:])
I input the Index array in the data block
int M3;
int Index[M3];
and input the array of integers into the function as
(...,int Index)
I am receiving the following error
Too many indexes, expression dimensions=0, indexes found=1
Is this because Stan only allows a single integer value to be passed to the function? I need the array to be integers because Index[i] must be an integer to perform the following.
sum(II[Index[i]:])
So I cannot define Index to be of type “vector”.
Does anyone know how I can pass an array of integers into a function? Or if the error means something else?