Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fftpack.h
1 #ifndef __FFTPACK_H__
2 #define __FFTPACK_H__
3 
4 #include "f2c.h"
5 
6 
7 /* In this file all interfaces from cfft*.c (converted from cfft*.f)
8  are collected and augmented with the documentation from doc.txt.
9  The original code is from netlib.org/fftpack.
10  evers@vision-n.de 2009-03
11 
12  Just include this file and link to all *.c file from this directory.
13 */
14 
15 
16 // forward declarations for fftppack/cfft*.c file converted with f2c
17 // from cfft*.h
18 
19 /******************************************************************
20 
21 subroutine cffti(n,wsave)
22 
23 ******************************************************************
24 
25 subroutine cffti initializes the array wsave which is used in
26 both cfftf and cfftb. the prime factorization of n together with
27 a tabulation of the trigonometric functions are computed and
28 stored in wsave.
29 
30 input parameter
31 
32 n the length of the sequence to be transformed
33 
34 output parameter
35 
36 wsave a work array which must be dimensioned at least 4*n+15
37  the same work array can be used for both cfftf and cfftb
38  as long as n remains unchanged. different wsave arrays
39  are required for different values of n. the contents of
40  wsave must not be changed between calls of cfftf or cfftb.
41 
42 */
43 extern "C" int cffti_(integer *n, real *wsave);
44 
45 /*****************************************************************
46 
47 subroutine cfftf(n,c,wsave)
48 
49 ******************************************************************
50 
51 subroutine cfftf computes the forward complex discrete fourier
52 transform (the fourier analysis). equivalently , cfftf computes
53 the fourier coefficients of a complex periodic sequence.
54 the transform is defined below at output parameter c.
55 
56 the transform is not normalized. to obtain a normalized transform
57 the output must be divided by n. otherwise a call of cfftf
58 followed by a call of cfftb will multiply the sequence by n.
59 
60 the array wsave which is used by subroutine cfftf must be
61 initialized by calling subroutine cffti(n,wsave).
62 
63 input parameters
64 
65 
66 n the length of the complex sequence c. the method is
67  more efficient when n is the product of small primes. n
68 
69 c a complex array of length n which contains the sequence
70 
71 wsave a real work array which must be dimensioned at least 4n+15
72  in the program that calls cfftf. the wsave array must be
73  initialized by calling subroutine cffti(n,wsave) and a
74  different wsave array must be used for each different
75  value of n. this initialization does not have to be
76  repeated so long as n remains unchanged thus subsequent
77  transforms can be obtained faster than the first.
78  the same wsave array can be used by cfftf and cfftb.
79 
80 output parameters
81 
82 c for j=1,...,n
83 
84  c(j)=the sum from k=1,...,n of
85 
86  c(k)*exp(-i*(j-1)*(k-1)*2*pi/n)
87 
88  where i=sqrt(-1)
89 
90 wsave contains initialization calculations which must not be
91  destroyed between calls of subroutine cfftf or cfftb
92 
93 */
94 extern "C" int cfftf_(integer *n, real *c__, real *wsave);
95 
96 
97 /*****************************************************************
98 
99 subroutine cfftb(n,c,wsave)
100 
101 ******************************************************************
102 
103 subroutine cfftb computes the backward complex discrete fourier
104 transform (the fourier synthesis). equivalently , cfftb computes
105 a complex periodic sequence from its fourier coefficients.
106 the transform is defined below at output parameter c.
107 
108 a call of cfftf followed by a call of cfftb will multiply the
109 sequence by n.
110 
111 the array wsave which is used by subroutine cfftb must be
112 initialized by calling subroutine cffti(n,wsave).
113 
114 input parameters
115 
116 
117 n the length of the complex sequence c. the method is
118  more efficient when n is the product of small primes.
119 
120 c a complex array of length n which contains the sequence
121 
122 wsave a real work array which must be dimensioned at least 4n+15
123  in the program that calls cfftb. the wsave array must be
124  initialized by calling subroutine cffti(n,wsave) and a
125  different wsave array must be used for each different
126  value of n. this initialization does not have to be
127  repeated so long as n remains unchanged thus subsequent
128  transforms can be obtained faster than the first.
129  the same wsave array can be used by cfftf and cfftb.
130 
131 output parameters
132 
133 c for j=1,...,n
134 
135  c(j)=the sum from k=1,...,n of
136 
137  c(k)*exp(i*(j-1)*(k-1)*2*pi/n)
138 
139  where i=sqrt(-1)
140 
141 wsave contains initialization calculations which must not be
142  destroyed between calls of subroutine cfftf or cfftb
143 
144 */
145 
146 extern "C" int cfftb_(integer *n, real *c__, real *wsave);
147 
148 
149 
150 #endif