Example #1
0
        // Use the low-level CuFFTW API to perform an inverse transform.
        static void DoInversePlan(CuFFTWAPI api, Complex[] input, out Complex[] output)
        {
            output = new Complex[input.Length];

            var inversePlan = api.fftw_plan_dft_1d(
                input.Length,
                input,
                output,
                FFTW_BACKWARD,
                FFTW_ESTIMATE);

            api.fftw_execute(inversePlan);
            api.fftw_destroy_plan(inversePlan);

            // Scale the output to obtain the inverse.
            for (var i = 0; i < output.Length; i++)
            {
                output[i] /= output.Length;
            }

            Console.WriteLine("Inverse Values:");
            for (var i = 0; i < output.Length; i++)
            {
                Console.WriteLine($"  [{i}] = {output[i].Real}");
            }
        }
Example #2
0
 /// <summary>
 /// Constructs a new CuFFTW instance.
 /// </summary>
 public CuFFTW(CuFFTWAPIVersion?version)
 {
     API = CuFFTWAPI.Create(version);
 }