欢迎来到天天文库
浏览记录
ID:11595790
大小:22.00 KB
页数:3页
时间:2018-07-12
《内点惩罚函数法子程》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include"hjfgf.c"#include"stdlib.h"voidgradient(doublex[],doubleg[],intn){inti; doubleaf,f1,f2,dltx=0.000001; for(i=0;i2、doubleepsg,intn,doublex[]){double*a,*b,ff; a=(double*)malloc(n*sizeof(double)); b=(double*)malloc(n*sizeof(double)); jtf(x0,h0,s,n,a,b); ff=gold(a,b,epsg,n,x); free(a); free(b); return(ff);}doubledfpopt(doublexx[],doubleh0,doubleeps,doubleepsg,intn){inti,j,k; doubleae,zcc; double*s,3、*x,*ay[2],*df[2],*zd[2],*zc[2],*zh[2]; s=(double*)malloc(n*sizeof(double)); x=(double*)malloc(n*sizeof(double)); for(i=0;i<2;i++) {ay[i]=(double*)malloc(n*sizeof(double)); df[i]=(double*)malloc(n*sizeof(double)); zd[i]=(double*)malloc(n*sizeof(double)); zc[i]=(double*)malloc(n*sizeof(4、double)); zh[i]=(double*)malloc(n*n*sizeof(double)); } for(i=0;i5、0;i6、;i7、[1]+i)=*(df[0]+i); zcc=zcc+(*(zd[0]+i))*(*(zd[1]+i)); } for(i=0;i
2、doubleepsg,intn,doublex[]){double*a,*b,ff; a=(double*)malloc(n*sizeof(double)); b=(double*)malloc(n*sizeof(double)); jtf(x0,h0,s,n,a,b); ff=gold(a,b,epsg,n,x); free(a); free(b); return(ff);}doubledfpopt(doublexx[],doubleh0,doubleeps,doubleepsg,intn){inti,j,k; doubleae,zcc; double*s,
3、*x,*ay[2],*df[2],*zd[2],*zc[2],*zh[2]; s=(double*)malloc(n*sizeof(double)); x=(double*)malloc(n*sizeof(double)); for(i=0;i<2;i++) {ay[i]=(double*)malloc(n*sizeof(double)); df[i]=(double*)malloc(n*sizeof(double)); zd[i]=(double*)malloc(n*sizeof(double)); zc[i]=(double*)malloc(n*sizeof(
4、double)); zh[i]=(double*)malloc(n*n*sizeof(double)); } for(i=0;i5、0;i6、;i7、[1]+i)=*(df[0]+i); zcc=zcc+(*(zd[0]+i))*(*(zd[1]+i)); } for(i=0;i
5、0;i6、;i7、[1]+i)=*(df[0]+i); zcc=zcc+(*(zd[0]+i))*(*(zd[1]+i)); } for(i=0;i
6、;i7、[1]+i)=*(df[0]+i); zcc=zcc+(*(zd[0]+i))*(*(zd[1]+i)); } for(i=0;i
7、[1]+i)=*(df[0]+i); zcc=zcc+(*(zd[0]+i))*(*(zd[1]+i)); } for(i=0;i
此文档下载收益归作者所有