帮忙看一下,这段程序错在哪里?
麻烦看一下下面的一个子程序,错误信息:9 [main] step.method 2232_cygtls::handle_exceptions: Errof while dumping state <probable corrupted stack> segmentation fault <core dumped>
谢谢!
另: 要主程序运行的话,给我短消息
*****************************************************************************************************************************
void mlem(y,yy,x,z,n,s,p,ps,ni,niv,coef,ue,var,var0,uv,md1,md2,md3,md4,md5,u)
double *y, *yy, **x, *z, **coef, **var,**var0,**uv,**ue,*u;
int n, s, p, ps, *ni, *niv, md1,md2,md3,md4,md5;
#define E 0.0001
#define C 1.71877
{
int i, j, i0, j0, r, k, l, k0,l0, k1,l1,m, p1, p2, jj, nt, nv;
int sk0, sk, skv,sk01,sk1,skv1,sk02,sk2,skv2,num;
double tmp, tmp0, tmp1, tmp2, tmp3, tmu, tmu1, tmu2, su0, su1, su2, su3, su4, su5, su6;
double sm0,sm1,sm2,sm3,sm4,sm5,sm6,pv, xxi, xxj;
double **cof,*a0,**c0,**a,**c,**id, **a4, **c4, **idv, *d, **x0, *dp0, **dp1,**v, **v0, **w,**w0;
double **vcof,*piv;
double *vector(), **matrix();
void free_vector(), free_matrix();
void gaussj(), mtv();
cof = matrix(0,ps,0,5);
vcof = matrix(0,ps,0,s);
w0 = matrix(0,s,0,5);
a0 = vector(0,ps);
c0 = matrix(0,ps,0,ps);
a = matrix(0,ps,0,2);
a4 = matrix(0,ps,0,2);
c = matrix(0,ps,0,ps);
c4 = matrix(0,ps,0,ps);
id = matrix(0,n,0,n);
idv = matrix(0,n,0,n);
d = vector(0,n);
x0 = matrix(0,n,0,ps);
dp0 = vector(0,n);
dp1 = matrix(0,n,0,ps);
v = matrix(0,ps,0,ps);
v0 = matrix(0,ps,0,ps);
w = matrix(0,n,0,ps);
piv = vector(0,s+1);
p1 = p+1;
p2 = p1;
nv = 0;
for(i=0; i <= s; i++)
{ nv += niv[i];
piv[i] = (double)(niv[i]) / (double)(ni[i]);
}
pv = (double)(nv)/(double)(n);
for(i=0; i<n; i++)
{ x0[i][0] = 1.0;
for(j=0; j < p; j++)
{ tmp = x[i][j];
x0[i][j+1] = tmp;
}
}
/* Method 5 */
if(md5 == 1)
{
for (k=0;k<p1;k++) cof[k][4] = 0.0;
for(m=1;m<=1000;m++)
{ for(j=0; j < p1; j++)
{ a0[j] = 0.0;
for(k=0; k< p1; k++)
c0[j][k] = 0.0; /* a0 is a first derivative and c0 is a second derivative */
}
sk0=0;
for(i=0;i<s; i++) /* each center */
{ sk0+=ni[i];
sk=sk0+ni[i+1];
skv=sk0+niv[i+1];
for(j= sk0; j < skv; j++) /* validation data part*/
{ su0=0.0;
for(r=0; r<p1; r++) /* loop in covariate number */
{ su0+= x0[j][r]*cof[r][4];}
tmp0 +=exp(su0);
tmp1 = tmp0/(1.0 + tmp0);
tmp2 = tmp1/(1.0 + tmp0);
for (i0=0;i0<p1;i0++)
{ su1 = (y[j]-tmp1)*x0[j][i0];
a0[i0]+=su1;
for(j0=i0;j0<p1;j0++)
{ su2 = -tmp2*x0[j][i0]*x0[j][j0];
c0[i0][j0]+= su2;
}
}
}
}
for(i0=0; i0 < p; i0++)
{ for(j0=i0+1; j0 < p2; j0++)
{ tmp = c0[i0][j0];
c0[j0][i0] = tmp;
}
}
for(i0=0; i0< p2; i0++)
{ a[i0][0] = a0[i0];
a[i0][1] = 0.0;
for(j0=0; j0 < p2; j0++)
{ c[i0][j0] = c0[i0][j0];
}
}
gaussj (c,p2, a, 2);
for(j0=0; j0 < p2; j0++)
{cof[j0][4] += -a[j0][0];}
su4 = 0.0;
for(j0=0; j0 < p1; j0++)
su4 += a[j0][0];
if(fabs(su4) < E) break;
}
for(j=0; j < p1; j++)
{ var[j][4] = -c[j][j];
var0[j][4] = -c[j][j];
}
for(j=0; j < ps; j++) coef[j][4] = cof[j][4];
}