Exemplo n.º 1
0
        /// <summary>
        /// Backward Fourier transform.
        /// </summary>
        /// <param name="data">Array</param>
        private static void ifft(Complex32[] data)
        {
            int n = data.Length;
            int m = Log2(n);

            // reorder data first
            FastFourierTransform.ReorderData(data);

            // compute FFT
            int tn = 1, tm, k, i, even, odd;

            Complex32[] rotation;
            Complex32   t, ce, co;
            float       tr, ti;

            for (k = 1; k <= m; k++)
            {
                rotation = FastFourierTransform.BackwardComplexRotation(k);
                tm       = tn; tn <<= 1;

                for (i = 0; i < tm; i++)
                {
                    t = rotation[i];

                    for (even = i; even < n; even += tn)
                    {
                        odd = even + tm;
                        ce  = data[even];
                        co  = data[odd];

                        tr = co.Real * t.Real - co.Imag * t.Imag;
                        ti = co.Real * t.Imag + co.Imag * t.Real;

                        data[even].Real += tr;
                        data[even].Imag += ti;

                        data[odd].Real = ce.Real - tr;
                        data[odd].Imag = ce.Imag - ti;
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes the fast Hilbert transform.
 /// </summary>
 /// <param name="normalized">Normalized transform or not</param>
 /// <param name="direction">Processing direction</param>
 public FastHilbertTransform(bool normalized = true, Direction direction = Direction.Vertical)
 {
     this.FFT       = new FastFourierTransform(normalized, Direction.Both);
     this.direction = direction;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the fast Laplace transform.
 /// </summary>
 /// <param name="sigma">Standard deviation (0, 1)</param>
 /// <param name="normalized">Normalized transform or not</param>
 /// <param name="direction">Processing direction</param>
 public FastLaplaceTransform(float sigma = 0.0005f, bool normalized = true, Direction direction = Direction.Vertical)
 {
     this.FFT = new FastFourierTransform(true, Direction.Vertical);
     Sigma    = sigma; this.normalized = normalized; this.direction = direction;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes the fast cosine transform.
 /// </summary>
 /// <param name="direction">Processing direction</param>
 public FastCosineTransform(Direction direction = Direction.Vertical)
 {
     this.FFT       = new FastFourierTransform(false, Direction.Both);
     this.direction = direction;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes the fast Hartley transform.
 /// </summary>
 /// <param name="normalized">Normalized transform or not</param>
 /// <param name="direction">Processing direction</param>
 public FastHartleyTransform(bool normalized = true, Direction direction = Direction.Vertical)
 {
     this.FFT = new FastFourierTransform(normalized, direction);
 }