算法导论 笔记2 4.2-矩阵乘法Strassen算法
4.2.1 使用Strassen计算
[1 3][6 8]
[7 5][4 2]
先手工算一下答案记下来
[18 14]
[62 66]
完全参考书的步骤来做一下这个题目
- 分解矩阵 略
-
创建并计算10个矩阵
S1 = B12 - B22 = [6] S2 = A11 + A12 = [4] S3 = A21 + A22 = [12] S4 = B21 - B11 = [-2] S5 = A11 + A22 = [6] S6 = B11 + B22 = [8] S7 = A12 - A22 = [-2] S8 = B21 + B22 = [6] S9 = A11 - A21 = [-6] S10 = B11 + B12 = [14]
-
计算7次矩阵乘法
P1 = A11 * S1 = [6] P2 = S2 * B22 = [8] P3 = S3 * B11 = [72] P4 = A22 * S4 = [-10] P5 = S5 * S6 = [48] P6 = S7 * S8 = [-12] P7 = S9 * S10 = [-84]
-
计算 C11 C12 C21 C22
C11 = P5 + P4 - P2 + P6 = [18] C12 = P1 + P2 = [14] C21 = P3 + P4 = [62] C22 = P5 + P1 - P3 - P7 = [66]
没有纸笔, 靠我的脑子想不出来, 我先跳到第五章吧.