-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFFTPACK5.1.html
4934 lines (3845 loc) · 197 KB
/
FFTPACK5.1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<HTML><HEAD><TITLE>fftpack 5.1</TITLE>
</HEAD><BODY>
<center>
<H2>FFTPACK 5.1<br>
A Fortran77 library of fast Fourier transforms</H2>
</center>
<HR>
<H2>Abstract</H2>
<p>Library FFTPACK 5.1 contains 1D, 2D, and multiple fast Fourier subroutines, written in Fortran 77, for
transforming real and complex data, real even and odd wave data, and real even and odd quarter-wave data.
All of the FFTPACK 5.1 routines listed above are grouped in triplets e.g. {CFFT1I, CFFT1F, CFFT1B}. The
suffix I denotes initialize, F denotes forward (as in forward transform) and B denotes backward. In an
application program, before calling B or F routines for the first time, or before calling them with a
different length, users must initialize an array by calling the I routine of the appropriate pair or triplet.
Note that I routines need not be called each time before a B or F routine is called.</p>
<p>All of the transform routines in FFTPACK 5.1 are normalized. </p>
<p>Error messages are written to unit 6 by routine XERFFT. The standard version of XERFFT issues an error
message and halts execution, so that no FFTPACK 5.1 routine will return to the calling program with error
return IER different than zero. Users may consider modifying the STOP statement in order to call system-specific
exception-handling facilities. </p>
<H2>Caveat</H2>
<p>FFTPACK 5.1 is not fully compliant with the Fortran 77 standard. There are several instances where
arrays of type REAL or COMPLEX are passed to a subroutine and used as a different type. We have not
passed the code through a rigorous standards-checker, so we do not have a list of the infractions.
Prospective users whose projects require strict adherence to the Fortran standard should not use
this library.</p>
<H2>References</H2>
<p> (1) Vectorizing the Fast Fourier Transforms, by Paul Swarztrauber, Parallel Computations, G. Rodrigue, ed., Academic Press,
New York 1982. </p>
<p>(2) Fast Fourier Transforms Algorithms for Vector Computers, by Paul Swarztrauber, Parallel Computing, (1984) pp.45-63.</p>
<H2>Overview</H2>
<PRE>
Complex Transform Routines
__________________________
<a href="#cfft1i.html">CFFT1I</a> 1D complex initialization
<a href="#cfft1b.html">CFFT1B</a> 1D complex backward
<a href="#cfft1f.html">CFFT1F</a> 1D complex forward
<a href="#cfft2i.html">CFFT2I</a> 2D complex initialization
<a href="#cfft2b.html">CFFT2B</a> 2D complex backward
<a href="#cfft2f.html">CFFT2F</a> 2D complex forward
<a href="#cfftmi.html">CFFTMI</a> multiple complex initialization
<a href="#cfftmb.html">CFFTMB</a> multiple complex backward
<a href="#cfftmf.html">CFFTMF</a> multiple complex forward
Real Transform Routines
_______________________
<a href="#rfft1i.html">RFFT1I</a> 1D real initialization
<a href="#rfft1b.html">RFFT1B</a> 1D real backward
<a href="#rfft1f.html">RFFT1F</a> 1D real forward
<a href="#rfft2i.html">RFFT2I</a> 2D real initialization
<a href="#rfft2b.html">RFFT2B</a> 2D real backward
<a href="#rfft2f.html">RFFT2F</a> 2D real forward
<a href="#rfftmi.html">RFFTMI</a> multiple real initialization
<a href="#rfftmb.html">RFFTMB</a> multiple real backward
<a href="#rfftmf.html">RFFTMF</a> multiple real forward
Real Cosine Transform Routines
______________________________
<a href="#cost1i.html">COST1I</a> 1D real cosine initialization
<a href="#cost1b.html">COST1B</a> 1D real cosine backward
<a href="#cost1f.html">COST1F</a> 1D real cosine forward
<a href="#costmi.html">COSTMI</a> multiple real cosine initialization
<a href="#costmb.html">COSTMB</a> multiple real cosine backward
<a href="#costmf.html">COSTMF</a> multiple real cosine forward
Real Sine Transform Routines
____________________________
<a href="#sint1i.html">SINT1I</a> 1D real sine initialization
<a href="#sint1b.html">SINT1B</a> 1D real sine backward
<a href="#sint1f.html">SINT1F</a> 1D real sine forward
<a href="#sintmi.html">SINTMI</a> multiple real sine initialization
<a href="#sintmb.html">SINTMB</a> multiple real sine backward
<a href="#sintmf.html">SINTMF</a> multiple real sine forward
Real Quarter-Cosine Transform Routines
______________________________________
<a href="#cosq1i.html">COSQ1I</a> 1D real quarter-cosine initialization
<a href="#cosq1b.html">COSQ1B</a> 1D real quarter-cosine backward
<a href="#cosq1f.html">COSQ1F</a> 1D real quarter-cosine forward
<a href="#cosqmi.html">COSQMI</a> multiple real quarter-cosine initialization
<a href="#cosqmb.html">COSQMB</a> multiple real quarter-cosine backward
<a href="#cosqmf.html">COSQMF</a> multiple real quarter-cosine forward
Real Quarter-Sine Transform Routines
____________________________________
<a href="#sinq1i.html">SINQ1I</a> 1D real quarter-sine initialization
<a href="#sinq1b.html">SINQ1B</a> 1D real quarter-sine backward
<a href="#sinq1f.html">SINQ1F</a> 1D real quarter-sine forward
<a href="#sinqmi.html">SINQMI</a> multiple real quarter-sine initialization
<a href="#sinqmb.html">SINQMB</a> multiple real quarter-sine backward
<a href="#sinqmf.html">SINQMF</a> multiple real quarter-sine forward
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfft1i.html"><h2>CFFT1I - initialization routine for CFFT1B and CFFT1F</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT1I (N, WSAVE, LENSAV, IER)
INTEGER N, LENSAV, IER
REAL WSAVE(LENSAV)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 subroutine CFFT1I initializes array WSAVE for use in
its companion routines CFFT1B and CFFT1F. Routine CFFT1I must
be called before the first call to CFFT1B or CFFT1F, and after
whenever the value of integer N changes.
Input Arguments
N Integer length of the sequence to be transformed. The
transform is most efficient when N is a product of
small primes.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*N + INT(LOG(REAL(N))/LOG(2.)) + 4.
Output Arguments
WSAVE Real work array with dimension LENSAV, containing the
prime factors of N and also containing certain trigonometric
values which will be used in routines CFFT1B or CFFT1F.
IER = 0 successful exit
= 2 input parameter LENSAV not big enough
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfft1b.html"><h2>CFFT1B - complex backward fast Fourier transform</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT1B (N, INC, C, LENC, WSAVE, LENSAV,
1 WORK, LENWRK, IER)
INTEGER N, INC, LENC, LENSAV, LENWRK, IER
COMPLEX C(LENC)
REAL WSAVE(LENSAV), WORK(LENWRK)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFT1B computes the one-dimensional Fourier
transform of a single periodic sequence within a complex array.
This transform is referred to as the backward transform or Fourier
synthesis, transforming the sequence from spectral to physical
space.
This transform is normalized since a call to CFFT1B followed
by a call to CFFT1F (or vice-versa) reproduces the original
array subject to algorithm constraints, roundoff error, etc.
Input Arguments
N Integer length of the sequence to be transformed. The
transform is most efficient when N is a product of
small primes.
INC Integer increment between the locations, in array C, of two
consecutive elements within the sequence to be transformed.
C Complex array of length LENC containing the sequence to be
transformed.
LENC Integer dimension of C array. LENC must be at least
INC*(N-1) + 1.
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT1I before
the first call to routine CFFT1F or CFFT1B for a given
transform length N. WSAVE's contents may be re-used for
subsequent calls to CFFT1F and CFFT1B with the same N.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*N + INT(LOG(REAL(N))/LOG(2.)) + 4.
WORK Real work array of dimension LENWRK.
LENWRK Integer dimension of WORK array. LENWRK must be at
least 2*N.
Output Arguments
C For index J*INC+1 where J=0,...,N-1,
C(J*INC+1) =
N-1
SUM C(K*INC+1)*EXP(I*J*K*2*PI/N)
K=0
where I=SQRT(-1).
At other indices, the output value of C does not differ
from input.
IER = 0 successful exit
= 1 input parameter LENC not big enough
= 2 input parameter LENSAV not big enough
= 3 input parameter LENWRK not big enough
= 20 input error returned by lower level routine
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfft1f.html"><h2>CFFT1F - complex forward fast Fourier transform</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT1F (N, INC, C, LENC, WSAVE, LENSAV,
1 WORK, LENWRK, IER)
INTEGER N, INC, LENC, LENSAV, LENWRK, IER
COMPLEX C(LENC)
REAL WSAVE(LENSAV), WORK(LENWRK)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFT1F computes the one-dimensional Fourier
transform of a single periodic sequence within a complex array.
This transform is referred to as the forward transform or Fourier
analysis, transforming the sequence from physical to spectral
space.
This transform is normalized since a call to CFFT1F followed
by a call to CFFT1B (or vice-versa) reproduces the original
array subject to algorithm constraints, roundoff error, etc.
Input Arguments
N Integer length of the sequence to be transformed. The
transform is most efficient when N is a product of
small primes.
INC Integer increment between the locations, in array C, of two
consecutive elements within the sequence to be transformed.
C Complex array of length LENC containing the sequence to be
transformed.
LENC Integer dimension of C array. LENC must be at least
INC*(N-1) + 1.</PRE>
<pre>
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT1I before
the first call to routine CFFT1F or CFFT1B for a given
transform length N. WSAVE's contents may be re-used for
subsequent calls to CFFT1F and CFFT1B with the same N.</pre>
<PRE>
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*N + INT(LOG(REAL(N))/LOG(2.)) + 4.
WORK Real work array of dimension LENWRK.
LENWRK Integer dimension of WORK array. LENWRK must be at
least 2*N.
Output Arguments
C For index J*INC+1 where J=0,...,N-1 (that is, for the Jth
element of the sequence),
C(J*INC+1) =
N-1
SUM C(K*INC+1)*EXP(-I*J*K*2*PI/N)
K=0
where I=SQRT(-1).
At other indices, the output value of C does not differ
from input.
IER = 0 successful exit
= 1 input parameter LENC not big enough
= 2 input parameter LENSAV not big enough
= 3 input parameter LENWRK not big enough
= 20 input error returned by lower level routine
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfft2i.html"><h2>CFFT2I - initialization routine for CFFT2B, CFFT2F</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT2I (L, M, WSAVE, LENSAV, IER)
INTEGER L, M, LENSAV, IER
REAL WSAVE(LENSAV)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFT2I initializes real array WSAVE for use
in its companion routines CFFT2F and CFFT2B for computing two-
dimensional fast Fourier transforms of complex data. Prime
factorizations of L and M, together with tabulations of the
trigonometric functions, are computed and stored in array WSAVE.
Input Arguments
L Integer number of elements to be transformed in the first
dimension. The transform is most efficient when L is a
product of small primes.
M Integer number of elements to be transformed in the second
dimension. The transform is most efficient when M is a
product of small primes.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
Output Arguments
WSAVE Real work array with dimension LENSAV, containing the
prime factors of L and M, and also containing certain
trigonometric values which will be used in routines
CFFT2B or CFFT2F.
WSAVE Real work array with dimension LENSAV. The WSAVE array
must be initialized with a call to subroutine CFFT2I before
the first call to CFFT2B or CFFT2F, and thereafter whenever
the values of L, M or the contents of array WSAVE change.
Using different WSAVE arrays for different transform lengths
or types in the same program may reduce computation costs
because the array contents can be re-used.
IER Integer error return
= 0 successful exit
= 2 input parameter LENSAV not big enough
= 20 input error returned by lower level routine
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfft2b.html"><h2>CFFT2B - complex, two-dimensional backward fast Fourier transform</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT2B (LDIM, L, M, C, WSAVE, LENSAV,
1 WORK, LENWRK, IER)
INTEGER L, M, LDIM, LENSAV, LENWRK, IER
COMPLEX C(LDIM,M)
REAL WSAVE(LENSAV), WORK(LENWRK)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFT2B computes the two-dimensional discrete
Fourier transform of a complex periodic array. This transform is
known as the backward transform or Fourier synthesis, transforming
from spectral to physical space.
Routine CFFT2B is normalized, in that a call to CFFT2B followed
by a call to CFFT2F (or vice-versa) reproduces the original array
subject to algorithm constraints, roundoff error, etc.
Input Arguments
LDIM Integer first dimension of two-dimensional complex array C.
</PRE>
<pre>
L Integer number of elements to be transformed in the first
dimension of the two-dimensional complex array C. The value
of L must be less than or equal to that of LDIM. The
transform is most efficient when L is a product of small
primes.
M Integer number of elements to be transformed in the second
dimension of the two-dimensional complex array C. The
transform is most efficient when M is a product of small
primes.
C Complex array of two dimensions containing the (L,M) subarray
to be transformed. C's first dimension is LDIM, its second
dimension must be at least M.
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT2I before
the first call to routine CFFT2F or CFFT2B with transform
lengths L and M. WSAVE's contents may be re-used for
subsequent calls to CFFT2F and CFFT2B with the same
transform lengths L and M.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
WORK Real work array.
LENWRK Integer dimension of WORK array. LENWRK must be at least
2*L*M.
Output Arguments
C Complex output array. For purposes of exposition,
assume the index ranges of array C are defined by
C(0:L-1,0:M-1).
For I=0,...,L-1 and J=0,...,M-1, the C(I,J)'s are given
in the traditional aliased form by
L-1 M-1
C(I,J) = SUM SUM C(L1,M1)*
L1=0 M1=0
EXP(SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
And in unaliased form, the C(I,J)'s are given by
LF MF
C(I,J) = SUM SUM C(L1,M1,K1)*
L1=LS M1=MS
EXP(SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
where
LS= -L/2 and LF=L/2-1 if L is even;
LS=-(L-1)/2 and LF=(L-1)/2 if L is odd;
MS= -M/2 and MF=M/2-1 if M is even;
MS=-(M-1)/2 and MF=(M-1)/2 if M is odd;
and
C(L1,M1) = C(L1+L,M1) if L1 is zero or negative;
C(L1,M1) = C(L1,M1+M) if M1 is zero or negative;
The two forms give different results when used to
interpolate between elements of the sequence.
IER Integer error return
= 0 successful exit
= 2 input parameter LENSAV not big enough
= 3 input parameter LENWRK not big enough
= 5 input parameter L > LDIM
= 20 input error returned by lower level routine
</pre>
<HR>
</BODY>
</HTML>
<a name="cfft2f.html"><h2>CFFT2F - complex, two-dimensional forward fast Fourier transform</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFT2F (LDIM, L, M, C, WSAVE, LENSAV,
1 WORK, LENWRK, IER)
INTEGER L, M, LDIM, LENSAV, LENWRK, IER
COMPLEX C(LDIM,M)
REAL WSAVE(LENSAV), WORK(LENWRK)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFT2F computes the two-dimensional discrete
Fourier transform of a complex periodic array. This transform is
known as the forward transform or Fourier analysis, transforming
from physical to spectral space.
Routine CFFT2F is normalized, in that a call to CFFT2F followed
by a call to CFFT2B (or vice-versa) reproduces the original array
subject to algorithm constraints, roundoff error, etc.
Input Arguments
LDIM Integer first dimension of two-dimensional complex array C.
L Integer number of elements to be transformed in the first
dimension of the two-dimensional complex array C. The value
of L must be less than or equal to that of LDIM. The
transform is most efficient when L is a product of small
primes.
M Integer number of elements to be transformed in the second
dimension of the two-dimensional complex array C. The
transform is most efficient when M is a product of small
primes.
C Complex array of two dimensions containing the (L,M) subarray
to be transformed. C's first dimension is LDIM, its second
dimension must be at least M.
</PRE>
<pre>
WSAVE Real work array with dimension LENSAV. WSAVE's contents
must be initialized with a call to subroutine CFFT2I before
the first call to routine CFFT2F or CFFT2B with transform
lengths L and M. WSAVE's contents may be re-used for
subsequent calls to CFFT2F and CFFT2B having those same
transform lengths.
</pre>
<PRE>
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*(L+M) + INT(LOG(REAL(L))/LOG(2.)) + INT(LOG(REAL(M))/LOG(2.)) + 8.
WORK Real work array.
LENWRK Integer dimension of WORK array. LENWRK must be at least
2*L*M.
Output Arguments
C Complex output array. For purposes of exposition,
assume the index ranges of array C are defined by
C(0:L-1,0:M-1).
For I=0,...,L-1 and J=0,...,M-1, the C(I,J)'s are given
in the traditional aliased form by
L-1 M-1
C(I,J) = 1/(L*M)*SUM SUM C(L1,M1)*
L1=0 M1=0
EXP(-SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
And in unaliased form, the C(I,J)'s are given by
LF MF
C(I,J) = 1/(L*M)*SUM SUM C(L1,M1)*
L1=LS M1=MS
EXP(-SQRT(-1)*2*PI*(I*L1/L + J*M1/M))
where
LS= -L/2 and LF=L/2-1 if L is even;
LS=-(L-1)/2 and LF=(L-1)/2 if L is odd;
MS= -M/2 and MF=M/2-1 if M is even;
MS=-(M-1)/2 and MF=(M-1)/2 if M is odd;
and
C(L1,M1) = C(L1+L,M1) if L1 is zero or negative;
C(L1,M1) = C(L1,M1+M) if M1 is zero or negative;
The two forms give different results when used to
interpolate between elements of the sequence.
IER Integer error return
= 0 successful exit
= 2 input parameter LENSAV not big enough
= 3 input parameter LENWRK not big enough
= 5 input parameter L > LDIM
= 20 input error returned by lower level routine
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfftmi.html"><h2>CFFTMI - initialization routine for CFFTMB and CFFTMF</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFTMI (N, WSAVE, LENSAV, IER)
INTEGER N, LENSAV, IER
REAL WSAVE(LENSAV)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 subroutine CFFTMI initializes array WSAVE for use in
its companion routines CFFTMB and CFFTMF. Routine CFFTMI must
be called before the first call to CFFTMB or CFFTMF, and after
whenever the value of integer N changes.
Input Arguments
N Integer length of each sequence to be transformed. The
transform is most efficient when N is a product of
small primes.
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*N + INT(LOG(REAL(N))/LOG(2.)) + 4.
Output Arguments
WSAVE Real work array with dimension LENSAV, containing the
prime factors of N and also containing certain trigonometric
values which will be used in routines CFFTMB or CFFTMF.
IER = 0 successful exit
= 2 input parameter LENSAV not big enough
</PRE>
<HR>
</BODY>
</HTML>
<a name="cfftmb.html"><h2>CFFTMB - complex, multiple backward fast Fourier transform</h2></a>
<PRE>
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C * *
C * copyright (c) 2011 by UCAR *
C * *
C * University Corporation for Atmospheric Research *
C * *
C * all rights reserved *
C * *
C * FFTPACK version 5.1 *
C * *
C * A Fortran Package of Fast Fourier *
C * *
C * Subroutines and Example Programs *
C * *
C * by *
C * *
C * Paul Swarztrauber and Dick Valent *
C * *
C * of *
C * *
C * the National Center for Atmospheric Research *
C * *
C * Boulder, Colorado (80307) U.S.A. *
C * *
C * which is sponsored by *
C * *
C * the National Science Foundation *
C * *
C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
</PRE>
<H3>SYNOPSIS</H3>
<PRE>
SUBROUTINE CFFTMB (LOT, JUMP, N, INC, C, LENC, WSAVE, LENSAV,
1 WORK, LENWRK, IER)
INTEGER LOT, JUMP, N, INC, LENC, LENSAV, LENWRK, IER
COMPLEX C(LENC)
REAL WSAVE(LENSAV), WORK(LENWRK)
</PRE>
<H3>DESCRIPTION</H3>
<PRE>
FFTPACK 5.1 routine CFFTMB computes the one-dimensional Fourier
transform of multiple periodic sequences within a complex array.
This transform is referred to as the backward transform or Fourier
synthesis, transforming the sequences from spectral to physical
space.
This transform is normalized since a call to CFFTMF followed
by a call to CFFTMB (or vice-versa) reproduces the original
array subject to algorithmic constraints, roundoff error, etc.
Input Arguments
LOT Integer number of sequences to be transformed within
array C.
JUMP Integer increment between the locations, in array C,
of the first elements of two consecutive sequences
to be transformed.
N Integer length of each sequence to be transformed. The
transform is most efficient when N is a product of
small primes.
INC Integer increment between the locations, in array C,
of two consecutive elements within the same sequence
to be transformed.
C Complex array containing LOT sequences, each having
length N, to be transformed. C can have any number
of dimensions, but the total number of locations must
be at least LENC.
LENC Integer dimension of C array. LENC must be at
least (LOT-1)*JUMP + INC*(N-1) + 1.
</PRE>
<pre>
WSAVE Real work array of length LENSAV. WSAVE's contents must
be initialized with a call to subroutine CFFTMI before the
first call to routine CFFTMF or CFFTMB for a given transform
length N.
</pre>
<PRE>
LENSAV Integer dimension of WSAVE array. LENSAV must be at least
2*N + INT(LOG(REAL(N))/LOG(2.)) + 4.
WORK Real work array of dimension LENWRK.
LENWRK Integer dimension of WORK array. LENWRK must be at
least 2*LOT*N.
Output Arguments
C For index L*JUMP+J*INC+1 where J=0,...,N-1 and
L=0,...,LOT-1, (that is, for the Jth element of the Lth
sequence),