A proposal for sparse matrices and GPs in Stan

That was my reaction as well, but I changed my mind (see Should sparse matrices in Stan be row major or column major). If we assume the sparsity patterns are fixed, then it’s really not that bad.

This is honestly a pretty easy way to fill up matrices with stuff (if you don’t mind precomputing the is/js outside Stan):

for(n in 1:N) {
  vs[n] = func(is[n]], js[n]);
}
out = my_sparse_func(is, js, vs);