What & How & Why

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
math:linear_algebra:laff:week_3 [2020/04/08 03:40] – ↷ 链接因页面移动而自动修正 codingharemath:linear_algebra:laff:week_3 [2021/11/11 08:07] (当前版本) codinghare
行 1: 行 1:
 ======Matrix-Vector Operations====== ======Matrix-Vector Operations======
 LAFF Week 3 Notes LAFF Week 3 Notes
-===== =====+----
 本章的核心概念主要在于理解矩阵与向量的乘法的意义。矩阵是一种线性变换(映射),那么向量通过变换得到的结果就是一个新的向量,形式上表现为**矩阵的列的线性组合**。\\ 本章的核心概念主要在于理解矩阵与向量的乘法的意义。矩阵是一种线性变换(映射),那么向量通过变换得到的结果就是一个新的向量,形式上表现为**矩阵的列的线性组合**。\\
 \\ \\
行 7: 行 7:
 ====Special Matrices==== ====Special Matrices====
 ===Partition Matrix into Quadrants=== ===Partition Matrix into Quadrants===
-这一点值得在学习所有特殊矩阵之前提出来,因为相较于按列划分矩阵的方式 [[math:linear_algebra:week_2#线性变换的验证方法|week2 note 2.1]],该划分方法贯穿了绝大多数的矩阵的操作(初始化,矩阵与向量的乘法等等)。我们来看看这种划分是如何进行的:+这一点值得在学习所有特殊矩阵之前提出来,因为相较于按列划分矩阵的方式 [[math:linear_algebra:laff:week_2#线性变换的验证方法|week2 note 2.1]],该划分方法贯穿了绝大多数的矩阵的操作(初始化,矩阵与向量的乘法等等)。我们来看看这种划分是如何进行的:
 \\ \\
 \\ \\
行 28: 行 28:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_2.svg"  width="200">+<img src="/_media/math/linear_algebra/laff/p_m_q_2.svg"  width="200">
 </div> </div>
 </html> </html>
行 37: 行 37:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_3.svg"  width="500">+<img src="/_media/math/linear_algebra/laff/p_m_q_3.svg"  width="500">
 </div> </div>
 </html> </html>
行 52: 行 52:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_4.svg"  width="600">+<img src="/_media/math/linear_algebra/laff/p_m_q_4.svg"  width="600">
 </div> </div>
 </html> </html>
行 195: 行 195:
 \\ \\
 对上三角矩阵,只需要在每次迭代中对 $A_{10}^T$ 或 $A_{21}$ 所代表的向量赋零即可,也就是: 对上三角矩阵,只需要在每次迭代中对 $A_{10}^T$ 或 $A_{21}$ 所代表的向量赋零即可,也就是:
-<code> +<code matlab
-a10t = 0; //in row +a10t = 0; %in row 
-a21 = 0; // in col+a21 = 0; %in col
 </code> </code>
  
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_tr1.svg"  width="300">+<img src="/_media/math/linear_algebra/laff/p_m_q_tr1.svg"  width="300">
 </div> </div>
 </html> </html>
行 220: 行 220:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_tr2.svg"  width="300">+<img src="/_media/math/linear_algebra/laff/p_m_q_tr2.svg"  width="300">
 </div> </div>
 </html> </html>
行 234: 行 234:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_t.svg"  width="300">+<img src="/_media/math/linear_algebra/laff/p_m_q_t.svg"  width="300">
 </div> </div>
 </html> </html>
行 262: 行 262:
 \\ \\
 \\ \\
-{{ math:linear_algebra:laff:laff:3.2.6.3_symmetrizepicture.png?600 |}}+{{ math:linear_algebra:laff:3.2.6.3_symmetrizepicture.png?600 |}}
 \\ \\
 \\ \\
行 274: 行 274:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/p_m_q_tr_l_sy.svg"  width="300">+<img src="/_media/math/linear_algebra/laff/p_m_q_tr_l_sy.svg"  width="300">
 </div> </div>
 </html> </html>
行 302: 行 302:
   * 若 $A、B$ 均为对称矩阵,那么 $A+B$ 也为对称矩阵,$\beta A + \gamma B$ 也为对称矩阵,即对称矩阵的任意线性组合也为对称矩阵。   * 若 $A、B$ 均为对称矩阵,那么 $A+B$ 也为对称矩阵,$\beta A + \gamma B$ 也为对称矩阵,即对称矩阵的任意线性组合也为对称矩阵。
 ===矩阵与向量的乘法:点积解释=== ===矩阵与向量的乘法:点积解释===
-参考[[math:linear_algebra:week_2#线性变换的验证方法|week2 note 2.1]],我们可以得到下面一个等式:+参考[[math:linear_algebra:laff:week_2#线性变换的验证方法|week2 note 2.1]],我们可以得到下面一个等式:
 $$ $$
 \begin{array}{r c l} A x & =  & \left( \begin{array}{c c c c } \chi _{0} \alpha _{0,0} + \chi _{1} \alpha _{0,1} + \cdots + \chi _{n-1} \alpha _{0,n-1} \\ \chi _{0} \alpha _{1,0} + \chi _{1} \alpha _{1,1} + \cdots + \chi _{n-1} \alpha _{1,n-1} \\ \vdots \\ \chi _{0} \alpha _{m-1,0} + \chi _{1} \alpha _{m-1,1} + \cdots + \chi _{n-1} \alpha _{m-1,n-1} \end{array} \right) \\ & = & \left( \begin{array}{c c c c } \alpha _{0,0} & \alpha _{0,1} & \cdots & \alpha _{0,n-1} \\ \alpha _{1,0} & \alpha _{1,1} & \cdots & \alpha _{1,n-1} \\ \vdots & \vdots & & \vdots \\ \alpha _{m-1,0} & \alpha _{m-1,1} & \cdots & \alpha _{m-1,n-1} \\ \end{array} \right) \left( \begin{array}{c} \chi _0 \\ \chi _1 \\ \vdots \\ \chi _{n-1} \\ \end{array} \right) \end{array} \begin{array}{r c l} A x & =  & \left( \begin{array}{c c c c } \chi _{0} \alpha _{0,0} + \chi _{1} \alpha _{0,1} + \cdots + \chi _{n-1} \alpha _{0,n-1} \\ \chi _{0} \alpha _{1,0} + \chi _{1} \alpha _{1,1} + \cdots + \chi _{n-1} \alpha _{1,n-1} \\ \vdots \\ \chi _{0} \alpha _{m-1,0} + \chi _{1} \alpha _{m-1,1} + \cdots + \chi _{n-1} \alpha _{m-1,n-1} \end{array} \right) \\ & = & \left( \begin{array}{c c c c } \alpha _{0,0} & \alpha _{0,1} & \cdots & \alpha _{0,n-1} \\ \alpha _{1,0} & \alpha _{1,1} & \cdots & \alpha _{1,n-1} \\ \vdots & \vdots & & \vdots \\ \alpha _{m-1,0} & \alpha _{m-1,1} & \cdots & \alpha _{m-1,n-1} \\ \end{array} \right) \left( \begin{array}{c} \chi _0 \\ \chi _1 \\ \vdots \\ \chi _{n-1} \\ \end{array} \right) \end{array}
行 310: 行 310:
 \\ \\
 <html><div align="center"> <html><div align="center">
-<img src="/_media/math/math_note/linear_algebra/laff/m_m_v_dot.svg"  width="500">+<img src="/_media/math/linear_algebra/laff/m_m_v_dot.svg"  width="500">
 </div> </div>
 </html> </html>
行 318: 行 318:
 \\ \\
 \\ \\
-{{ math:linear_algebra:laff:laff:mvmult_n_unb_var1.png?600 |}}+{{ math:linear_algebra:laff:mvmult_n_unb_var1.png?600 |}}
 \\ \\
 \\ \\
行 328: 行 328:
 </code> </code>
 ===矩阵与向量的乘法:Axpy解释=== ===矩阵与向量的乘法:Axpy解释===
-同样参考[[math:linear_algebra:week_2#线性变换的验证方法|week2 note 2.1]],如果将矩阵按列分割,那么实际上矩阵与向量的乘积可以通过以下的途径计算:+同样参考[[math:linear_algebra:laff:week_2#线性变换的验证方法|week2 note 2.1]],如果将矩阵按列分割,那么实际上矩阵与向量的乘积可以通过以下的途径计算:
 \\ \\
 \\ \\
行 341: 行 341:
 \\ \\
 该算法中的每个循环不再进行点积操作,而是进行AXPY操作,但得到的任然是一个向量;通过循环将这个向量累加到 $y$ 上,最终也可以得到矩阵与向量相乘的结果。其实质就是一个列优先的双重循环: 该算法中的每个循环不再进行点积操作,而是进行AXPY操作,但得到的任然是一个向量;通过循环将这个向量累加到 $y$ 上,最终也可以得到矩阵与向量相乘的结果。其实质就是一个列优先的双重循环:
-<code>+<code matlab>
 for i = 0, i <= n -1, ++i for i = 0, i <= n -1, ++i
     for j = 0, j <= m-1, ++j     for j = 0, j <= m-1, ++j