Create block diagonal matrix

Hi everyone,

I am trying to create block diagonal matrix using two square matrix A and B (Not necessarily same dimension). Can anybody tell how to create it in stan programing? I am using “rstan” package to fit a model.

I would appreciate your response.


Create a big matrix of zeros of correct dimension, and then index into it to assign the blocks.

Thank you, jscolar.

I will try this.