public float [] compute(float [] x)
        {
                if (x.length != n)
                        throw new IllegalArgumentException("BIJfft not properly initialized");
                float[] xre = new float[n];
                float[] xim = new float[n];
                for (int i = 0; i < n; i++)
                {
                        xre[i] = x[i];
                        xim[i] = 0;
                }
                int k = 0;
                int localnu1 = nu1;
                int localn2 = n2;
                for (int l = 1; l <= nu; l++)
                {
                        while (k < n)
                        {
                                for (int i = 1; i <= localn2; i++)
                                {
                                        // Get the proper values from the sin and cos tables.
                                        int p = bitrev (k >> localnu1);
                                        float c = (float) C[p];
                                        float s = (float) S[p];
                                        double arg = 2 * Math.PI * p / n;
                                        //if (c != (float) Math.cos (arg) || s != (float) Math.sin (arg))
                                        //        System.out.println("k="+k+" "+c+" "+(float) Math.cos (arg)+" "+s+" "+(float) Math.sin (arg));
                                        c = (float) Math.cos (arg);
                                        s = (float) Math.sin (arg);
                                        float tr = xre[k+localn2]*c + xim[k+localn2]*s;
                                        float ti = xim[k+localn2]*c - xre[k+localn2]*s;
                                        xre[k+localn2] = xre[k] - tr;
                                        xim[k+localn2] = xim[k] - ti;
                                        xre[k] += tr;
                                        xim[k] += ti;
                                        k++;
                                }
                                k += localn2;
                        }
                        k = 0;
                        localnu1--;
                        localn2 = localn2/2;
                }
                k = 0;
                int r;
                while (k < n)
                {
                        r = bitrev (k);
                        if (r > k)
                        {
                                float tr = xre[k];
                                float ti = xim[k];
                                xre[k] = xre[r];
                                xim[k] = xim[r];
                                xre[r] = tr;
                                xim[r] = ti;
                        }
                        k++;
                }
                float[] mag = new float[n/2];
                mag[0] = (float) (Math.sqrt(xre[0]*xre[0] + xim[0]*xim[0]))/n;
                for (int i = 1; i < n/2; i++)
                        mag[i]= 2 * (float) (Math.sqrt(xre[i]*xre[i] + xim[i]*xim[i]))/n;
                return mag;
        }