I put a function if_greater
in the functions
block like this:
functions {
vector if_greater(vector x, vector y) {
int n;
vector[n] D;
n = rows(x);
for (i in 1:n){
D[i] = operator>(x[i],y[i]) ;
}
return D;
}
An error popped up and pointed to the operator>
function. I changed it to the conditional operator function x[i] > y[i] ? 1:0
and it works!
I looked up the reference manual. the operator
function can be used in this way. So I wonder why the error occurred. Thanks.