Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peng00bo00 committed Jun 21, 2024
1 parent bd056e3 commit f8a6139
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 4 deletions.
110 changes: 108 additions & 2 deletions _posts/2024-06-21-GAMES001-NOTES-12.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ $$

### 高斯消元

求解线性系统的基本方法是直接进行求解,其中[高斯消元法](https://en.wikipedia.org/wiki/Gaussian_elimination)是这类方法的典型代表。具体来说,高斯消元法会同时对系数矩阵$$\mathbb{A}$$和向量$$\mathbf{b}$$进行行变换,使得矩阵$$\mathbb{A}$$变成一个上三角矩阵。得到上三角矩阵后即可从下往上反向回代计算出解$$x$$
求解线性系统的基本方法是直接进行求解,其中[高斯消元法](https://en.wikipedia.org/wiki/Gaussian_elimination)是这类方法的典型代表。具体来说,高斯消元法会同时对系数矩阵$$\mathbb{A}$$和向量$$\mathbf{b}$$进行行变换,使得矩阵$$\mathbb{A}$$变成一个上三角矩阵。得到上三角矩阵后即可从下往上反向回代计算出解$$\boldsymbol{x}$$

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/oOZZ6q2.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/4CHiPgb.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/1CVjWRz.png" width="100%">
</div>

换个角度来看,矩阵的行变换等价于左乘一个下三角矩阵。因此,高斯消元法可以理解为对矩阵进行[LU分解](https://en.wikipedia.org/wiki/LU_decomposition)。通过LU分解,我们将系数矩阵$$\mathbf{A}$$分解为一个下三角矩阵$$\mathbf{L}$$和一个上三角矩阵$$\mathbf{U}$$的乘积。然后,通过求解两个较简单的线性系统$$\mathbf{L} \mathbf{y} = \mathbf{b}$$$$\mathbf{U} \mathbf{x} = \mathbf{y}$$就可以得到最终解$$x$$
换个角度来看,矩阵的行变换等价于左乘一个下三角矩阵。因此,高斯消元法可以理解为对矩阵进行[LU分解](https://en.wikipedia.org/wiki/LU_decomposition)。通过LU分解,我们将系数矩阵$$\mathbf{A}$$分解为一个下三角矩阵$$\mathbf{L}$$和一个上三角矩阵$$\mathbf{U}$$的乘积。然后,通过求解两个较简单的线性系统$$\mathbf{L} \mathbf{y} = \mathbf{b}$$$$\mathbf{U} \boldsymbol{x} = \mathbf{y}$$就可以得到最终解$$\boldsymbol{x}$$

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/MDCebWs.png" width="100%">
Expand Down Expand Up @@ -93,6 +93,112 @@ $$

### 不动点迭代

首先我们来介绍[不动点迭代](https://en.wikipedia.org/wiki/Fixed-point_iteration)。举个简单的例子,假设要求解方程

$$
x = \cos{x}
$$

我们可以建立迭代格式

$$
x^{k+1} \leftarrow \cos{x^k}
$$

通过不断执行可以发现$$\boldsymbol{x}$$会收敛到某个值上,而实际上这个值就是方程的解。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/fjXgdF9.png" width="100%">
</div>

在线性系统的求解中,可以利用不动点迭代方法来进行计算。我们可以将系数矩阵$$\mathbf{A}$$表示为

$$
\mathbf{A} = \mathbf{M} - \mathbf{N}
$$

这样线性系统的解可以表示为

$$
\boldsymbol{x} = \mathbf{M}^{-1} (\mathbf{N} \boldsymbol{x} + \mathbf{b})
$$

从而建立迭代格式

$$
\boldsymbol{x}^{k+1} \leftarrow \mathbf{M}^{-1} (\mathbf{N} \boldsymbol{x}^k + \mathbf{b})
$$

如果迭代能够收敛,则可以保证$$\boldsymbol{x}^k$$会趋向于线性系统的解。以上就是不动点迭代求解线性系统的基本思想,当然使用不动点迭代时还有很多问题需要考虑,比如如何计算逆阵$$\mathbf{M}^{-1}$$、如何保证迭代收敛以及迭代的效率等。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/pEcNTUk.png" width="100%">
</div>

#### Jacobi迭代

[Jacobi迭代](https://en.wikipedia.org/wiki/Jacobi_method)是一种典型的不动点迭代法。在Jacobi迭代中,我们取$$\mathbf{M}$$矩阵为系数矩阵$$\mathbf{A}$$的对角元素$$\mathbf{D}$$,则$$\mathbf{N}$$矩阵为系数矩阵$$\mathbf{A}$$的其余非对角元素的相反数。此时$$\mathbf{M}^{-1}$$为对角元素的倒数,因此每次迭代都只需要进行基本的矩阵乘法和加法运算。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/RiGG3Vf.png" width="100%">
</div>

Jacobi迭代的伪代码可以参考如下。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/gAHtQpS.png" width="100%">
</div>

需要注意的是,在某些情况下Jacobi迭代可能会出现不收敛的情况。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/MMyen8l.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/eGUtxaa.png" width="100%">
</div>

要分析不动点迭代法的收敛准则,我们需要引入"误差"的概念。这里"误差"是指当前解$$\boldsymbol{x}^k$$与真实解$$\boldsymbol{x}^*$$之间的差。误差$$\boldsymbol{e}^k$$与残差$$\boldsymbol{r}^k$$之间的关系为

$$
\boldsymbol{r}^k = \mathbf{b} - \mathbf{A} \boldsymbol{x}^k = \mathbf{A} (\boldsymbol{x}^* - \boldsymbol{x}^k) = \mathbf{A} \boldsymbol{e}^k
$$

显然,随着迭代的过程误差$$\boldsymbol{e}^k$$具有递推关系

$$
\boldsymbol{e}^{k+1} \leftarrow (\mathbf{I} - \mathbf{M}^{-1} \mathbf{A}) \boldsymbol{e}^k = \mathbf{M}^{-1} \mathbf{N} \boldsymbol{e}^k
$$

上式说明,在每一次迭代时误差更新相当于左乘一个矩阵$$\mathbf{T}$$

$$
\mathbf{T} = \mathbf{I} - \mathbf{M}^{-1} \mathbf{A} = \mathbf{M}^{-1} \mathbf{N}
$$

只有当矩阵$$\mathbf{T}$$[谱半径](https://en.wikipedia.org/wiki/Spectral_radius)小于1时误差才能保证收敛,否则误差可能会不收敛。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/pr5Jexx.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/heYQMed.png" width="100%">
</div>

在Jacobi迭代中,如果系数矩阵$$\mathbf{A}$$是严格对角占优的则可以保证迭代一定可以收敛。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/N9cgJ7b.png" width="100%">
</div>

如果系数矩阵是非对角占优的,还可以通过松弛的方法

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/UYPMyty.png" width="100%">
</div>

总结来说,Jacobi迭代是一种简单实现且适合并行计算的迭代求解算法。然而,实践经验表明,Jacobi迭代通常需要较多的迭代步数才能达到收敛。当系数矩阵接近对角占优时,Jacobi迭代的收敛速度会显著加快。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/DfgxHsF.png" width="100%">
</div>

## Reference

- [Lecture 13: 线性系统](https://www.bilibili.com/video/BV1MF4m1V7e3?p=13&vd_source=7a2542c6c909b3ee1fab551277360826)
4 changes: 2 additions & 2 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ aside:

**Hi there!**

My name is **Bo Peng (彭博)** and I'm a PhD student at [NYU Abu Dhabi](https://nyuad.nyu.edu/en/). During my phd study in civil engineering, I also finished my second master degree in computer science at [Georgia Tech's OMSCS program](https://omscs.gatech.edu/). This blog is used to record what I've learned in this journey.
My name is **Bo Peng (彭博)**, a PhD graduate from [NYU Abu Dhabi](https://nyuad.nyu.edu/en/). in civil engineering. Alongside my PhD, I also completed a second master's degree in computer science through [Georgia Tech's OMSCS program](https://omscs.gatech.edu/). I am passionate about computer graphics (CG), particularly in the field of geometry geometry modeling and processing. Additionally, my research experience includes machine learning and computer vision. This blog is my platform to share and document the insights and knowledge I've gained throughout this journey.

## Education
- **New York University Abu Dhabi** <span style="float:right">2019.09 - 2024.05</span> \
Expand All @@ -48,7 +48,7 @@ My name is **Bo Peng (彭博)** and I'm a PhD student at [NYU Abu Dhabi](https:/
## Research Interests

Computer Graphics,
Geometry Processing,
Geometry Modeling and Processing,
Machine Learning,
Computer Vision

Expand Down

0 comments on commit f8a6139

Please sign in to comment.