void cosqb1(int n, double x[], double wtable[])
     {
         int     modn, i, k;
         int     kc, ns2;
         double  xim1;

         ns2=(n+1)/ 2;
         for(i=2; i<n; i+=2)
         {
	     xim1=x[i-1]+x[i];
	     x[i]-=x[i-1];
	     x[i-1]=xim1;
         }
         x[0]+=x[0];
         modn=n%2;
         if(modn==0) x[n-1]+=x[n-1];
         rfftb1(n, x, wtable, n);
         for(k=1; k<ns2; k++)
         {
	     kc=n-k;
	     wtable[k+n]=wtable[k-1]*x[kc]+wtable[kc-1]*x[k];
	     wtable[kc+n]=wtable[k-1]*x[k]-wtable[kc-1]*x[kc];
         }
         if(modn==0) x[ns2]=wtable[ns2-1]*(x[ns2]+x[ns2]);
         for(k=1; k<ns2; k++)
         {
	     kc=n-k;
	     x[k]=wtable[k+n]+wtable[kc+n];
	     x[kc]=wtable[k+n]-wtable[kc+n];
         }
         x[0]+=x[0];
     }