Commit c240a96f authored by Raymond Toy's avatar Raymond Toy
Browse files

Import most fixes from FFTPACK51

Most if the fixes are due to computing the lengths (and indices) for
LENSAV.  Apparently the lengths should be log2(N) instead of log(N).

But the fix for c1fm1f.f fixes a genuine bug in the complex fft which
caused wrong results for non-power of 2 FFT sizes.

Also fixed a couple of typos and incorrect return ier codes.
parent f8319349
...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
IER = 0 IER = 0
C C
IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))) +4) THEN IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINQ1I', 3) CALL XERFFT ('SINQ1I', 3)
GO TO 300 GO TO 300
......
...@@ -19,7 +19,7 @@ C ...@@ -19,7 +19,7 @@ C
IF (LENX .LT. (LOT-1)*JUMP + INC*(N-1) + 1) THEN IF (LENX .LT. (LOT-1)*JUMP + INC*(N-1) + 1) THEN
IER = 1 IER = 1
CALL XERFFT ('SINQMB', 6) CALL XERFFT ('SINQMB', 6)
ELSEIF (LENSAV .LT. 2*N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINQMB', 8) CALL XERFFT ('SINQMB', 8)
ELSEIF (LENWRK .LT. LOT*N) THEN ELSEIF (LENWRK .LT. LOT*N) THEN
......
...@@ -20,7 +20,7 @@ C ...@@ -20,7 +20,7 @@ C
IER = 1 IER = 1
CALL XERFFT ('SINQMF', 6) CALL XERFFT ('SINQMF', 6)
GO TO 300 GO TO 300
ELSEIF (LENSAV .LT. 2*N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINQMF', 8) CALL XERFFT ('SINQMF', 8)
GO TO 300 GO TO 300
......
...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
IER = 0 IER = 0
C C
IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))) +4) THEN IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINQMI', 3) CALL XERFFT ('SINQMI', 3)
GO TO 300 GO TO 300
......
...@@ -19,7 +19,7 @@ C ...@@ -19,7 +19,7 @@ C
IER = 1 IER = 1
CALL XERFFT ('SINT1B', 6) CALL XERFFT ('SINT1B', 6)
GO TO 100 GO TO 100
ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINT1B', 8) CALL XERFFT ('SINT1B', 8)
GO TO 100 GO TO 100
......
...@@ -18,7 +18,7 @@ C ...@@ -18,7 +18,7 @@ C
IER = 1 IER = 1
CALL XERFFT ('SINT1F', 6) CALL XERFFT ('SINT1F', 6)
GO TO 100 GO TO 100
ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINT1F', 8) CALL XERFFT ('SINT1F', 8)
GO TO 100 GO TO 100
......
...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
IER = 0 IER = 0
C C
IF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN IF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINT1I', 3) CALL XERFFT ('SINT1I', 3)
GO TO 300 GO TO 300
...@@ -28,7 +28,7 @@ C ...@@ -28,7 +28,7 @@ C
DO 101 K=1,NS2 DO 101 K=1,NS2
WSAVE(K) = 2.*SIN(K*DT) WSAVE(K) = 2.*SIN(K*DT)
101 CONTINUE 101 CONTINUE
LNSV = NP1 + INT(LOG(REAL(NP1))) +4 LNSV = NP1 + INT(LOG(REAL(NP1))/LOG(2.)) +4
CALL RFFT1I (NP1, WSAVE(NS2+1), LNSV, IER1) CALL RFFT1I (NP1, WSAVE(NS2+1), LNSV, IER1)
IF (IER1 .NE. 0) THEN IF (IER1 .NE. 0) THEN
IER = 20 IER = 20
......
...@@ -32,7 +32,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -32,7 +32,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
XH(NS2+2) = 4.*X(1,NS2+1) XH(NS2+2) = 4.*X(1,NS2+1)
124 XH(1) = 0. 124 XH(1) = 0.
LNXH = NP1 LNXH = NP1
LNSV = NP1 + INT(LOG(REAL(NP1))) + 4 LNSV = NP1 + INT(LOG(REAL(NP1))/LOG(2.)) + 4
LNWK = NP1 LNWK = NP1
C C
CALL RFFT1F(NP1,1,XH,LNXH,WSAVE(NS2+1),LNSV,WORK,LNWK,IER1) CALL RFFT1F(NP1,1,XH,LNXH,WSAVE(NS2+1),LNSV,WORK,LNWK,IER1)
......
...@@ -32,7 +32,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -32,7 +32,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
XH(NS2+2) = 4.*X(1,NS2+1) XH(NS2+2) = 4.*X(1,NS2+1)
124 XH(1) = 0. 124 XH(1) = 0.
LNXH = NP1 LNXH = NP1
LNSV = NP1 + INT(LOG(REAL(NP1))) + 4 LNSV = NP1 + INT(LOG(REAL(NP1))/LOG(2.)) + 4
LNWK = NP1 LNWK = NP1
C C
CALL RFFT1F(NP1,1,XH,LNXH,WSAVE(NS2+1),LNSV,WORK, CALL RFFT1F(NP1,1,XH,LNXH,WSAVE(NS2+1),LNSV,WORK,
......
...@@ -20,7 +20,7 @@ C ...@@ -20,7 +20,7 @@ C
IER = 1 IER = 1
CALL XERFFT ('SINTMB', 6) CALL XERFFT ('SINTMB', 6)
GO TO 100 GO TO 100
ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINTMB', 8) CALL XERFFT ('SINTMB', 8)
GO TO 100 GO TO 100
......
...@@ -20,7 +20,7 @@ C ...@@ -20,7 +20,7 @@ C
IER = 1 IER = 1
CALL XERFFT ('SINTMF', 6) CALL XERFFT ('SINTMF', 6)
GO TO 100 GO TO 100
ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN ELSEIF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINTMF', 8) CALL XERFFT ('SINTMF', 8)
GO TO 100 GO TO 100
......
...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ...@@ -14,7 +14,7 @@ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
IER = 0 IER = 0
C C
IF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))) +4) THEN IF (LENSAV .LT. N/2 + N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN
IER = 2 IER = 2
CALL XERFFT ('SINTMI', 3) CALL XERFFT ('SINTMI', 3)
GO TO 300 GO TO 300
...@@ -28,7 +28,7 @@ C ...@@ -28,7 +28,7 @@ C
DO 101 K=1,NS2 DO 101 K=1,NS2
WSAVE(K) = 2.*SIN(K*DT) WSAVE(K) = 2.*SIN(K*DT)
101 CONTINUE 101 CONTINUE
LNSV = NP1 + INT(LOG(REAL(NP1))) +4 LNSV = NP1 + INT(LOG(REAL(NP1))/LOG(2.)) +4
CALL RFFTMI (NP1, WSAVE(NS2+1), LNSV, IER1) CALL RFFTMI (NP1, WSAVE(NS2+1), LNSV, IER1)
IF (IER1 .NE. 0) THEN IF (IER1 .NE. 0) THEN
IER = 20 IER = 20
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment