[页面内容增强] 重构高斯消元部分
Author: hly1204Created Jul 28, 2026Updated Aug 13, 2026
高斯消元部分已经跟不上时代了,需要重构一下,感觉需要包含下面这些基础的内容。
- 用高斯消元将元素为域(或欧几里得整环)上的矩阵 $A \in \mathbb{F}^{m \times n}$ 转换为行阶梯形 (row echelon form, https://mathworld.wolfram.com/RowEchelonForm.html)。
- 用高斯-若尔当消元将域上的矩阵 $A \in \mathbb{F}^{m \times n}$ 转换为行最简形 (reduced row echelon form, https://mathworld.wolfram.com/ReducedRowEchelonForm.html)。
- 给出 $A \in \mathbb{F}^{m \times n}, b \in \mathbb{F}^{m \times 1}$,求出 $x \in \mathbb{F}^{n \times 1}$ 满足 $Ax = b$,其中 $x = x_0 + \mathrm{ker}(A)$,这里 $\mathrm{ker}$ 为 right kernel,需要计算出特解 $x_0$ 和 $\mathrm{ker}(A)$ 的基。(还需要判断是否有解)
对于元素在欧几里得整环上面的情况,我们假使想对一列的系数进行消元,例如选择 $\mathrm{row}_r(A)$ 和 $\mathrm{row}_i(A)$,我们用扩展欧几里得算法可以算出
$$ \begin{bmatrix}x_{11} & x_{12} \\ x_{21} & x_{22}\end{bmatrix} \begin{bmatrix} a \\ b\end{bmatrix} = \begin{bmatrix} \gcd(a, b) \\ 0\end{bmatrix} $$
可以用
$$ (\mathrm{row}_r(A), \mathrm{row}i(A)) \gets (x{11}\mathrm{row}r(A) + x{12}\mathrm{row}i(A), x{21}\mathrm{row}r(A) + x{22}\mathrm{row}_i(A) ) $$
这也是我们计算 $A \in Z_\ell^{n\times n}$ 的行列式的方法。
第三个也等价于求解 $vA^{\intercal} = w$,可以直接用 reduced row echelon form 解决,但是需要额外记录一个转换矩阵,然后后面若干行就是基。这个转换矩阵在 $A$ 可逆时就是 $A^{-1}$。
Source: OI-wiki/OI-wiki