## 介绍

$\Omega = K(X, Y) = \begin{bmatrix} K(x_1, y_1) & K(x_1, y_2) & \cdots & K(x_1, y_n) \\ K(x_2, y_1) & K(x_2, y_2) & \cdots & K(x_2, y_n) \\ \vdots & \vdots & \ddots & \vdots \\ K(x_m, y_1) & K(x_n, y_2) & \cdots & K(x_m, y_n) \end{bmatrix}$

\begin{aligned} X & = [x_1 \, x_2 \, \cdots \, x_m]^T \\ Y & = [y_1 \, y_2 \, \cdots \, y_n]^T \end{aligned}

## 快速生成核矩阵

$K(x, y) = e^{-\frac{\Vert x - y \Vert^2}{2\sigma^2}}$

$\Omega=K(X, Y) = \begin{bmatrix} e^{-\frac{\Vert x_1 - y_1\Vert^2}{2\sigma^2}} & e^{-\frac{\Vert x_1 - y_2 \Vert^2}{2\sigma^2}} & \cdots & e^{-\frac{\Vert x_1 - y_n \Vert^2}{2\sigma^2}} \\ e^{-\frac{\Vert x_2 - y_1 \Vert^2}{2\sigma^2}} & e^{-\frac{\Vert x_2 - y_2 \Vert^2}{2\sigma^2}} & \cdots & e^{-\frac{\Vert x_2 - y_n \Vert^2}{2\sigma^2}} \\ \vdots & \vdots & \ddots & \vdots \\ e^{-\frac{\Vert x_m - y_1 \Vert^2}{2\sigma^2}} & e^{-\frac{\Vert x_m - y_2 \Vert^2}{2\sigma^2}} & \cdots & e^{-\frac{\Vert x_m - y_n \Vert^2}{2\sigma^2}} \end{bmatrix}$

$D = \begin{bmatrix} \Vert x_1 - y_1 \Vert^2 & \Vert x_1 - y_2 \Vert^2 & \cdots & \Vert x_1 - y_n \Vert^2 \\ \Vert x_2 - y_1 \Vert^2 & \Vert x_2 - y_2 \Vert^2 & \cdots & \Vert x_2 - y_n \Vert^2 \\ \vdots & \vdots & \ddots & \vdots \\ \Vert x_m - y_1 \Vert^2 & \Vert x_m - y_2 \Vert^2 & \cdots & \Vert x_m - y_n \Vert^2 \end{bmatrix}$

\begin{aligned} \Vert x_i - y_j \Vert^2 & = (x_i - y_j)^T(x_i - y_j) \\ & = x_i^T x_i - 2 x_i^T y_j + y_j^T y_j \\ & = \Vert x_i \Vert^2 - 2 x_i^T y_j + \Vert y_j \Vert^2 \end{aligned}

$D = A - 2B + C$

$A = \begin{bmatrix} \Vert x_1 \Vert^2 & \Vert x_1 \Vert^2 & \cdots & \Vert x_1 \Vert^2 \\ \Vert x_2 \Vert^2 & \Vert x_2 \Vert^2 & \cdots & \Vert x_2 \Vert^2 \\ \vdots & \vdots & \ddots & \vdots \\ \Vert x_m \Vert^2 & \Vert x_m \Vert^2 & \cdots & \Vert x_m \Vert^2 \end{bmatrix}_{m \times n}$

$\alpha = \begin{bmatrix} \Vert x_1 \Vert^2 & \Vert x_2 \Vert^2 & \cdots & \Vert x_m \Vert^2 \end{bmatrix}^T$

\begin{aligned} A & = \alpha 1^T \\ & = \begin{bmatrix} \Vert x_1 \Vert^2 \\ \Vert x_2 \Vert^2 \\ \vdots \\ \Vert x_m \Vert^2 \end{bmatrix} \begin{bmatrix} 1 & 1 & \cdots & 1 \end{bmatrix} \end{aligned}

$B = \begin{bmatrix} x_1^T y_1 & x_1^T y_2 & \cdots & x_1^T y_n \\ x_2^T y_1 & x_2^T y_2 & \cdots & x_2^T y_n \\ \vdots & \vdots & \ddots & \vdots \\ x_m^T y_1 & x_m^T y_2 & \cdots & x_m^T y_n \end{bmatrix}_{m \times n}$

$B = XY^T$

$C = \begin{bmatrix} \Vert y_1 \Vert^2 & \Vert y_2 \Vert^2 & \cdots & \Vert y_n \Vert^2 \\ \Vert y_1 \Vert^2 & \Vert y_2 \Vert^2 & \cdots & \Vert y_n \Vert^2 \\ \vdots & \vdots & \ddots & \vdots \\ \Vert y_1 \Vert^2 & \Vert y_2 \Vert^2 & \cdots & \Vert y_n \Vert^2 \end{bmatrix}_{m \times n}$

$\beta = \begin{bmatrix} \Vert y_1 \Vert^2 & \Vert y_2 \Vert & \cdots & \Vert y_n \Vert^2 \end{bmatrix}^T$

\begin{aligned} C & = 1 \beta^T \\ & = \begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix} \begin{bmatrix} \Vert y_1 \Vert^2 & \Vert y_2 \Vert & \cdots & \Vert y_n \Vert^2 \end{bmatrix} \end{aligned}

$D = \alpha 1^T - 2 XY^T + 1 \beta^T$