OpenLibm/slatec/passb5.f
Viral B. Shah c977aa998f Add Makefile.extras to build libopenlibm-extras.
Replace amos with slatec
2012-12-31 16:37:05 -05:00

143 lines
5.1 KiB
Fortran

*DECK PASSB5
SUBROUTINE PASSB5 (IDO, L1, CC, CH, WA1, WA2, WA3, WA4)
C***BEGIN PROLOGUE PASSB5
C***SUBSIDIARY
C***PURPOSE Calculate the fast Fourier transform of subvectors of
C length five.
C***LIBRARY SLATEC (FFTPACK)
C***TYPE SINGLE PRECISION (PASSB5-S)
C***AUTHOR Swarztrauber, P. N., (NCAR)
C***ROUTINES CALLED (NONE)
C***REVISION HISTORY (YYMMDD)
C 790601 DATE WRITTEN
C 830401 Modified to use SLATEC library source file format.
C 860115 Modified by Ron Boisvert to adhere to Fortran 77 by
C (a) changing dummy array size declarations (1) to (*),
C (b) changing definition of variables PI, TI11, TI12,
C TR11, TR12 by using FORTRAN intrinsic functions ATAN
C and SIN instead of DATA statements.
C 881128 Modified by Dick Valent to meet prologue standards.
C 890831 Modified array declarations. (WRB)
C 891214 Prologue converted to Version 4.0 format. (BAB)
C 900402 Added TYPE section. (WRB)
C***END PROLOGUE PASSB5
DIMENSION CC(IDO,5,*), CH(IDO,L1,5), WA1(*), WA2(*), WA3(*),
+ WA4(*)
C***FIRST EXECUTABLE STATEMENT PASSB5
PI = 4.*ATAN(1.)
TR11 = SIN(.1*PI)
TI11 = SIN(.4*PI)
TR12 = -SIN(.3*PI)
TI12 = SIN(.2*PI)
IF (IDO .NE. 2) GO TO 102
DO 101 K=1,L1
TI5 = CC(2,2,K)-CC(2,5,K)
TI2 = CC(2,2,K)+CC(2,5,K)
TI4 = CC(2,3,K)-CC(2,4,K)
TI3 = CC(2,3,K)+CC(2,4,K)
TR5 = CC(1,2,K)-CC(1,5,K)
TR2 = CC(1,2,K)+CC(1,5,K)
TR4 = CC(1,3,K)-CC(1,4,K)
TR3 = CC(1,3,K)+CC(1,4,K)
CH(1,K,1) = CC(1,1,K)+TR2+TR3
CH(2,K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