I’m trying to declare and use a 2-column integer data matrix. Here is example code:

```
vector ff(row_vector[] X, int[] y) {
int N = size(X);
int k = max(y); // want max over all rows AND columns
vector[N] out;
for(n in 1 : N) {
int j = y[n, 1];
int m = y[n, 2];
out[n] = 0.;
}
return out;
}
data {
int<lower=1> N;
int<lower=1> p;
int<lower=2> k;
matrix[N, p] X;
int<lower=1,upper=k> y[N,2];
}
```

I get

```
Too many indexes, expression dimensions=1, indexes found=2
error in 'modelc42957b1a0253_test' at line 7, column 18
```

What is the correct syntax? And will max(y) work OK to find the maximum over the whole matrix?

Thanks for any help.