本 Wiki 开启了 HTTPS。但由于同 IP 的 Blog 也开启了 HTTPS,因此本站必须要支持 SNI 的浏览器才能浏览。为了兼容一部分浏览器,本站保留了 HTTP 作为兼容。如果您的浏览器支持 SNI,请尽量通过 HTTPS 访问本站,谢谢!
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版后一修订版两侧同时换到之后的修订记录 | ||
math:math_note:linear_algebra:laff:week_3 [2018/12/30 12:11] – [矩阵与向量的乘法:Axpy解释] codinghare | math:linear_algebra:laff:week_3 [2020/04/08 03:40] – ↷ 链接因页面移动而自动修正 codinghare | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ======Linear Algebra | + | ======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:math_note: | + | 这一点值得在学习所有特殊矩阵之前提出来,因为相较于按列划分矩阵的方式 [[math: |
\\ | \\ | ||
\\ | \\ | ||
行 14: | 行 14: | ||
\\ | \\ | ||
< | < | ||
- | <img src="/ | + | <img src="/ |
</ | </ | ||
</ | </ | ||
行 81: | 行 81: | ||
$$ | $$ | ||
==算法:初始化矩阵为零矩阵== | ==算法:初始化矩阵为零矩阵== | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 107: | 行 107: | ||
$$ | $$ | ||
==算法:初始化矩阵为单位矩阵== | ==算法:初始化矩阵为单位矩阵== | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 137: | 行 137: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 152: | 行 152: | ||
\\ | \\ | ||
细致的代数定义如下: | 细致的代数定义如下: | ||
- | {{ :math:math_note: | + | {{ math: |
下面是三角矩阵的演示: | 下面是三角矩阵的演示: | ||
\\ | \\ | ||
行 188: | 行 188: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 227: | 行 227: | ||
===Transpose Matrix=== | ===Transpose Matrix=== | ||
转置矩阵(Transpose Matrix)在运算上表现为将**原矩阵的行作为新矩阵的列**而得到的矩阵。数学上的表现如下: | 转置矩阵(Transpose Matrix)在运算上表现为将**原矩阵的行作为新矩阵的列**而得到的矩阵。数学上的表现如下: | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 243: | 行 243: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 254: | 行 254: | ||
\text{A is said to be symmetric if}\,\, A = A^T.$$ | \text{A is said to be symmetric if}\,\, A = A^T.$$ | ||
\\ | \\ | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
行 262: | 行 262: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note:linear_algebra: | + | {{ math:linear_algebra:laff: |
\\ | \\ | ||
\\ | \\ | ||
行 302: | 行 302: | ||
* 若 $A、B$ 均为对称矩阵,那么 $A+B$ 也为对称矩阵,$\beta A + \gamma B$ 也为对称矩阵,即对称矩阵的任意线性组合也为对称矩阵。 | * 若 $A、B$ 均为对称矩阵,那么 $A+B$ 也为对称矩阵,$\beta A + \gamma B$ 也为对称矩阵,即对称矩阵的任意线性组合也为对称矩阵。 | ||
===矩阵与向量的乘法:点积解释=== | ===矩阵与向量的乘法:点积解释=== | ||
- | 参考[[math:math_note: | + | 参考[[math: |
$$ | $$ | ||
\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} | ||
行 318: | 行 318: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note:linear_algebra: | + | {{ math:linear_algebra:laff: |
\\ | \\ | ||
\\ | \\ | ||
- | 可以看出的是每次迭代的点积结果,都加到了对应的 $y$ 的分量上。 | + | 可以看出的是每次迭代的点积结果,都加到了对应的 $y$ 的分量上。实质上就是一个行优先的循环: |
+ | < | ||
+ | for i = 0, i <= m -1, ++i | ||
+ | for j = 0, j <= n-1, ++j | ||
+ | yi += aij * xj | ||
+ | </ | ||
===矩阵与向量的乘法:Axpy解释=== | ===矩阵与向量的乘法:Axpy解释=== | ||
- | 同样参考[[math:math_note: | + | 同样参考[[math: |
\\ | \\ | ||
\\ | \\ | ||
行 332: | 行 337: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{ :math:math_note: | + | {{ math: |
\\ | \\ | ||
\\ | \\ | ||
+ | 该算法中的每个循环不再进行点积操作,而是进行AXPY操作,但得到的任然是一个向量;通过循环将这个向量累加到 $y$ 上,最终也可以得到矩阵与向量相乘的结果。其实质就是一个列优先的双重循环: | ||
+ | < | ||
+ | for i = 0, i <= n -1, ++i | ||
+ | for j = 0, j <= m-1, ++j | ||
+ | yi += aij * xj | ||
+ | </ | ||
+ | ===参考资料=== | ||
+ | * 本页面所有非 svg 图片来源于 LAFF 课件。 |