rfft1f
C RFFT1F SOURCE BP208322 18/10/08 21:15:18 9952 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC C C FFTPACK 5.1 C C Authors: Paul N. Swarztrauber and Richard A. Valent C c FFTPACK 5.1 routine RFFT1F computes the one-dimensional Fourier c transform of a periodic sequence within a real array. This c is referred to as the forward transform or Fourier analysis, c transforming the sequence from physical to spectral space. c c c This transform is normalized since a call to RFFT1F followed c by a call to RFFT1B (or vice-versa) reproduces the original c array subject to algorithmic constraints, roundoff error, etc. c c Input Arguments c c N Integer length of the sequence to be transformed. The c transform is most efficient when N is a product of c small primes. c c INC Integer increment between the locations, in array R, c of two consecutive elements within the sequence. c c R Real array of length LENR containing the sequence to be c transformed. c c LENR Integer dimension of R array. LENR must be at least c INC*(N-1) + 1. c c WSAVE Real work array of length LENSAV. WSAVE's contents must c be initialized with a call to subroutine RFFT1I before the c first call to routine RFFT1F or RFFT1B for a given transform c length N. c c c LENSAV Integer dimension of WSAVE array. LENSAV must be at least c N + INT(LOG (REAL(N))/LOG(2.)) +4. c c c WORK Real work array of dimension LENWRK. c c LENWRK Integer dimension of WORK array. LENWRK must be at N. c c c Output Arguments c c R Real output array R. For purposes of exposition, c assume R's range of indices is given by c R(0:(N-1)*INC). c c Then c c N-1 c R(0) = SUM R(N1*INC)/N c N1=0 c c If N is even, set NH=N/2-1; if N is odd set NH=(N-1)/2; c then for J=1,...,NH c c R((2*J-1)*INC) = c c N-1 c 2.*SUM (R(N1*INC)*COS(J*N1*2*PI/N)/N c N1=0 c c and c c R(2*J*INC) = c c N-1 c 2.*SUM (R(N1*INC)*SIN(J*N1*2*PI/N)/N c N1=0 c c Also if N is even then c c R((N-1)*INC) = c c N-1 c SUM (-1)**N1*R(N1*INC)/N c N1=0 c c c IER Integer error return c = 0 successful exit c = 1 input parameter LENR not big enough c = 2 input parameter LENSAV not big enough c = 3 input parameter LENWRK not big enough c c CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC IMPLICIT INTEGER(I-N) IMPLICIT REAL*8(A-H,O-Z) INTEGER N, INC, LENR, LENSAV, LENWRK, IER C IER = 0 C IF (LENR .LT. INC*(N-1) + 1) THEN IER = 1 c CALL XERFFT ('RFFT1F ', 6) return ELSEIF (LENSAV .LT. N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN IER = 2 c CALL XERFFT ('RFFT1F ', 8) return ELSEIF (LENWRK .LT. N) THEN IER = 3 c CALL XERFFT ('RFFT1F ', 10) return ENDIF C IF (N .EQ. 1) RETURN C RETURN END
© Cast3M 2003 - Tous droits réservés.
Mentions légales