Kronecker product of matrices

Hello, let
A_i=\begin{bmatrix} a_i & b_i \\ c_i & d_i \end{bmatrix}
where i=1,...,5

Is there a way to obtain
C=A_1\otimes A_2\otimes...\otimes A_5,
That is the Kronecker product of matrices? Cheers.

1 Like

No. It may be worth to implement it in Stan (Eigen has a module for it) but it has a large memory footprint even for a matrix of moderate size. Often writing out the product explicitly is not necessary when it’s used as a represention of operations. That being said, in your case it’s probably sufficient to roll a naive implementation in UDF.


You can find code for Kronecker product in Stan language in Section 4.9.5. of State Space Models in Stan by @jrnold

1 Like