@@ -196,3 +196,98 @@ program demo_zfftb
196
196
call zfftb(4,x,w) !! `x` returns [(4.0,0.0), (8.0,0.0), (12.0,0.0), (16.0,0.0)].
197
197
end program demo_zfftb
198
198
```
199
+
200
+ ## ` fft `
201
+
202
+ ### Description
203
+
204
+ Computes the forward complex discrete fourier
205
+ transform (the fourier analysis).
206
+
207
+ ### Status
208
+
209
+ Experimental.
210
+
211
+ ### Class
212
+
213
+ Pure function.
214
+
215
+ ### Snytax
216
+
217
+ ` call [[fftpack(module):fft(interface)]](x [, n]) `
218
+
219
+ ### Argument
220
+
221
+ ` x ` : Shall be a ` complex ` array.
222
+ This argument is ` intent(in) ` .
223
+
224
+ ` n ` : Shall be an ` integer ` scalar.
225
+ This argument is ` intent(in) ` and ` optional ` .
226
+ The needed length of the ` complex ` sequence ` c ` .
227
+
228
+ #### Warning
229
+
230
+ if ` n <= size(x) ` , the first ` n ` elements of ` x ` will be included in the calculation.
231
+
232
+ if ` n > size(x) ` , the all elements of ` x ` and ` n-size(x) ` elements filled with zeros will be included in the calculation.
233
+
234
+ ### Example
235
+
236
+ ``` fortran
237
+ program demo_fft
238
+ use fftpack, only: fft
239
+ complex(kind=8) :: x(4)
240
+ x = [real(kind=8) :: 1.0, 2.0, 3.0, 4.0]
241
+ print *, fft(x) !! [(10.0,0.0), (-2.0,2.0), (-2.0,0.0), (-2.0,-2.0)].
242
+ print *, fft(x,3) !! [(6.0,0.0), (-1.5,0.86), (-1.5,0.86)].
243
+ print *, fft(x,5) !! [(10.0,0.0), (-4.0,1.3), (1.5,-2.1), (1.5,2.1), (-4.0,1.3)].
244
+ end program demo_fft
245
+ ```
246
+
247
+ ## ` ifft `
248
+
249
+ ### Description
250
+
251
+ Unnormalized inverse of ` fft ` .
252
+
253
+ ### Status
254
+
255
+ Experimental.
256
+
257
+ ### Class
258
+
259
+ Pure function.
260
+
261
+ ### Snytax
262
+
263
+ ` call [[fftpack(module):ifft(interface)]](x [, n]) `
264
+
265
+ ### Argument
266
+
267
+ ` x ` : Shall be a ` complex ` array.
268
+ This argument is ` intent(in) ` .
269
+
270
+ ` n ` : Shall be an ` integer ` scalar.
271
+ This argument is ` intent(in) ` and ` optional ` .
272
+ The needed length of the ` complex ` sequence ` c ` .
273
+
274
+ #### Warning
275
+
276
+ if ` n <= size(x) ` , the first ` n ` elements of ` x ` will be included in the calculation.
277
+
278
+ if ` n > size(x) ` , the all elements of ` x ` and ` n-size(x) ` elements filled with zeros will be included in the calculation.
279
+
280
+ ### Example
281
+
282
+ ``` fortran
283
+ program demo_ifft
284
+ use fftpack, only: fft, ifft
285
+ complex(kind=8) :: x(4)
286
+ x = [real(kind=8) :: 1.0, 2.0, 3.0, 4.0]
287
+ print *, fft(x) !! [(10.0,0.0), (-2.0,2.0), (-2.0,0.0), (-2.0,-2.0)].
288
+ print *, fft(x,3) !! [(6.0,0.0), (-1.5,0.86), (-1.5,0.86)].
289
+ print *, fft(x,5) !! [(10.0,0.0), (-4.0,1.3), (1.5,-2.1), (1.5,2.1), (-4.0,1.3)].
290
+ print *, ifft(fft(x))/4.0 !! [(1.0,0.0), (2.0,0.0), (3.0,0.0), (4.0,0.0)]
291
+ print *, ifft(fft(x), 3) !! [(6.0,2.0), (10.3,-1.0), (13.73,-1.0)]
292
+ end program demo_ifft
293
+ ```
0 commit comments