标题:《求助》debug !
只看楼主
fzyjane
Rank: 1
等 级:新手上路
帖 子:21
专家分:5
注 册:2009-7-30
结帖率:100%
 问题点数:0 回复次数:1 
《求助》debug !
麻烦看一下子程序的一部分,错误信息:
9 [main] step.method 188_cygtls::handle_exceptions: Error 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;
        }
    }
 
**************************************************************************
  
  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=skv;j<sk;j++)                /* missing data part*/                  
      {num = 0;     
       su0=z[j];
       for(l=sk0; l<skv ; l++)         /* validation data part*/                 
           if( z[l] == z[j] && y[l] == y[j] )  num++;
       for(l=sk0; l<skv ; l++)
          { if( z[l] == z[j]&& y[l] == y[j] )
                   id[j][l] = 1.0 / ( (double)(num) );                 
            else
                   id[j][l] = 0.0;                 
           }
       }
     }   
                           
  for(i=0;i<s; i++)                                         
    { sk0+=ni[i];
         sk=sk0+ni[i+1];
         skv=sk0+niv[i+1];   
      for(j=skv;j<sk;j++)                                 
        { su1 = su2 =0.0;
          for(l=sk0; l<skv ; l++)                          
             su0=0.0;
             for(r=0; r <=p; r++)
                { 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 )*id[j][l]*x0[l][i0];           /*first derivative of alpha and beta*/
                a0[i0]+=su1;
                for (j0=r; j0<p1;j++)
                    su2 = -tmp2 *id[j][l]*x0[l][r]* x0[r][l];    /* second derivative of alpha and beta,id for indicator function*/   
                    c0[r][j0]+=su2;            
               }
           }
        }   
        
          for(j=0; j<= p; j++)
          { a4[j][0] = a[j][0]+a0[j];
            a4[j][1] = 0.0;
          }
        for(j=0; j<= p; j++)
           for(k=0; k<= p; k++)
                c4[j][k] = c[j][k]+c0[j][k];
               
        for(i0=0;i0<p;i0++)
           {for(j0=i0+1;j0<p1;j0++)
                 {tmp=c4[i0][j0];
                  c4[j0][i0]=tmp;
                     }
            }
            
        gaussj(c4,p2,a4,2);
        
       for(j=0; j<= p; j++)
             cof[j][4] += -a4[j][0];    /*Estimator of alpha and beta*/
            
         su4 = 0.0;
          for(j0=0; j0 < p1; j0++)
              su4 += a[j0][0];
          if(fabs(su4) < E) break;  
          /*if(fabs(a4[0][0]) < E && fabs(a4[1][0]) < E) break;  */
  }     
        


      




[ 本帖最后由 fzyjane 于 2010-4-23 04:53 编辑 ]
搜索更多相关主题的帖子: debug 
2010-04-23 04:33
fzyjane
Rank: 1
等 级:新手上路
帖 子:21
专家分:5
注 册:2009-7-30
得分:0 
已经找到错误了。谢谢!
2010-04-23 10:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-304114-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.289656 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved