xref: /inferno-os/module/ffts.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1FFTs: module{
2	PATH:	con	"/dis/math/ffts.dis";
3
4	ffts: fn(a,b:array of real, ntot,n,nspan,isn:int);
5};
6
7#  multivariate complex fourier transform, computed in place
8#    using mixed-radix fast fourier transform algorithm.
9#  arrays a and b originally hold the real and imaginary
10#    components of the data, and return the real and
11#    imaginary components of the resulting fourier coefficients.
12#  multivariate data is indexed according to the fortran
13#    array element successor function, without limit
14#    on the number of implied multiple subscripts.
15#    the subroutine is called once for each variate.
16#    the calls for a multivariate transform may be in any order.
17#  ntot is the total number of complex data values.
18#  n is the dimension of the current variable.
19#  nspan/n is the spacing of consecutive data values
20#    while indexing the current variable.
21#  the sign of isn determines the sign of the complex
22#    exponential, and the magnitude of isn is normally one.
23#  univariate transform:
24#      ffts(a,b,n,n,n,1)
25#  trivariate transform with a(n1,n2,n3), b(n1,n2,n3):
26#      ffts(a,b,n1*n2*n3,n1,n1,1)
27#      ffts(a,b,n1*n2*n3,n2,n1*n2,1)
28#      ffts(a,b,n1*n2*n3,n3,n1*n2*n3,1)
29#  the data can alternatively be stored in a single vector c
30#    alternating real and imaginary parts. the magnitude of isn changed
31#    to two to give correct indexing increment, and a[0:] and a[1:] used
32#    for a and b
33