Skip to content

Commit 0326b1a

Browse files
author
Vahid Tavanashad
committed
address comemnts
1 parent c1ff25e commit 0326b1a

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

mkl_fft/_numpy_fft.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def frwd_sc_1d(n, s):
7575
return 1/nn if nn != 0 else 1
7676

7777

78-
def frwd_sc_nd(s, axes, x_shape):
78+
def frwd_sc_nd(s, x_shape):
7979
ss = s if s is not None else x_shape
8080
nn = prod(ss)
8181
return 1/nn if nn != 0 else 1
@@ -812,9 +812,9 @@ def fftn(a, s=None, axes=None, norm=None):
812812
if norm in (None, "backward"):
813813
fsc = 1.0
814814
elif norm == "forward":
815-
fsc = frwd_sc_nd(s, axes, x.shape)
815+
fsc = frwd_sc_nd(s, x.shape)
816816
else:
817-
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))
817+
fsc = sqrt(frwd_sc_nd(s, x.shape))
818818

819819
return trycall(
820820
mkl_fft.fftn,
@@ -928,9 +928,9 @@ def ifftn(a, s=None, axes=None, norm=None):
928928
if norm in (None, "backward"):
929929
fsc = 1.0
930930
elif norm == "forward":
931-
fsc = frwd_sc_nd(s, axes, x.shape)
931+
fsc = frwd_sc_nd(s, x.shape)
932932
else:
933-
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))
933+
fsc = sqrt(frwd_sc_nd(s, x.shape))
934934

935935
return trycall(
936936
mkl_fft.ifftn,
@@ -1227,11 +1227,11 @@ def rfftn(a, s=None, axes=None, norm=None):
12271227
elif norm == "forward":
12281228
x = asanyarray(x)
12291229
s, axes = _cook_nd_args(x, s, axes)
1230-
fsc = frwd_sc_nd(s, axes, x.shape)
1230+
fsc = frwd_sc_nd(s, x.shape)
12311231
else:
12321232
x = asanyarray(x)
12331233
s, axes = _cook_nd_args(x, s, axes)
1234-
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))
1234+
fsc = sqrt(frwd_sc_nd(s, x.shape))
12351235

12361236
return trycall(
12371237
mkl_fft.rfftn,
@@ -1384,11 +1384,11 @@ def irfftn(a, s=None, axes=None, norm=None):
13841384
elif norm == "forward":
13851385
x = asanyarray(x)
13861386
s, axes = _cook_nd_args(x, s, axes, invreal=1)
1387-
fsc = frwd_sc_nd(s, axes, x.shape)
1387+
fsc = frwd_sc_nd(s, x.shape)
13881388
else:
13891389
x = asanyarray(x)
13901390
s, axes = _cook_nd_args(x, s, axes, invreal=1)
1391-
fsc = sqrt(frwd_sc_nd(s, axes, x.shape))
1391+
fsc = sqrt(frwd_sc_nd(s, x.shape))
13921392

13931393
return trycall(
13941394
mkl_fft.irfftn,

mkl_fft/_scipy_fft.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,13 @@ def _check_plan(plan):
200200

201201

202202
def _frwd_sc_1d(n, s):
203-
nn = n if n else s
203+
nn = n if n is not None else s
204204
return 1/nn if nn != 0 else 1
205205

206206

207-
def _frwd_sc_nd(s, axes, x_shape):
207+
def _frwd_sc_nd(s, x_shape):
208208
ss = s if s is not None else x_shape
209-
if axes is not None:
210-
nn = prod([ss[ai] for ai in axes])
211-
else:
212-
nn = prod(ss)
209+
nn = prod(ss)
213210
return 1/nn if nn != 0 else 1
214211

215212

@@ -233,9 +230,9 @@ def _compute_nd_fwd_scale(norm, s, axes, x_shape):
233230
if norm in (None, "backward"):
234231
fsc = 1.0
235232
elif norm == "forward":
236-
fsc = _frwd_sc_nd(s, axes, x_shape)
233+
fsc = _frwd_sc_nd(s, x_shape)
237234
elif norm == "ortho":
238-
fsc = sqrt(_frwd_sc_nd(s, axes, x_shape))
235+
fsc = sqrt(_frwd_sc_nd(s, x_shape))
239236
else:
240237
_check_norm(norm)
241238
return fsc
@@ -359,10 +356,10 @@ def _compute_nd_fwd_scale_for_rfft(norm, s, axes, x, invreal=False):
359356
fsc = 1.0
360357
elif norm == "forward":
361358
s, axes = _cook_nd_args(x, s, axes, invreal=invreal)
362-
fsc = _frwd_sc_nd(s, axes, x.shape)
359+
fsc = _frwd_sc_nd(s, x.shape)
363360
elif norm == "ortho":
364361
s, axes = _cook_nd_args(x, s, axes, invreal=invreal)
365-
fsc = sqrt(_frwd_sc_nd(s, axes, x.shape))
362+
fsc = sqrt(_frwd_sc_nd(s, x.shape))
366363
else:
367364
_check_norm(norm)
368365
return s, axes, fsc

0 commit comments

Comments
 (0)