- 1、本文档共14页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
哥来教你C语言(国外英语资料)
哥来教你C语言(国外英语资料)
One or two matrices multiplied by the classical algorithm:
If Q=M*N is set, M is the m1*n1 matrix and N is the m2*n2 matrix. When n1=m2 is there:
For (i=1; I for (j=1; j=n2; ++j) {
Q[i][j]=0;
For (k=1; k=n1; ++k) Q[i][j]+=M[i][k]*N[k][j];
}
The time complexity of this algorithm is O (m1*n1*n2).
Two, the algorithm of
Of the method, is a method proposed by V. in 1969 of.
We first discuss the method of calculating two order matrices.
For the two order matrix
A11 A12 B11 B12
A = A21, A22, B = B21, B22
First calculate the following 7 quantities (1)
X1 = (a11 + A22) * (B11 + B22);
X2 = (A21 + A22) * b11;
X3 = a11 * (B12 - B22);
X4 = A22 * (B21 - B11);
X5 = (a11 + A12) * b22;
X6 = (A21 - a11) * (B11 + B12);
X7 = (a12 - A22) * (B21 + B22);
Lets say C = AB. According to the rules of matrix multiplication, the elements of C are (2)
C11 = a11 * B11 + A12 * B21
C12 = a11 * B12 + A12 * B22
C21 = A21 * B11 + A22 * B21
C22 = A21 * B12 + A22 * B22
In comparison (1) (2), the elements of C can be expressed as (3)
C11 = X1 + X4 + X5 + x7
C12 = X3 + X5
C21 = x2 + X4
C22 = X1 + X3 + x2 + x6
According to the above method, we can calculate the 4 order matrix. First, we divide the 4 order matrices A and B into four blocks and 2 order matrices, and then use the formula to calculate their product, and then use (1) (3) to calculate the final result.
Ma11 MA12 MB11 MB12
A4 = ma21, ma22, B4 = mb21, mb22
among
A11, A12, A13, A14, B11, B12, B13, B14
Ma11 = A21, A22, MA12 = A23, A24, MB11 = B21, B22, MB12 = B23, B24
A31, A32, A33, A34, B31, B32, B33, B34
Ma21 = A41, A42, ma22 = A43, a44, mb21 = B41, b42, mb22 = b43, B44
Realization
/ / 2X2 matrix calculation
Void, Multiply2X2 (float, fOut_11, float, fOut_12, float, fOut_21, float, fOut_22,
Float, f1_11, float, f1_12, float, f1_21, float, f1_22,
Float, f2_11, float, f2_12, float, f2_21, float, f2_22)
{
Const, float, X1 ((f1_11 + f1_22) * (f2_11 + f2_22));
Const, float, X2 ((f1_21 + f1_22) * f2_11);
Const, float, X3 (f1_11 * (f2_12 -
文档评论(0)