Skip to content

Commit 2be4c03

Browse files
committed
update a test + keep functionin alphabetic order
1 parent e2ea79d commit 2be4c03

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

dpnp/fft/dpnp_utils_fft.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -72,37 +72,6 @@ def _check_norm(norm):
7272
)
7373

7474

75-
# TODO: c2r keyword is place holder for irfftn
76-
def _cook_nd_args(a, s=None, axes=None, c2r=False):
77-
if s is None:
78-
shapeless = True
79-
if axes is None:
80-
s = list(a.shape)
81-
else:
82-
s = numpy.take(a.shape, axes)
83-
else:
84-
shapeless = False
85-
86-
for s_i in s:
87-
if s_i is not None and s_i < 1 and s_i != -1:
88-
raise ValueError(
89-
f"Invalid number of FFT data points ({s_i}) specified."
90-
)
91-
92-
if axes is None:
93-
axes = list(range(-len(s), 0))
94-
95-
if len(s) != len(axes):
96-
raise ValueError("Shape and axes have different lengths.")
97-
98-
s = list(s)
99-
if c2r and shapeless:
100-
s[-1] = (a.shape[axes[-1]] - 1) * 2
101-
# use the whole input array along axis `i` if `s[i] == -1`
102-
s = [a.shape[_a] if _s == -1 else _s for _s, _a in zip(s, axes)]
103-
return s, axes
104-
105-
10675
def _commit_descriptor(a, in_place, c2c, a_strides, index, axes):
10776
"""Commit the FFT descriptor for the input array."""
10877

@@ -197,6 +166,37 @@ def _compute_result(dsc, a, out, forward, c2c, a_strides):
197166
return result
198167

199168

169+
# TODO: c2r keyword is place holder for irfftn
170+
def _cook_nd_args(a, s=None, axes=None, c2r=False):
171+
if s is None:
172+
shapeless = True
173+
if axes is None:
174+
s = list(a.shape)
175+
else:
176+
s = numpy.take(a.shape, axes)
177+
else:
178+
shapeless = False
179+
180+
for s_i in s:
181+
if s_i is not None and s_i < 1 and s_i != -1:
182+
raise ValueError(
183+
f"Invalid number of FFT data points ({s_i}) specified."
184+
)
185+
186+
if axes is None:
187+
axes = list(range(-len(s), 0))
188+
189+
if len(s) != len(axes):
190+
raise ValueError("Shape and axes have different lengths.")
191+
192+
s = list(s)
193+
if c2r and shapeless:
194+
s[-1] = (a.shape[axes[-1]] - 1) * 2
195+
# use the whole input array along axis `i` if `s[i] == -1`
196+
s = [a.shape[_a] if _s == -1 else _s for _s, _a in zip(s, axes)]
197+
return s, axes
198+
199+
200200
def _copy_array(x, complex_input):
201201
"""
202202
Creating a C-contiguous copy of input array if input array has a negative

tests/test_fft.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ class TestFft2:
361361
def setup_method(self):
362362
numpy.random.seed(42)
363363

364-
@pytest.mark.parametrize("dtype", get_all_dtypes(no_bool=True))
364+
@pytest.mark.parametrize("dtype", get_all_dtypes(no_complex=True))
365365
def test_fft2(self, dtype):
366366
x1 = numpy.random.uniform(-10, 10, 24)
367-
a_np = numpy.array(x1).reshape(2, 3, 4)
367+
a_np = numpy.array(x1, dtype=dtype).reshape(2, 3, 4)
368368
a = dpnp.asarray(a_np)
369369

370370
result = dpnp.fft.fft2(a)

0 commit comments

Comments
 (0)