Is there a high level function in Stan that will allow assignment to a sub-matrix, e.g., (pseudo-code)

```
Sig[a:b, c:d] = gp_matern32_cov(x1, x2 a, r); //?
```

Along this line, do the matrix block extraction functions have corresponding replacement functions?

Thanks

Jay

The closest thing we have is the block function, but that will only let you assign/extract consecutive values

Great! Assignment is what I need. After reading (browsing) through the documentation, I was left with the impression that there was only a block extraction function, not assignment. I must have missed the block assignment function. Thank you.

Doesn’t your original code work? I do this kind of thing all over the place, but not with the gp function.

Even better! Again, I failed to see such replacement functionality in the documentation for matrices. I must overlooked this. I will try it.

Hi, @Jarrett_Barber! Long time no see. Your example should work as written if `b - a = d - c`

and they are the same size as the resulting covariance matrix. For example, we can do this:

```
matrix[3, 3] x;
matrix[5, 5] y = ...;
y[1:3, 2:4] = x;
```

The general rule is that if you have multi-indexes `A`

and `B`

consisting of sequences of integers, then

```
y[A, B](m, n) =def= y[A[m], B[n]]
```

and expressions like `y[A, B]`

can be used on the left.

Even better. Thanks, Bob. Sorry if I missed this in the documentation. Best, — Jay