System Function DFT

From NARS2000
Jump to navigationJump to search

This function is available in both monadic and dyadic forms

Monadic Function

Z←⎕DFT R returns the Discrete Fourier Transform of R.
R is a scalar or vector of Real or Complex numbers.
Z is a vector of length 2*⌈2⍟≢R of Complex numbers.


The monadic function is implemented by choosing the Fast Fourier Transform algorithm appropriate to the datatype of R. In particular, if the datatype of R is

  • Fixed Precision Integer or Floating Point, the FFT algorithm from Gnu Scientific Library is used
  • Multiple Precision Integer/Rational or Floating Point, the FFT algorithm MPFFT is used
  • Ball Arithmetic, the FFT algorithm from ARB is used

Because the underlying FFT algorithm is most efficient when the length of R is a power of two, the system function automatically pads its argument with a sufficient number of trailing zeros, and returns a result of the padded length.

For example,

      ⎕PP←10
      ⎕DFT 1 2 3 4
10 ¯2i2 ¯2 ¯2i¯2


Dyadic Function

Z←L ⎕DFT R returns the Discrete Fourier Transform of R or its Inverse depending upon the value of L.
R is a scalar or vector of Real or Complex numbers.
L is an integer scalar whose value is either 1 or ¯1.
Z is a vector of length 2*⌈2⍟≢R of Complex numbers.


The dyadic function 1 ⎕DFT R returns the Discrete Fourier Transform of R; ¯1 ⎕DFT R returns the Inverse Discrete Fourier Transform. As in the monadic case, the dyadic function chooses the (Inverse) Fast Fourier Transform algorithm appropriate to the datatype of R.

For example,

      ⎕PP←10
      ⎕DFT 1 2 3 4
10 ¯2i2 ¯2 ¯2i¯2 
      1 ⎕DFT 1 2 3 4
10 ¯2i2 ¯2 ¯2i¯2 
      ¯1 ⎕DFT ⎕DFT 1 2 3 4
1 2 3 4