Skip to content

Commit 55c42ac

Browse files
changing to 128/256 bit to c/longdouble (#552)
1 parent cc52ae8 commit 55c42ac

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

pytests/test_ffts.py

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_unknown_engine(par):
162162
(np.float16, 1),
163163
(np.float32, 4),
164164
(np.float64, 11),
165-
(np.float128, 11),
165+
(np.longdouble, 11),
166166
],
167167
norm=["ortho", "none", "1/n"],
168168
ifftshift_before=[False, True],
@@ -234,7 +234,7 @@ def test_FFT_small_real(par):
234234
(np.float16, 1),
235235
(np.float32, 3),
236236
(np.float64, 11),
237-
(np.float128, 11),
237+
(np.longdouble, 11),
238238
],
239239
ifftshift_before=[False, True],
240240
engine=["numpy", "fftw", "scipy"],
@@ -280,7 +280,7 @@ def test_FFT_random_real(par):
280280

281281

282282
par_lists_fft_small_cpx = dict(
283-
dtype_precision=[(np.complex64, 4), (np.complex128, 11), (np.complex256, 11)],
283+
dtype_precision=[(np.complex64, 4), (np.complex128, 11), (np.clongdouble, 11)],
284284
norm=["ortho", "none", "1/n"],
285285
ifftshift_before=[False, True],
286286
fftshift_after=[False, True],
@@ -344,10 +344,10 @@ def test_FFT_small_complex(par):
344344
(np.float16, 1),
345345
(np.float32, 3),
346346
(np.float64, 11),
347-
(np.float128, 11),
347+
(np.longdouble, 11),
348348
(np.complex64, 3),
349349
(np.complex128, 11),
350-
(np.complex256, 11),
350+
(np.clongdouble, 11),
351351
],
352352
ifftshift_before=[False, True],
353353
fftshift_after=[False, True],
@@ -426,7 +426,7 @@ def test_FFT_random_complex(par):
426426
(np.float16, 1),
427427
(np.float32, 3),
428428
(np.float64, 11),
429-
(np.float128, 11),
429+
(np.longdouble, 11),
430430
],
431431
ifftshift_before=[False, True],
432432
engine=["numpy", "scipy"],
@@ -484,10 +484,10 @@ def test_FFT2D_random_real(par):
484484
(np.float16, 1),
485485
(np.float32, 3),
486486
(np.float64, 11),
487-
(np.float128, 11),
487+
(np.longdouble, 11),
488488
(np.complex64, 3),
489489
(np.complex128, 11),
490-
(np.complex256, 11),
490+
(np.clongdouble, 11),
491491
],
492492
ifftshift_before=itertools.product([False, True], [False, True]),
493493
fftshift_after=itertools.product([False, True], [False, True]),
@@ -566,7 +566,7 @@ def test_FFT2D_random_complex(par):
566566
(np.float16, 1),
567567
(np.float32, 3),
568568
(np.float64, 11),
569-
(np.float128, 11),
569+
(np.longdouble, 11),
570570
],
571571
engine=["numpy", "scipy"],
572572
)
@@ -625,10 +625,10 @@ def test_FFTND_random_real(par):
625625
(np.float16, 1),
626626
(np.float32, 3),
627627
(np.float64, 11),
628-
(np.float128, 11),
628+
(np.longdouble, 11),
629629
(np.complex64, 3),
630630
(np.complex128, 11),
631-
(np.complex256, 11),
631+
(np.clongdouble, 11),
632632
],
633633
engine=["numpy", "scipy"],
634634
)
@@ -700,7 +700,7 @@ def test_FFTND_random_complex(par):
700700

701701

702702
par_lists_fft2dnd_small_cpx = dict(
703-
dtype_precision=[(np.complex64, 5), (np.complex128, 11), (np.complex256, 11)],
703+
dtype_precision=[(np.complex64, 5), (np.complex128, 11), (np.clongdouble, 11)],
704704
norm=["ortho", "none", "1/n"],
705705
engine=["numpy", "scipy"],
706706
)
@@ -874,7 +874,15 @@ def test_FFT_1dsignal(par):
874874
assert_array_almost_equal(y_fftshift, np.fft.fftshift(y))
875875

876876
xadj = FFTop_fftshift.H * y_fftshift # adjoint is same as inverse for fft
877-
xinv = lsqr(FFTop_fftshift, y_fftshift, damp=1e-10, iter_lim=10, atol=1e-8, btol=1e-8, show=0)[0]
877+
xinv = lsqr(
878+
FFTop_fftshift,
879+
y_fftshift,
880+
damp=1e-10,
881+
iter_lim=10,
882+
atol=1e-8,
883+
btol=1e-8,
884+
show=0,
885+
)[0]
878886
assert_array_almost_equal(x[:imax], xadj[:imax], decimal=decimal)
879887
assert_array_almost_equal(x[:imax], xinv[:imax], decimal=decimal)
880888

@@ -958,7 +966,15 @@ def test_FFT_2dsignal(par):
958966
assert_array_almost_equal(D_fftshift, D2)
959967

960968
dadj = FFTop_fftshift.H * D_fftshift # adjoint is same as inverse for fft
961-
dinv = lsqr(FFTop_fftshift, D_fftshift, damp=1e-10, iter_lim=10, atol=1e-8, btol=1e-8, show=0)[0]
969+
dinv = lsqr(
970+
FFTop_fftshift,
971+
D_fftshift,
972+
damp=1e-10,
973+
iter_lim=10,
974+
atol=1e-8,
975+
btol=1e-8,
976+
show=0,
977+
)[0]
962978

963979
dadj = np.real(dadj.reshape(nt, nx))
964980
dinv = np.real(dinv.reshape(nt, nx))
@@ -1016,7 +1032,15 @@ def test_FFT_2dsignal(par):
10161032
assert_array_almost_equal(D_fftshift, D2)
10171033

10181034
dadj = FFTop_fftshift.H * D_fftshift # adjoint is same as inverse for fft
1019-
dinv = lsqr(FFTop_fftshift, D_fftshift, damp=1e-10, iter_lim=10, atol=1e-8, btol=1e-8, show=0)[0]
1035+
dinv = lsqr(
1036+
FFTop_fftshift,
1037+
D_fftshift,
1038+
damp=1e-10,
1039+
iter_lim=10,
1040+
atol=1e-8,
1041+
btol=1e-8,
1042+
show=0,
1043+
)[0]
10201044

10211045
dadj = np.real(dadj.reshape(nt, nx))
10221046
dinv = np.real(dinv.reshape(nt, nx))
@@ -1193,7 +1217,15 @@ def test_FFT_3dsignal(par):
11931217
assert_array_almost_equal(D_fftshift, D2)
11941218

11951219
dadj = FFTop_fftshift.H * D_fftshift # adjoint is same as inverse for fft
1196-
dinv = lsqr(FFTop_fftshift, D_fftshift, damp=1e-10, iter_lim=10, atol=1e-8, btol=1e-8, show=0)[0]
1220+
dinv = lsqr(
1221+
FFTop_fftshift,
1222+
D_fftshift,
1223+
damp=1e-10,
1224+
iter_lim=10,
1225+
atol=1e-8,
1226+
btol=1e-8,
1227+
show=0,
1228+
)[0]
11971229

11981230
dadj = np.real(dadj.reshape(nt, nx, ny))
11991231
dinv = np.real(dinv.reshape(nt, nx, ny))

0 commit comments

Comments
 (0)