下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、求解逆矩阵源代码:#include #include #include #definetiny 1.0e-20void inverse(double*,int);void ludcmp(double*, int, int*, double*); void lubksb(double*, int, int*, double*); double *matrix(int,int,int,int);double *vector(int,int);voidfree_matrix(double*,int,int,int,int); voidfree_vector(double*,int,int);void
2、 inverse(double *mat, int dim)int i,j,*indx; double *y,d,*col;y = matrix(0,dim-1,0,dim-1);indx = (int *)malloc(unsigned)(dim*sizeof(int); col = vector(0,dim-1);ludcmp(mat,dim,indx,&d); for (j=0;jdim;j+)for (i=0;idim;i+) coli = 0.0; colj = 1.0; lubksb(mat,dim,indx,col);for (i=0;idim;i+) yij = coli;fo
3、r (i=0;idim;i+) for (j=0;jdim;j+)matij = yij; free_matrix(y,0,dim-1,0,dim-1); free_vector(col,0,dim-1); free(indx);void ludcmp(double *a, int n, int *indx, double *d)int i,imax,j,k;doublebig,dum,sum,temp; double*vv;vv = (double*)malloc(unsigned)(n*sizeof(double); if (!vv)fprintf(stderr,error allocat
4、ing vector memoryn); exit(1);*d = 1.0;for (i=0;in;i+)big = 0.0;for (j=0;j big) big = temp;if (big = 0.0)fprintf(stderr,singular matrix in routine ludcmpn); for (j=0;jn;j+) printf( %f ,aij); printf(/n);exit(1);vvi = 1.0/big;for (j=0;jn;j+)for (i=0;ij;i+)sum = aij;for (k=0;ki;k+) sum -= aik * akj; aij
5、 = sum;big = 0.0;for (i=j;in;i+)sum = aij;for (k=0;k= big)big = dum; imax = i;if (j != imax)for (k=0;kn;k+)dum = aimaxk; aimaxk = ajk; ajk = dum;*d = -(*d);vvimax = vvj;indxj = imax;if (ajj = 0.0) ajj = tiny;if (j != n-1)dum = 1.0 / ajj;for (i=j+1;in;i+) aij *= dum;free(vv);void lubksb(double *a, in
6、t n, int *indx, double *b)int i,ip,j,ii=-1; doublesum;for (i=0;i=0)for (j=ii;j=0;i-)sum = bi;for (j=i+1;jn;j+) sum -= aij * bj; bi = sum / aii;“”“”at the end, xiao bian gives you a passage. minand once said, people who learn to learn are very happy people. in every wonderful life, learning is an ete
7、rnal theme. as a professional clerical and teaching position, i understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning can achieve better self. only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. this document is also ed
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 46763-2025稀土铁硼烧结永磁体晶界扩散效果评价方法
- 2025年大学大四(交通运输)智能交通系统应用试题及答案
- 2025年中职(中药)中药炮制阶段测试题及答案
- 2025年高职(康复营养治疗)营养治疗专项测试试题及答案
- 2025年中职计算机平面设计(设计节能规范)试题及答案
- 2025年大学大四(安全工程)安全评价综合测试试题及答案
- 2025年中职数据综合技能实训(处理技能)试题及答案
- 2025年中职畜牧兽医(动物解剖生理)试题及答案
- 2025年大学汉语言文学(中国现代文学研究)试题及答案
- 2025年中职机器人应用技术(机器人应用技术案例)试题及答案
- 清华大学教师教学档案袋制度
- 公租房完整租赁合同范本
- 东南大学附属中大医院2026年招聘备考题库及答案详解参考
- 2025新疆阿瓦提县招聘警务辅助人员120人参考笔试题库及答案解析
- 贵州国企招聘:2025贵州盐业(集团)有限责任公司贵阳分公司招聘考试题库附答案
- 2025-2026学年秋季学期教学副校长工作述职报告
- GB/T 3098.5-2025紧固件机械性能第5部分:自攻螺钉
- 2026年服装电商直播转化技巧
- 2025-2026学年小学美术浙美版(2024)二年级上册期末练习卷及答案
- 水电站压力管道课件
- 铁总建设201857号 中国铁路总公司 关于做好高速铁路开通达标评定工作的通知
评论
0/150
提交评论