数学上，克罗内克积（英语：Kronecker product）是两个任意大小的矩阵间的运算，表示为⊗。克罗内克积是外积从向量到矩阵的推广，也是张量积在标准基下的矩阵表示。

# 定义

如果$A$是一个$m\times n$的矩阵，而$B$是一个$p\times q$的矩阵，克罗内克积$A\otimes B$则是一个$mp\times nq$的分块。

$$A\otimes B=\begin{bmatrix} a_{11}B & \cdots & a_{1n}B\\ \vdots & \ddots & \vdots \\ a_{n1}B &\cdots& a_{nn}B \end{bmatrix}$$

$$A\otimes B={\begin{bmatrix}a_{{11}}b_{{11}}&a_{{11}}b_{{12}}&\cdots &a_{{11}}b_{{1q}}&\cdots &\cdots &a_{{1n}}b_{{11}}&a_{{1n}}b_{{12}}&\cdots &a_{{1n}}b_{{1q}}\\a_{{11}}b_{{21}}&a_{{11}}b_{{22}}&\cdots &a_{{11}}b_{{2q}}&\cdots &\cdots &a_{{1n}}b_{{21}}&a_{{1n}}b_{{22}}&\cdots &a_{{1n}}b_{{2q}}\\\vdots &\vdots &\ddots &\vdots &&&\vdots &\vdots &\ddots &\vdots \\a_{{11}}b_{{p1}}&a_{{11}}b_{{p2}}&\cdots &a_{{11}}b_{{pq}}&\cdots &\cdots &a_{{1n}}b_{{p1}}&a_{{1n}}b_{{p2}}&\cdots &a_{{1n}}b_{{pq}}\\\vdots &\vdots &&\vdots &\ddots &&\vdots &\vdots &&\vdots \\\vdots &\vdots &&\vdots &&\ddots &\vdots &\vdots &&\vdots \\a_{{m1}}b_{{11}}&a_{{m1}}b_{{12}}&\cdots &a_{{m1}}b_{{1q}}&\cdots &\cdots &a_{{mn}}b_{{11}}&a_{{mn}}b_{{12}}&\cdots &a_{{mn}}b_{{1q}}\\a_{{m1}}b_{{21}}&a_{{m1}}b_{{22}}&\cdots &a_{{m1}}b_{{2q}}&\cdots &\cdots &a_{{mn}}b_{{21}}&a_{{mn}}b_{{22}}&\cdots &a_{{mn}}b_{{2q}}\\\vdots &\vdots &\ddots &\vdots &&&\vdots &\vdots &\ddots &\vdots \\a_{{m1}}b_{{p1}}&a_{{m1}}b_{{p2}}&\cdots &a_{{m1}}b_{{pq}}&\cdots &\cdots &a_{{mn}}b_{{p1}}&a_{{mn}}b_{{p2}}&\cdots &a_{{mn}}b_{{pq}}\end{bmatrix}}.$$

### 例子

$$\begin{matrix}{\begin{bmatrix}1&2\\3&1\\\end{bmatrix}}\otimes {\begin{bmatrix}0&3\\2&1\\\end{bmatrix}}={\begin{bmatrix}1\cdot 0&1\cdot 3&2\cdot 0&2\cdot 3\\1\cdot 2&1\cdot 1&2\cdot 2&2\cdot 1\\3\cdot 0&3\cdot 3&1\cdot 0&1\cdot 3\\3\cdot 2&3\cdot 1&1\cdot 2&1\cdot 1\\\end{bmatrix}}={\begin{bmatrix}0&3&0&6\\2&1&4&2\\0&9&0&3\\6&3&2&1\end{bmatrix}}\end{matrix}$$

# 双线性和结合律

克罗内克积是张量积的特殊形式，因此满足双线性与结合律：
$$A\otimes(B+C)=A\otimes B+A\otimes C$$
$$(A+B)\otimes C=A\otimes C+B\otimes C$$
$$(kA)\otimes B=A\otimes (kB)=k(A\otimes B)$$
$$(A\otimes B)\otimes C=A\otimes (B\otimes C)$$

# 混合乘积性质

如果$A$、$B$、$C$和$D$是四个矩阵，且矩阵乘积$AC$和$BD$存在，那么：

$${\displaystyle (\mathbf {A} \otimes \mathbf {B} )(\mathbf {C} \otimes \mathbf {D} )=\mathbf {AC} \otimes \mathbf {BD} .}$$

$$(\mathbf {A} \otimes \mathbf {B} )^{-1}=\mathbf {A} ^{-1}\otimes \mathbf {B} ^{-1}$$

# 克罗内克和

$${\displaystyle \mathbf {A} \oplus \mathbf {B} =\mathbf {A} \otimes \mathbf {I} _{m}+\mathbf {I} _{n}\otimes \mathbf {B} .}$$

# 矩阵方程

$u$,$v$是列向量，kronecker积的一种特殊形式
$$u\otimes v=uv^T=\left[\begin{matrix}u_1v_1 & u_1v_2 & \cdots & u_1v_{n} \\ u_2v_1 & u_2v_2 & \cdots & u_2v_{n} \\ \vdots & \vdots & \ddots &\vdots \\u_nv_1 & u_nv_2 & \cdots & u_nv_{n} \end{matrix}\right]$$!

# python

numpy.kron(a, b)

## Examples

>>> np.kron([1,10,100], [5,6,7])
array([  5,   6,   7, ..., 500, 600, 700])
>>> np.kron([5,6,7], [1,10,100])
array([  5,  50, 500, ...,   7,  70, 700])
>>> np.kron(np.eye(2), np.ones((2,2)))
array([[1.,  1.,  0.,  0.],
[1.,  1.,  0.,  0.],
[0.,  0.,  1.,  1.],
[0.,  0.,  1.,  1.]])

[^_^]Kronecker.jpg