context: /*************************************************************************
  ALGLIB 3.18.0 (source code generated 2021-10-25)
  Copyright (c) Sergey Bochkanov (ALGLIB project).
  
  >>> SOURCE LICENSE >>>
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation (www.fsf.org); either version 2 of the 
  License, or (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  A copy of the GNU General Public License is available at
  http://www.fsf.org/licensing/licenses
  >>> END OF LICENSE >>>
  *************************************************************************/
  #pragma warning disable 162
  #pragma warning disable 164
  #pragma warning disable 219
  using System;
  
  public partial class alglib
  {
  
      
      /*************************************************************************
      1-dimensional complex FFT.
  
      Array size N may be arbitrary number (composite or prime).  Composite  N's
      are handled with cache-oblivious variation of  a  Cooley-Tukey  algorithm.
      Small prime-factors are transformed using hard coded  codelets (similar to
      FFTW codelets, but without low-level  optimization),  large  prime-factors
      are handled with Bluestein's algorithm.
  
      Fastests transforms are for smooth N's (prime factors are 2, 3,  5  only),
      most fast for powers of 2. When N have prime factors  larger  than  these,
      but orders of magnitude smaller than N, computations will be about 4 times
      slower than for nearby highly composite N's. When N itself is prime, speed
      will be 6 times lower.
  
      Algorithm has O(N*logN) complexity for any N (composite or prime).
  
      INPUT PARAMETERS
          A   -   array[0..N-1] - complex function to be transformed
          N   -   problem size
  
      OUTPUT PARAMETERS
          A   -   DFT of a input array, array[0..N-1]
                  A_out[j] = SUM(A_in[k]*exp(-2*pi*sqrt(-1)*j*k/N), k = 0..N-1)
  
  
        -- ALGLIB --
           Copyright 29.05.2009 by Bochkanov Sergey
      *************************************************************************/
      public static void fftc1d(ref complex[] a, int n)
      {
      
          fft.fftc1d(ref a, n, null);
      }
      
      public static void fftc1d(ref complex[] a, int n, alglib.xparams _params)
      {
      
          fft.fftc1d(ref a, n, _params);
      }
              
      public static void fftc1d(ref complex[] a)
      {
          int n;
      
      
          n = ap.len(a);
          fft.fftc1d(ref a, n, null);
      
          return;
      }
              
      public static void fftc1d(ref complex[] a, alglib.xparams _params)
      {
          int n;
      
      
          n = ap.len(a);
          fft.fftc1d(ref a, n, _params);
      
          return;
      }
      
      /*************************************************************************
      1-dimensional complex inverse FFT.
  
      Array size N may be arbitrary number (composite or prime).  Algorithm  has
      O(N*logN) complexity for any N (composite or prime).
  
      See FFTC1D() description for more information about algorithm performance.
  
      INPUT PARAMETERS
          A   -   array[0..N-1] - complex array to be transformed
          N   -   problem size
  
      OUTPUT PARAMETERS
          A   -   inverse DFT of a input array, array[0..N-1]
                  A_out[j] = SUM(A_in[k]/N*exp(+2*pi*sqrt(-1)*j*k/N), k = 0..N-1)
  
  
        -- ALGLIB --
           Copyright 29.05.2009 by Bochkanov Sergey
      *************************************************************************/
      public static void fftc1dinv(ref complex[] a, int n)
      {
      
          fft.fftc1dinv(ref a, n, null);
      }
      
      public static void fftc1dinv(ref complex[] a, int n, alglib.xparams _params)
      {
      
          fft.fftc1dinv(ref a, n, _params);
      }
              
      public static void fftc1dinv(ref complex[] a)
      {
          int n;
      
      
          n = ap.len(a);
          fft.fftc1dinv(ref a, n, null);
      
          return;
      }
              
      public static void fftc1dinv(ref complex[] a, alglib.xparams _params)
      {
          int n;
      
      
          n = ap.len(a);
          fft.fftc1dinv(ref a, n, _params);
      
          return;
      }
      
      /*************************************************************************
      1-dimensional real FFT.
  
      Algorithm has O(N*logN) complexity for any N (composite or prime).
  
      INPUT PARAMETERS
          A   -   array[0..N-1] - real function to be transformed
          N   -   problem size
  
      OUTPUT PARAMETERS
          F   -   DFT of a input array, array[0..N-1]
                  F[j] = SUM(A[k]*exp(-2*pi*sqrt(-1)*j*k/N), k = 0..N-1)
  
      NOTE:
          F[] satisfies symmetry property F[k] = conj(F[N-k]),  so just one half
      of  array  is  usually needed. But for convinience subroutine returns full
      complex array (with frequencies above N/2), so its result may be  used  by
      other FFT-related subroutines.
  
  
        -- ALGLIB --
           Copyright 01.06.2009 by Bochkanov Sergey
      *************************************************************************/
      public static void fftr1d(double[] a, int n, out complex[] f)
      {
          f = new complex[0];
          fft.fftr1d(a, n, ref f, null);
      }
      
      public static void fftr1d(double[] a, int n, out complex[] f, alglib.xparams _params)
      {
          f = new complex[0];
          fft.fftr1d(a, n, ref f, _params);
      }
              
      public static void fftr1d(double[] a, out complex[] f)
      {
          int n;
      
          f = new complex[0];
          n = ap.len(a);
          fft.fftr1d(a, n, ref f, null);
      
          return;
      }
              
      public static void fftr1d(double[] a, out complex[] f, alglib.xparams _params)
      {
          int n;
      
          f = new complex[0];
          n = ap.len(a);
          fft.fftr1d(a, n, ref f, _params);
      
          return;
      }
      
      /*************************************************************************
      1-dimensional real inverse FFT.
  
      Algorithm has O(N*logN) complexity for any N (composite or prime).
  
      INPUT PARAMETERS
          F   -   array[0..floor(N/2)] - frequencies from forward real FFT
          N   -   problem size
  
      OUTPUT PARAMETERS
  
gt:         A   -   inverse DFT of a input array, array[0..N-1]