www.pudn.com > cghost.rar > JMAXN.C


 
  #include "math.h" 
  void jmaxn(x,n,eps,k,js) 
  int n,k,js[]; 
  double eps,x[]; 
  { extern double jmaxnf(); 
    int i,j,m,l,jt,il; 
    double y[10],b[10],p,z,t,h1,h2,f,dx; 
    js[0]=0; jt=1; h2=0.0; 
    while (jt==1) 
      { t=0.0; js[0]=js[0]+1; 
        for (i=1; i<=n; i++) 
          { f=jmaxnf(x,n,i); 
            t=t+fabs(f); 
          } 
        if (t=0; l--) 
                                  h2=-y[l]/(b[l+1]+h2); 
                                h2=h2+b[0]; 
                              } 
                            j=j+1; 
                          } 
                      } 
                    x[i]=h2;  
                  } 
                x[i]=z; 
              } 
            if (js[0]==k) jt=0; 
          } 
      } 
    js[1]=1; 
    f=jmaxnf(x,n,0); x[n]=f; 
    dx=0.00001; t=x[0]; 
    x[0]=t+dx; h1=jmaxnf(x,n,0); 
    x[0]=t-dx; h2=jmaxnf(x,n,0); 
    x[0]=t; 
    t=h1+h2-2.0*f; 
    if (t>0.0) js[1]=-1; 
    j=1; jt=1; 
    while (jt==1) 
      { j=j+1; dx=0.00001; jt=0; 
        t=x[j-1]; 
        x[j-1]=t+dx; h2=jmaxnf(x,n,0); 
        x[j-1]=t-dx; h1=jmaxnf(x,n,0); 
        x[j-1]=t; t=h1+h2-2.0*f; 
        if ((t*js[1]<0.0)&&(j0.0) js[1]=0; 
    return; 
  }