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

85 lines
2.9 KiB
Fortran

*DECK RADB3
SUBROUTINE RADB3 (IDO, L1, CC, CH, WA1, WA2)
C***BEGIN PROLOGUE RADB3
C***SUBSIDIARY
C***PURPOSE Calculate the fast Fourier transform of subvectors of
C length three.
C***LIBRARY SLATEC (FFTPACK)
C***TYPE SINGLE PRECISION (RADB3-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 variable TAUI by using
C FORTRAN intrinsic function SQRT instead of a DATA
C statement.
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 RADB3
DIMENSION CC(IDO,3,*), CH(IDO,L1,3), WA1(*), WA2(*)
C***FIRST EXECUTABLE STATEMENT RADB3
TAUR = -.5
TAUI = .5*SQRT(3.)
DO 101 K=1,L1
TR2 = CC(IDO,2,K)+CC(IDO,2,K)
CR2 = CC(1,1,K)+TAUR*TR2
CH(1,K,1) = CC(1,1,K)+TR2
CI3 = TAUI*(CC(1,3,K)+CC(1,3,K))
CH(1,K,2) = CR2-CI3
CH(1,K,3) = CR2+CI3
101 CONTINUE
IF (IDO .EQ. 1) RETURN
IDP2 = IDO+2
IF((IDO-1)/2.LT.L1) GO TO 104
DO 103 K=1,L1
CDIR$ IVDEP
DO 102 I=3,IDO,2
IC = IDP2-I
TR2 = CC(I-1,3,K)+CC(IC-1,2,K)
CR2 = CC(I-1,1,K)+TAUR*TR2
CH(I-1,K,1) = CC(I-1,1,K)+TR2
TI2 = CC(I,3,K)-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