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.
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.
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
Dear @avehtari, I encountered this thread and spotted an error in the section 4.9.5 where
col_end = (j - 1) * q + 1;
should be
col_end = (j - 1) * q + q;
and also vdots
is not properly displayed.
Thank you.
Hi,
Could the manual be updated to include the correction from Zhanglong below?
this manual is not under control of mc-stan.org - it’s written and hosted by @jrnold - but there doesn’t seem to be a public repo - jrnold (Jeffrey Arnold) · GitHub