@@ -100,7 +100,7 @@ def fft(x1, n=None, axis=-1, norm=None):
100
100
else :
101
101
output_boundarie = input_boundarie
102
102
103
- return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param )
103
+ return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param , False )
104
104
105
105
return call_origin (numpy .fft .fft , x1 , n , axis , norm )
106
106
@@ -197,7 +197,7 @@ def ifft(x1, n=None, axis=-1, norm=None):
197
197
198
198
is_x1_dparray = isinstance (x1 , dparray )
199
199
200
- if (not use_origin_backend (x1 ) and is_x1_dparray and 0 ):
200
+ if (not use_origin_backend (x1 ) and is_x1_dparray ):
201
201
if axis is None :
202
202
axis_param = - 1 # the most right dimension (default value)
203
203
else :
@@ -217,7 +217,7 @@ def ifft(x1, n=None, axis=-1, norm=None):
217
217
else :
218
218
output_boundarie = input_boundarie
219
219
220
- return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param )
220
+ return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param , True )
221
221
222
222
return call_origin (numpy .fft .ifft , x1 , n , axis , norm )
223
223
@@ -240,11 +240,11 @@ def ifft2(x1, s=None, axes=(-2, -1), norm=None):
240
240
241
241
is_x1_dparray = isinstance (x1 , dparray )
242
242
243
- if (not use_origin_backend (x1 ) and is_x1_dparray and 0 ):
243
+ if (not use_origin_backend (x1 ) and is_x1_dparray ):
244
244
if norm is not None :
245
245
pass
246
246
else :
247
- return fftn (x1 , s , axes , norm )
247
+ return ifftn (x1 , s , axes , norm )
248
248
249
249
return call_origin (numpy .fft .ifft2 , x1 , s , axes , norm )
250
250
@@ -267,7 +267,7 @@ def ifftn(x1, s=None, axes=None, norm=None):
267
267
268
268
is_x1_dparray = isinstance (x1 , dparray )
269
269
270
- if (not use_origin_backend (x1 ) and is_x1_dparray and 0 ):
270
+ if (not use_origin_backend (x1 ) and is_x1_dparray ):
271
271
if s is None :
272
272
boundaries = tuple ([x1 .shape [i ] for i in range (x1 .ndim )])
273
273
else :
@@ -291,7 +291,7 @@ def ifftn(x1, s=None, axes=None, norm=None):
291
291
except IndexError :
292
292
checker_throw_axis_error ("fft.ifftn" , "is out of bounds" , param_axis , f"< { len (boundaries )} " )
293
293
294
- x1_iter = fft (x1_iter , n = param_n , axis = param_axis , norm = norm )
294
+ x1_iter = ifft (x1_iter , n = param_n , axis = param_axis , norm = norm )
295
295
296
296
return x1_iter
297
297
@@ -332,9 +332,13 @@ def irfft(x1, n=None, axis=-1, norm=None):
332
332
elif norm is not None :
333
333
pass
334
334
else :
335
- output_boundarie = input_boundarie
335
+ output_boundarie = 2 * ( input_boundarie - 1 )
336
336
337
- return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param )
337
+ result = dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param , True )
338
+ tmp = dparray (result .shape , dtype = dpnp .float64 )
339
+ for it in range (tmp .size ):
340
+ tmp [it ] = result [it ].real
341
+ return tmp
338
342
339
343
return call_origin (numpy .fft .irfft , x1 , n , axis , norm )
340
344
@@ -357,11 +361,11 @@ def irfft2(x1, s=None, axes=(-2, -1), norm=None):
357
361
358
362
is_x1_dparray = isinstance (x1 , dparray )
359
363
360
- if (not use_origin_backend (x1 ) and is_x1_dparray and 0 ):
364
+ if (not use_origin_backend (x1 ) and is_x1_dparray ):
361
365
if norm is not None :
362
366
pass
363
367
else :
364
- return fftn (x1 , s , axes , norm )
368
+ return irfftn (x1 , s , axes , norm )
365
369
366
370
return call_origin (numpy .fft .irfft2 , x1 , s , axes , norm )
367
371
@@ -408,7 +412,7 @@ def irfftn(x1, s=None, axes=None, norm=None):
408
412
except IndexError :
409
413
checker_throw_axis_error ("fft.irfftn" , "is out of bounds" , param_axis , f"< { len (boundaries )} " )
410
414
411
- x1_iter = fft (x1_iter , n = param_n , axis = param_axis , norm = norm )
415
+ x1_iter = irfft (x1_iter , n = param_n , axis = param_axis , norm = norm )
412
416
413
417
return x1_iter
414
418
@@ -451,7 +455,7 @@ def rfft(x1, n=None, axis=-1, norm=None):
451
455
else :
452
456
output_boundarie = input_boundarie // 2 + 1 # rfft specific requirenment
453
457
454
- return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param )
458
+ return dpnp_fft (x1 , input_boundarie , output_boundarie , axis_param , False )
455
459
456
460
return call_origin (numpy .fft .rfft , x1 , n , axis , norm )
457
461
0 commit comments