Skip to content

Commit c4d30e6

Browse files
committed
Minor modification in test_fftpack_xxx.f90.
1 parent 453601d commit c4d30e6

10 files changed

+41
-45
lines changed

test/test_fftpack_dcosq.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ subroutine test_fftpack_dcosq_real
1616
use iso_fortran_env, only: dp => real64
1717
real(kind=dp) :: w(3*4 + 15)
1818
real(kind=dp) :: x(4) = [1, 2, 3, 4]
19+
real(kind=dp) :: eps = 1.0e-10_dp
1920

2021
call dcosqi(4, w)
2122
call dcosqf(4, x, w)
2223
call check(sum(abs(x - [11.999626276085150_dp, -9.1029432177492193_dp, &
23-
2.6176618435106480_dp, -1.5143449018465791_dp])) < 1.0e-3, msg="`dcosqf` failed.")
24+
2.6176618435106480_dp, -1.5143449018465791_dp])) < eps, msg="`dcosqf` failed.")
2425
call dcosqb(4, x, w) !!
25-
call check(sum(abs(x/(4.0_dp*4.0_dp) - [real(kind=dp) :: 1, 2, 3, 4])) < 1.0e-3, msg="`dcosqb` failed.")
26+
call check(sum(abs(x/(4.0_dp*4.0_dp) - [real(kind=dp) :: 1, 2, 3, 4])) < eps, msg="`dcosqb` failed.")
2627

2728
end subroutine test_fftpack_dcosq_real
2829

test/test_fftpack_dfft.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ subroutine test_fftpack_dfft()
2323
call dffti(4, w)
2424
call dfftf(4, x, w)
2525
call check(all(x == [real(kind=dp) :: 10, -2, 2, -2]), &
26-
msg="all(x == [real(kind=dp) :: 10, -2, 2, -2]) failed.")
26+
msg="`dfftf` failed.")
2727

2828
call dfftb(4, x, w)
2929
call check(all(x/4.0_dp == [real(kind=dp) :: 1, 2, 3, 4]), &
30-
msg="all(x/4.0_dp == [real(kind=dp) :: 1, 2, 3, 4]) failed.")
30+
msg="`dfftb` failed.")
3131

3232
end subroutine test_fftpack_dfft
3333

test/test_fftpack_dzfft.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ subroutine test_fftpack_dzfft
2222
call dzffti(4, w)
2323
call dzfftf(4, x, azero, a, b, w)
2424
call check(azero == 2.5_dp, msg="azero == 2.5_dp failed.")
25-
call check(all(a == [real(kind=dp) :: -1.0, -0.5]), msg="all(a == [real(kind=dp) :: -1.0, -0.5]) failed.")
26-
call check(all(b == [real(kind=dp) :: -1.0, 0.0]), msg="all(b == [real(kind=dp) :: -1.0, 0.0]) failed.")
27-
25+
call check(all(a == [-1.0_dp, -0.5_dp]), msg="all(a == [-1.0, -0.5]) failed.")
26+
call check(all(b == [-1.0_dp, 0.0_dp]), msg="all(b == [-1.0, 0.0]) failed.")
27+
2828
x = 0
2929
call dzfftb(4, x, azero, a, b, w)
3030
call check(all(x == [real(kind=dp) :: 1, 2, 3, 4]), msg="all(x = [real(kind=dp) :: 1, 2, 3, 4]) failed.")

test/test_fftpack_fft.f90

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ end subroutine check
1414
subroutine test_fftpack_fft
1515
use fftpack, only: fft
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
17+
real(kind=dp) :: eps = 1.0e-10_dp
1818

19-
complex(kind=dp) :: x(3)
19+
complex(kind=dp) :: x(3) = [1.0_dp, 2.0_dp, 3.0_dp]
2020

21-
x = [real(kind=dp) :: 1.0, 2.0, 3.0]
22-
23-
call check(sum(abs(fft(x, 2) - [complex(kind=dp) ::(3.0, 0.0), (-1.0, 0.0)])) < eps, &
24-
msg="sum(abs(fft(x,2) - [complex(kind=dp) ::(3.0, 0.0), (-1.0, 0.0)])) < eps failed.")
21+
call check(sum(abs(fft(x, 2) - [(3.0_dp, 0.0_dp), (-1.0_dp, 0.0_dp)])) < eps, &
22+
msg="`fft(x, 2)` failed.")
2523
call check(sum(abs(fft(x, 3) - fft(x))) < eps, &
26-
msg="sum(abs(fft(x,3) - fft(3))) < eps failed.")
27-
call check(sum(abs(fft(x, 4) - [complex(kind=dp) ::(6.0, 0.0), (-2.0, -2.0), (2.0, 0.0), (-2.0, 2.0)])) < eps, &
28-
msg="sum(abs(fft(x,4) - [complex(kind=dp) ::(6.0, 0.0), (-2.0, -2.0), (2.0,0.0), (-2.0,2.0)])) < eps failed.")
24+
msg="`fft(x, 3)` failed.")
25+
call check(sum(abs(fft(x, 4) - [(6.0_dp, 0.0_dp), (-2.0_dp, -2.0_dp), (2.0_dp, 0.0_dp), (-2.0_dp, 2.0_dp)])) < eps, &
26+
msg="`fft(x, 4)` failed.")
2927

3028
end subroutine test_fftpack_fft
3129

test/test_fftpack_ifft.f90

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ end subroutine check
1414
subroutine test_fftpack_ifft
1515
use fftpack, only: fft, ifft
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
18-
19-
complex(kind=dp) :: x(4)
20-
21-
x = [real(kind=dp) :: 1.0, 2.0, 3.0, 4.0]
22-
23-
call check(sum(abs(ifft(fft(x))/4.0 - [complex(kind=dp) ::(1.0, 0.0), (2.0, 0.0), (3.0, 0.0), (4.0, 0.0)])) < eps, &
24-
msg="abs(sum(ifft(fft(x))/4.0 - [complex(kind=dp) ::(1.0, 0.0), (2.0, 0.0), (3.0, 0.0), (4.0, 0.0)])) < eps failed.")
25-
call check(sum(abs(ifft(fft(x),2) - [complex(kind=dp) ::(8.0, 2.0), (12.0, -2.0)])) < eps, &
26-
msg="abs(sum(ifft(fft(x),2) - [complex(kind=dp) ::(8.0, 2.0), (12.0, -2.0)])) < eps failed.")
27-
call check(sum(abs(ifft(fft(x,2),4) - [complex(kind=dp) ::(2.0, 0.0), (3.0, -1.0), (4.0,0.0), (3.0,1.0)])) < eps, &
28-
msg="abs(sum(ifft(fft(x,2),4) - [complex(kind=dp) ::(2.0, 0.0), (3.0, -1.0), (4.0,0.0), (3.0,1.0)])) < eps failed.")
17+
real(kind=dp) :: eps = 1.0e-10_dp
18+
19+
complex(kind=dp) :: x(4) = [1, 2, 3, 4]
20+
21+
call check(sum(abs(ifft(fft(x))/4.0_dp - [complex(kind=dp) :: 1, 2, 3, 4])) < eps, &
22+
msg="`ifft(fft(x))/4.0_dp` failed.")
23+
call check(sum(abs(ifft(fft(x), 2) - [complex(kind=dp) ::(8, 2), (12, -2)])) < eps, &
24+
msg="`ifft(fft(x), 2)` failed.")
25+
call check(sum(abs(ifft(fft(x, 2), 4) - [complex(kind=dp) ::(2, 0), (3, -1), (4, 0), (3, 1)])) < eps, &
26+
msg="`ifft(fft(x, 2), 4)` failed.")
2927

3028
end subroutine test_fftpack_ifft
3129

test/test_fftpack_iqct.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end subroutine check
1414
subroutine test_fftpack_iqct
1515
use fftpack, only: qct, iqct
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
17+
real(kind=dp) :: eps = 1.0e-10_dp
1818

1919
real(kind=dp) :: x(4) = [1, 2, 3, 4]
2020

test/test_fftpack_irfft.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ end subroutine check
1414
subroutine test_fftpack_irfft
1515
use fftpack, only: rfft, irfft
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
17+
real(kind=dp) :: eps = 1.0e-10_dp
1818

1919
real(kind=dp) :: x(4) = [1, 2, 3, 4]
2020

21-
call check(sum(abs(irfft(rfft(x))/4.0 - [real(kind=dp) :: 1, 2, 3, 4])) < eps, &
22-
msg="sum(abs(irfft(rfft(x))/4.0 - [real(kind=dp) :: 1, 2, 3, 4])) < eps failed.")
21+
call check(sum(abs(irfft(rfft(x))/4.0_dp - [real(kind=dp) :: 1, 2, 3, 4])) < eps, &
22+
msg="`irfft(rfft(x))/4.0_dp` failed.")
2323
call check(sum(abs(irfft(rfft(x), 2) - [real(kind=dp) :: 8, 12])) < eps, &
24-
msg="sum(abs(irfft(rfft(x), 2) - [real(kind=dp) :: 8, 12])) < eps failed.")
24+
msg="`irfft(rfft(x), 2)` failed.")
2525
call check(sum(abs(irfft(rfft(x, 2), 4) - [real(kind=dp) :: 1, 3, 5, 3])) < eps, &
26-
msg="sum(abs(irfft(rfft(x, 2), 4) - [real(kind=dp) :: 1, 3, 5, 3])) failed.")
26+
msg="`irfft(rfft(x, 2), 4)` failed.")
2727

2828
end subroutine test_fftpack_irfft
2929

test/test_fftpack_qct.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end subroutine check
1414
subroutine test_fftpack_qct
1515
use fftpack, only: qct
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
17+
real(kind=dp) :: eps = 1.0e-10_dp
1818

1919
real(kind=dp) :: x(3) = [9, -9, 3]
2020

test/test_fftpack_rfft.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ end subroutine check
1414
subroutine test_fftpack_rfft
1515
use fftpack, only: rfft
1616
use iso_fortran_env, only: dp => real64
17-
real(kind=dp) :: eps = 1.0e-10
17+
real(kind=dp) :: eps = 1.0e-10_dp
1818

1919
real(kind=dp) :: x(3) = [9, -9, 3]
2020

2121
call check(sum(abs(rfft(x, 2) - [real(kind=dp) :: 0, 18])) < eps, &
22-
msg="sum(abs(rfft(x,2) - [real(kind=dp) :: 0, 18])) < eps failed.")
22+
msg="`rfft(x, 2)` failed.")
2323
call check(sum(abs(rfft(x, 3) - rfft(x))) < eps, &
24-
msg="sum(abs(rfft(x,3) - rfft(3))) < eps failed.")
24+
msg="`rfft(x, 3)` failed.")
2525
call check(sum(abs(rfft(x, 4) - [real(kind=dp) :: 3, 6, 9, 21])) < eps, &
26-
msg="sum(abs(rfft(x,4) - [real(kind=dp) ::3, 6, 9, 21])) < eps failed.")
26+
msg="`rfft(x, 4)` failed.")
2727

2828
end subroutine test_fftpack_rfft
2929

test/test_fftpack_zfft.f90

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ subroutine test_fftpack_zfft()
1515
use fftpack, only: zffti, zfftf, zfftb
1616
use iso_fortran_env, only: dp => real64
1717

18-
complex(kind=dp) :: x(4)
18+
complex(kind=dp) :: x(4) = [1, 2, 3, 4]
1919
real(kind=dp) :: w(31)
2020

21-
x = [real(kind=dp) :: 1.0, 2.0, 3.0, 4.0]
2221
call zffti(4, w)
2322
call zfftf(4, x, w)
24-
call check(all(x == [complex(kind=dp) ::(10.0, 0.0), (-2.0, 2.0), (-2.0, 0.0), (-2.0, -2.0)]), &
25-
msg="all(x==[complex(kind=dp) :: (10.0,0.0), (-2.0,2.0), (-2.0,0.0), (-2.0,-2.0)]) failed.")
23+
call check(all(x == [complex(kind=dp) ::(10, 0), (-2, 2), (-2, 0), (-2, -2)]), &
24+
msg="`zfftf` failed.")
2625

2726
call zfftb(4, x, w)
28-
call check(all(x/4.0_dp == [complex(kind=dp) ::(1.0, 0.0), (2.0, 0.0), (3.0, 0.0), (4.0, 0.0)]), &
29-
msg="all(x/4==[complex(kind=dp) :: (1.0,0.0), (2.0,0.0), (3.0,0.0), (4.0,0.0)]) failed.")
27+
call check(all(x/4.0_dp == [complex(kind=dp) ::(1, 0), (2, 0), (3, 0), (4, 0)]), &
28+
msg="`zfftb` failed.")
3029

3130
end subroutine test_fftpack_zfft
3231

0 commit comments

Comments
 (0)