Exemple #1
0
        static void ExampleUsePlanDirectly()
        {
            // Use the same arrays for as many transformations as you like.
            // If you can use the same arrays for your transformations, this is faster than calling DFT.FFT / DFT.IFFT
            using (var timeDomain = new FftwArrayComplex(253))
                using (var frequencyDomain = new FftwArrayComplex(timeDomain.GetSize()))
                    using (var fft = FftwPlanC2C.Create(timeDomain, frequencyDomain, DftDirection.Forwards))
                        using (var ifft = FftwPlanC2C.Create(frequencyDomain, timeDomain, DftDirection.Backwards))
                        {
                            // Set the input after the plan was created as the input may be overwritten
                            // during planning
                            for (int i = 0; i < timeDomain.Length; i++)
                            {
                                timeDomain[i] = i % 10;
                            }

                            // timeDomain -> frequencyDomain
                            fft.Execute();

                            for (int i = frequencyDomain.Length / 2; i < frequencyDomain.Length; i++)
                            {
                                frequencyDomain[i] = 0;
                            }

                            // frequencyDomain -> timeDomain
                            ifft.Execute();

                            // Do as many forwards and backwards transformations here as you like
                        }
        }
Exemple #2
0
 public InverseComplexFft(int fftSize)
 {
     FftSize    = fftSize;
     Input      = new AlignedArrayComplex(16, fftSize);
     Output     = new AlignedArrayComplex(16, fftSize);
     InverseFft = FftwPlanC2C.Create(Input, Output, DftDirection.Backwards, PlannerFlags.Estimate);
 }
Exemple #3
0
        public static void SetupPlan(int numDpTime)
        {
            DFT.Wisdom.Import("wisdom.txt");

            mTimeBuffer = new FftwArrayComplex(numDpTime);
            mFreqBuffer = new FftwArrayComplex(numDpTime);
            mPlanFore   = FftwPlanC2C.Create(mTimeBuffer, mFreqBuffer, DftDirection.Forwards, PlannerFlags.Measure);
            mPlanBack   = FftwPlanC2C.Create(mFreqBuffer, mTimeBuffer, DftDirection.Backwards, PlannerFlags.Measure);
        }
Exemple #4
0
        public FFT(int ySize, int xSize, int nCores)
        {
            var dims = new int[] { ySize, xSize };

            ImageBuffer   = new AlignedArrayComplex(16, dims);
            FourierBuffer = new AlignedArrayComplex(16, dims);
            fft           = FftwPlanC2C.Create(ImageBuffer, FourierBuffer, DftDirection.Forwards, PlannerFlags.Default, nCores);
            ifft          = FftwPlanC2C.Create(FourierBuffer, ImageBuffer, DftDirection.Backwards, PlannerFlags.Default, nCores);
        }