Skip to content

Commit 0c6f3f3

Browse files
Added test for issue 64
1 parent d9c25a5 commit 0c6f3f3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

mkl_fft/tests/test_fftnd.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def test_matrix5(self):
113113
mkl_fft.fftn(y[i0, :, : , i3]),
114114
rtol=r_tol, atol=a_tol
115115
)
116-
117-
116+
117+
118118

119119

120120
class Test_Regressions(TestCase):
@@ -147,6 +147,16 @@ def test_rfftn_numpy(self):
147147
tr_rfft = np.transpose(mkl_fft.rfftn_numpy(x, axes=a), a)
148148
assert_allclose(rfft_tr, tr_rfft, rtol=r_tol, atol=a_tol)
149149

150+
def test_gh64(self):
151+
"""Test example from #64"""
152+
a = np.arange(12).reshape((3,4))
153+
x = a.astype(np.cdouble)
154+
# should executed successfully
155+
r1 = mkl_fft.fftn(a, shape=None, axes=(-2,-1))
156+
r2 = mkl_fft.fftn(x)
157+
r_tol, a_tol = _get_rtol_atol(x)
158+
assert_allclose(r1, r2, rtol=r_tol, atol=a_tol)
159+
150160

151161
class Test_Scales(TestCase):
152162
def setUp(self):
@@ -185,7 +195,7 @@ def test_scale_nd(self):
185195
X.flat[:] = np.cbrt(np.arange(0, X.size, dtype=X.dtype))
186196
f = mkl_fft.fftn(X)
187197
f_scale = mkl_fft.fftn(X, forward_scale=0.2)
188-
198+
189199
r_tol, a_tol = _get_rtol_atol(X)
190200
assert_allclose(f, 5*f_scale, rtol=r_tol, atol=a_tol)
191201

@@ -194,7 +204,6 @@ def test_scale_nd_axes(self):
194204
X.flat[:] = np.cbrt(np.arange(X.size, dtype=X.dtype))
195205
f = mkl_fft.fftn(X, axes=(0, 1, 2, 3))
196206
f_scale = mkl_fft.fftn(X, axes=(0, 1, 2, 3), forward_scale=0.2)
197-
207+
198208
r_tol, a_tol = _get_rtol_atol(X)
199209
assert_allclose(f, 5*f_scale, rtol=r_tol, atol=a_tol)
200-

0 commit comments

Comments
 (0)