欢迎来到天天文库
浏览记录
ID:57690240
大小:20.50 KB
页数:6页
时间:2020-09-01
《QR分解法求矩阵的逆.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、QR分解法求矩阵的逆#include#include#include#defineM20voidset(longdouble*a,inta_line,inta_row,inti,longdouble*b,intsize){longdouble*m=b;if(a_line!=size){printf("cannotset");exit(0);}else{for(intk=0;k2、ze,longdoublel){longdouble*temp=a;for(intk=0;k3、,intsize){longdoublesum=0;for(intk=0;k4、("QR分解法求矩阵的逆A=Q*R");printf("请输入%d*%d的矩阵:",M,M);for(i=0;i0;ak--){longdouble*temp=draw(B[0],M,M,ak-1);longdoubler=function1(a,temp,M)/function1(temp,temp,M);minus(a,function2(t5、emp,M,r),M);}set(B[0],M,M,k,a,M);}printf("A正交化:");for(i=0;i6、++){for(intj=0;j7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
2、ze,longdoublel){longdouble*temp=a;for(intk=0;k3、,intsize){longdoublesum=0;for(intk=0;k4、("QR分解法求矩阵的逆A=Q*R");printf("请输入%d*%d的矩阵:",M,M);for(i=0;i0;ak--){longdouble*temp=draw(B[0],M,M,ak-1);longdoubler=function1(a,temp,M)/function1(temp,temp,M);minus(a,function2(t5、emp,M,r),M);}set(B[0],M,M,k,a,M);}printf("A正交化:");for(i=0;i6、++){for(intj=0;j7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
3、,intsize){longdoublesum=0;for(intk=0;k4、("QR分解法求矩阵的逆A=Q*R");printf("请输入%d*%d的矩阵:",M,M);for(i=0;i0;ak--){longdouble*temp=draw(B[0],M,M,ak-1);longdoubler=function1(a,temp,M)/function1(temp,temp,M);minus(a,function2(t5、emp,M,r),M);}set(B[0],M,M,k,a,M);}printf("A正交化:");for(i=0;i6、++){for(intj=0;j7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
4、("QR分解法求矩阵的逆A=Q*R");printf("请输入%d*%d的矩阵:",M,M);for(i=0;i0;ak--){longdouble*temp=draw(B[0],M,M,ak-1);longdoubler=function1(a,temp,M)/function1(temp,temp,M);minus(a,function2(t
5、emp,M,r),M);}set(B[0],M,M,k,a,M);}printf("A正交化:");for(i=0;i6、++){for(intj=0;j7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
6、++){for(intj=0;j7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
7、j]=C[i][j];}else{if(j-i==M)E[i][j]=1;elseE[i][j]=0;}}}for(k=0;k
此文档下载收益归作者所有