     ----------------------------------------------------------------------
     -- Title       :  DOS_012_Fourier
     -- Version     :  1.0
     -- Copyright   :  (C) 1994 David Wallace Croft.  All rights reserved.
     -- Author      :  David Wallace Croft, CompuServe [76600,102]
     -- Compiler    :  Meridian OpenAda for DOS
     -- Description :  Fourier Transform Spectral Methods
     --                Numerical Recipes, Ch. 12
     ----------------------------------------------------------------------

     with A83_014_Vector; use A83_014_Vector;

     package DOS_012_Fourier is
     ----------------------------------------------------------------------
     ----------------------------------------------------------------------

     procedure Correlation (
       Ans   : in out Vector_Type;
       Data1 : in     Vector_Type;
       Data2 : in     Vector_Type;
       N     : in     integer );
     ----------------------------------------------------------------------
     -- Data1 & Data2 each of length N (including any user-supplied zero
     -- padding).  N must be an integer power of 2.
     ----------------------------------------------------------------------

     procedure Four1 (
       Data  : in out Vector_Type;
       NN    : in     integer;           -- Number of complex data points
       ISign : in     integer := +1 );   -- Either +1 or -1
     ----------------------------------------------------------------------
     -- Replaces Data by its discrete Fourier transform if ISign is +1.
     -- If ISign is -1, replaces with inverse Fourier transform.
     -- NN must be an integer power of 2 (not checked for!).
     -- Even components in Data are imaginary components.
     -- Data ( 1..NN ) is positive frequencies.
     -- Data ( NN+1..2*NN ) is negative freqs.
     ----------------------------------------------------------------------

     procedure RealFT (
       Data  : in out Vector_Type;
       N     : in     integer;
       ISign : in     integer );

     function Sngl ( F : float ) return float;
     ----------------------------------------------------------------------
     -- Simply returns F (dummy function).
     -- "Sngl" would convert a double to a single real value in some
     -- Pascal compilers.  I use it to keep the appearance of the Ada code
     -- as close as possible to the original Pascal in Numerical Recipes.
     ----------------------------------------------------------------------

     function Sqr ( F : float ) return float;

     procedure TwoFFT (
       FFT1  : in out Vector_Type;
       FFT2  : in out Vector_Type;
       N     : in     integer;
       Data1 : in     Vector_Type;
       Data2 : in     Vector_Type );

     ----------------------------------------------------------------------
     -- Unique functions not in Numerical Recipes.
     ----------------------------------------------------------------------

     function Complex ( R, I : Vector_Type ) return Vector_Type;
     ----------------------------------------------------------------------
     -- Returns double-length vector with odd components from vector R
     -- (real) and even components from vector I (imaginary).
     ----------------------------------------------------------------------

     procedure Demo;
     ----------------------------------------------------------------------
     -- Demonstrates autocorrelation of a sine wave.
     ----------------------------------------------------------------------

     function Imaginary ( V : Vector_Type ) return Vector_Type;
     ----------------------------------------------------------------------
     -- Returns a half-length vector with the even components of V
     ----------------------------------------------------------------------

     function Real ( V : Vector_Type ) return Vector_Type;
     ----------------------------------------------------------------------
     -- Returns a half-length vector with the odd components of V
     ----------------------------------------------------------------------

     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
     end DOS_012_Fourier;
