矩阵乘法 - 分块矩阵与舒尔补

Matrix Multiplication: Block Matrix and Schur Complement

Posted by J Leaves on May 14, 2019

矩阵乘法的灵活应用非常重要。

矩阵乘法

以 $2\times2$ 矩阵为例

Component-wise

对于矩阵乘法,按照定义有

\[\left[\begin{matrix} a_1 & b_1 \\ c_1 & d_1 \end{matrix}\right] \cdot \left[\begin{matrix} a_2 & b_2 \\ c_2 & d_2 \end{matrix}\right] \\ = \left[\begin{matrix} a_1a_2+b_1c_2 & a_1b_2+b_1d_2 \\ c_1a_2+d_1c_2 & c_1b_2+d_1d_2 \end{matrix}\right]\]

即每个元素是对应的一行(第i行)与一列(第j列)的向量内积。

Matrix-wise

换一种角度看的话

\[\begin{align} &\qquad\left[\begin{matrix} a_1 & b_1 \\ c_1 & d_1 \end{matrix}\right] \cdot \left[\begin{matrix} a_2 & b_2 \\ c_2 & d_2 \end{matrix}\right] \\ &= \left[\begin{matrix} a_1 \\ c_1 \end{matrix}\right]\cdot \left[\begin{matrix} a_2 & b_2 \end{matrix}\right]+ \left[\begin{matrix} b_1 \\ d_1 \end{matrix}\right]\cdot \left[\begin{matrix} c_2 & d_2 \end{matrix}\right]\\ &= \left[\begin{matrix} a_1a_2+b_1c_2 & a_1b_2+b_1d_2 \\ c_1a_2+d_1c_2 & c_1b_2+d_1d_2 \end{matrix}\right] \end{align}\]

即整个矩阵是第i列(列向量)与第i行(行向量)的向量内积的和。

二次型中的矩阵乘法

\[\begin{align} f(\mathbf{x}) &= \mathbf{x}^\top A\mathbf{x} \\ &= \begin{bmatrix}x_{1}&x_{2}&\cdots&x_{n}\end{bmatrix} \begin{bmatrix}a_{1,1}&a_{1,2}&\cdots&a_{1,n}\\\vdots&\vdots&\ddots&\vdots\\a_{n,1}&a_{n,2}&\cdots&a_{n,n}\end{bmatrix} \begin{bmatrix}x_{1}\\x_{2}\\\vdots\\x_{n}\end{bmatrix} \\ &=\sum_{i}\sum_{j}a_{ij}x_{i}x_{j} \end{align}\]

分块矩阵的乘法

(Ref: Block matrix - Wikipedia)

矩阵可以分块相乘

若矩阵 $\mathbf{A}$、$\mathbf{B}$ 可分为

\[\mathbf {A} ={\begin{bmatrix}\mathbf {A} _{11}&\mathbf {A} _{12}&\cdots &\mathbf {A} _{1s}\\\mathbf {A} _{21}&\mathbf {A} _{22}&\cdots &\mathbf {A} _{2s}\\\vdots &\vdots &\ddots &\vdots \\\mathbf {A} _{q1}&\mathbf {A} _{q2}&\cdots &\mathbf {A} _{qs}\end{bmatrix}}\] \[\mathbf {B} ={\begin{bmatrix}\mathbf {B} _{11}&\mathbf {B} _{12}&\cdots &\mathbf {B} _{1r}\\\mathbf {B} _{21}&\mathbf {B} _{22}&\cdots &\mathbf {B} _{2r}\\\vdots &\vdots &\ddots &\vdots \\\mathbf {B} _{s1}&\mathbf {B} _{s2}&\cdots &\mathbf {B} _{sr}\end{bmatrix}}\]

则矩阵乘法 $\mathbf{C}=\mathbf{AB}$ 有

\[\mathbf {C} _{qr}=\sum _{i=1}^{s}\mathbf {A} _{qi}\mathbf {B} _{ir}\]
说明

分块矩阵乘法的前提是对于 $\mathbf{A}$、$\mathbf{B}$ 的分割要 相容(Conforming)

用例子说明相容的概念,比如对于

\[\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} \cdot \begin{bmatrix} a' & b' & c' \\ d' & e' & f' \\ g' & h' & i' \end{bmatrix}\]

则下述分割是不相容的

\[\left[\begin{array}{c|cc}a&b&c\\ d&e&f\\ \hline g&h&i \end{array}\right] \cdot \left[\begin{array}{c|cc}a'&b'&c'\\ d'&e'&f'\\ \hline g'&h'&i' \end{array}\right]\]

而下述分割是相容的

\[\left[\begin{array}{c|cc}a&b&c\\ \hline d&e&f\\ g&h&i \end{array}\right] \cdot \left[\begin{array}{c|cc}a'&b'&c'\\ \hline d'&e'&f'\\ g'&h'&i' \end{array}\right]\]

两种分割有什么不同呢?在第一种分割中,所有子矩阵的乘积无法被定义,比如 $\begin{bmatrix} a \ d \ \end{bmatrix}$ 无法与 $\begin{bmatrix} a’ \ d’ \ \end{bmatrix}$ 相乘。而第二种分割则不会。

舒尔补与分块矩阵乘法

(Ref: Schur complement - Wikipedia)

A, B, C, D 分别是 p × p, p × q, q × p, q × q 矩阵,且 D 可逆。对于分块矩阵

\[M=\left[{\begin{matrix}A&B\\C&D\end{matrix}}\right]\]

DM 中的舒尔补定义为

\[M/D:=A-BD^{-1}C\]

AM 中的舒尔补定义为

\[M/A:=D-CA^{-1}B\]
背景

舒尔补实际上是对原来的矩阵 M 进行一系列的初等变换操作后得到的矩阵。

假定 D 可逆,右乘一个下三角矩阵

\[L={\begin{bmatrix}I_{p}&0\\-D^{-1}C&I_{q}\end{bmatrix}},\]

从而由分块矩阵乘法

\[\begin{aligned} ML&={\begin{bmatrix}A&B\\C&D\end{bmatrix}}{\begin{bmatrix}I_{p}&0\\-D^{-1}C&I_{q}\end{bmatrix}}={\begin{bmatrix}A-BD^{-1}C&B\\0&D\end{bmatrix}}\\[4pt]&={\begin{bmatrix}I_{p}&BD^{-1}\\0&I_{q}\end{bmatrix}}{\begin{bmatrix}A-BD^{-1}C&0\\0&D\end{bmatrix}}. \end{aligned}\]

实际上,我们得到了分块矩阵 ML-U 分解

\[\begin{aligned} {\begin{bmatrix}A&B\\C&D\end{bmatrix}}&=MLL^{-1}={\begin{bmatrix}I_{p}&BD^{-1}\\0&I_{q}\end{bmatrix}} {\begin{bmatrix}A-BD^{-1}C&0\\0&D\end{bmatrix}} {\begin{bmatrix}I_{p}&0\\D^{-1}C&I_{q}\end{bmatrix}}. \end{aligned}\]

此外,利用 L-U 分解的结果,可以求得 M

\[\begin{aligned} &{\begin{bmatrix}A&B\\C&D\end{bmatrix}}^{-1}={\begin{bmatrix}I_{p}&0\\-D^{-1}C&I_{q}\end{bmatrix}}{\begin{bmatrix}\left(A-BD^{-1}C\right)^{-1}&0\\0&D^{-1}\end{bmatrix}}{\begin{bmatrix}I_{p}&-BD^{-1}\\0&I_{q}\end{bmatrix}}\\[4pt]={}&{\begin{bmatrix}\left(A-BD^{-1}C\right)^{-1}&-\left(A-BD^{-1}C\right)^{-1}BD^{-1}\\-D^{-1}C\left(A-BD^{-1}C\right)^{-1}&D^{-1}+D^{-1}C\left(A-BD^{-1}C\right)^{-1}BD^{-1}\end{bmatrix}}\\[4pt]={}&{\begin{bmatrix}\left(A-BD^{-1}C\right)^{-1}&-\left(A-BD^{-1}C\right)^{-1}BD^{-1}\\-D^{-1}C\left(A-BD^{-1}C\right)^{-1}&\left(D-CA^{-1}B\right)^{-1}\end{bmatrix}}\\[4pt]={}&{\begin{bmatrix}\left(M/D\right)^{-1}&-\left(M/D\right)^{-1}BD^{-1}\\-D^{-1}C\left(M/D\right)^{-1}&\left(M/A\right)^{-1}\end{bmatrix}}. \end{aligned}\]

A 可逆,同样地

\[\begin{aligned} {\begin{bmatrix}A&B\\C&D\end{bmatrix}}&={\begin{bmatrix}I_{p}&0\\CA^{-1}&I_{q}\end{bmatrix}} {\begin{bmatrix}A&0\\0&D-CA^{-1}B\end{bmatrix}} {\begin{bmatrix}I_{p}&A^{-1}B\\0&I_{q}\end{bmatrix}}. \end{aligned}\]

同样可得到 M 的逆的另一种表达式

\[\begin{aligned} \begin{bmatrix} {A} & {B} \\ {C} & {D} \end{bmatrix}^{-1} &={\begin{bmatrix} {A} ^{-1}+ {A} ^{-1} {B} \left( {D} - {CA} ^{-1} {B} \right)^{-1} {CA} ^{-1}&- {A} ^{-1} {B} \left( {D} - {CA} ^{-1} {B} \right)^{-1}\\-\left( {D} - {CA} ^{-1} {B} \right)^{-1} {CA} ^{-1}&\left( {D} - {CA} ^{-1} {B} \right)^{-1}\end{bmatrix}}\\ &={\begin{bmatrix} \left(A-BD^{-1}C\right)^{-1}&- {A} ^{-1} {B} \left( {D} - {CA} ^{-1} {B} \right)^{-1}\\-\left( {D} - {CA} ^{-1} {B} \right)^{-1} {CA} ^{-1}&\left( {D} - {CA} ^{-1} {B} \right)^{-1} \end{bmatrix}}\\ &={\begin{bmatrix}\left(M/D\right)^{-1}&- {A} ^{-1} {B} \left( M/A \right)^{-1}\\-\left( M/A \right)^{-1} {CA} ^{-1}&\left(M/A\right)^{-1} \end{bmatrix}} \end{aligned}\]