private void recurseFft(double[] input, double[] output, int numFftPoints, boolean invert) {

        double divisor;

        /**
         * The direct and inverse FFT are essentially the same algorithm, except for two difference:
         * a scaling factor of "numberFftPoints" and the signal of the exponent in the weightFft
         * vectors, defined in the method <code>createWeightFft</code>.
         */

        if (!invert) {
            divisor = 1.0;
        } else {
            divisor = (double) numFftPoints;
        }

        /**
         * Initialize the input and output for the butterfly recursion
         */
        for (int i = 0; i < 2 * numFftPoints; i++) {
            output[i] = 0.0;
            input[i] = input[i] / divisor;
        }

        /**
         * Repeat the recursion log2(numberFftPoints) times, i.e., we have log2(numberFftPoints)
         * butterfly stages.
         */
        butterflyStage(input, output, numFftPoints, numFftPoints >> 1);

        return;
    }