39
39
40
40
"""
41
41
42
+ # pylint: disable=invalid-name
42
43
43
44
from enum import Enum
44
45
45
46
import numpy
46
47
47
48
import dpnp
48
- from dpnp .dpnp_utils import *
49
- from dpnp .fft .dpnp_algo_fft import *
49
+
50
+ # pylint: disable=no-name-in-module
51
+ from dpnp .dpnp_utils import (
52
+ call_origin ,
53
+ checker_throw_axis_error ,
54
+ )
55
+ from dpnp .fft .dpnp_algo_fft import (
56
+ dpnp_fft ,
57
+ dpnp_rfft ,
58
+ )
50
59
51
60
__all__ = [
52
61
"fft" ,
70
79
]
71
80
72
81
82
+ # TODO: remove pylint disable, once new implementation is ready
83
+ # pylint: disable=missing-class-docstring
73
84
class Norm (Enum ):
74
85
backward = 0
75
86
forward = 1
76
87
ortho = 2
77
88
78
89
90
+ # TODO: remove pylint disable, once new implementation is ready
91
+ # pylint: disable=missing-function-docstring
79
92
def get_validated_norm (norm ):
80
93
if norm is None or norm == "backward" :
81
94
return Norm .backward
@@ -98,8 +111,10 @@ def fft(x, n=None, axis=-1, norm=None):
98
111
Parameter `axis` is supported with its default value.
99
112
Only `dpnp.float64`, `dpnp.float32`, `dpnp.int64`, `dpnp.int32`,
100
113
`dpnp.complex128`, `dpnp.complex64` data types are supported.
101
- The `dpnp.bool` data type is not supported and will raise a `TypeError` exception.
114
+ The `dpnp.bool` data type is not supported and will raise a `TypeError`
115
+ exception.
102
116
Otherwise the function will be executed sequentially on CPU.
117
+
103
118
"""
104
119
105
120
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
@@ -205,12 +220,12 @@ def fftn(x, s=None, axes=None, norm=None):
205
220
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
206
221
if x_desc :
207
222
if s is None :
208
- boundaries = tuple ([ x_desc .shape [i ] for i in range (x_desc .ndim )] )
223
+ boundaries = tuple (x_desc .shape [i ] for i in range (x_desc .ndim ))
209
224
else :
210
225
boundaries = s
211
226
212
227
if axes is None :
213
- axes_param = tuple ([ i for i in range (x_desc .ndim )] )
228
+ axes_param = list ( range (x_desc .ndim ))
214
229
else :
215
230
axes_param = axes
216
231
@@ -256,6 +271,8 @@ def fftshift(x, axes=None):
256
271
"""
257
272
258
273
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
274
+ # TODO: enable implementation
275
+ # pylint: disable=condition-evals-to-constant
259
276
if x_desc and 0 :
260
277
norm_ = Norm .backward
261
278
@@ -267,6 +284,9 @@ def fftshift(x, axes=None):
267
284
if x_desc .size < 1 :
268
285
pass # let fallback to handle exception
269
286
else :
287
+ input_boundarie = x_desc .shape [axis_param ]
288
+ output_boundarie = input_boundarie
289
+
270
290
return dpnp_fft (
271
291
x_desc ,
272
292
input_boundarie ,
@@ -281,7 +301,8 @@ def fftshift(x, axes=None):
281
301
282
302
def hfft (x , n = None , axis = - 1 , norm = None ):
283
303
"""
284
- Compute the one-dimensional discrete Fourier Transform of a signal that has Hermitian symmetry.
304
+ Compute the one-dimensional discrete Fourier Transform of a signal that has
305
+ Hermitian symmetry.
285
306
286
307
For full documentation refer to :obj:`numpy.fft.hfft`.
287
308
@@ -296,6 +317,8 @@ def hfft(x, n=None, axis=-1, norm=None):
296
317
"""
297
318
298
319
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
320
+ # TODO: enable implementation
321
+ # pylint: disable=condition-evals-to-constant
299
322
if x_desc and 0 :
300
323
norm_ = get_validated_norm (norm )
301
324
@@ -342,7 +365,8 @@ def ifft(x, n=None, axis=-1, norm=None):
342
365
Parameter `axis` is supported with its default value.
343
366
Only `dpnp.float64`, `dpnp.float32`, `dpnp.int64`, `dpnp.int32`,,
344
367
`dpnp.complex128`, `dpnp.complex64` data types are supported.
345
- The `dpnp.bool` data type is not supported and will raise a `TypeError` exception.
368
+ The `dpnp.bool` data type is not supported and will raise a `TypeError`
369
+ exception.
346
370
Otherwise the function will be executed sequentially on CPU.
347
371
348
372
"""
@@ -430,6 +454,8 @@ def ifftshift(x, axes=None):
430
454
"""
431
455
432
456
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
457
+ # TODO: enable implementation
458
+ # pylint: disable=condition-evals-to-constant
433
459
if x_desc and 0 :
434
460
norm_ = Norm .backward
435
461
@@ -478,14 +504,16 @@ def ifftn(x, s=None, axes=None, norm=None):
478
504
"""
479
505
480
506
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
507
+ # TODO: enable implementation
508
+ # pylint: disable=condition-evals-to-constant
481
509
if x_desc and 0 :
482
510
if s is None :
483
- boundaries = tuple ([ x_desc .shape [i ] for i in range (x_desc .ndim )] )
511
+ boundaries = tuple (x_desc .shape [i ] for i in range (x_desc .ndim ))
484
512
else :
485
513
boundaries = s
486
514
487
515
if axes is None :
488
- axes_param = tuple ([ i for i in range (x_desc .ndim )] )
516
+ axes_param = list ( range (x_desc .ndim ))
489
517
else :
490
518
axes_param = axes
491
519
@@ -522,7 +550,8 @@ def ifftn(x, s=None, axes=None, norm=None):
522
550
523
551
def ihfft (x , n = None , axis = - 1 , norm = None ):
524
552
"""
525
- Compute inverse one-dimensional discrete Fourier Transform of a signal that has Hermitian symmetry.
553
+ Compute inverse one-dimensional discrete Fourier Transform of a signal that
554
+ has Hermitian symmetry.
526
555
527
556
For full documentation refer to :obj:`numpy.fft.ihfft`.
528
557
@@ -537,6 +566,8 @@ def ihfft(x, n=None, axis=-1, norm=None):
537
566
"""
538
567
539
568
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
569
+ # TODO: enable implementation
570
+ # pylint: disable=condition-evals-to-constant
540
571
if x_desc and 0 :
541
572
norm_ = get_validated_norm (norm )
542
573
@@ -575,7 +606,8 @@ def ihfft(x, n=None, axis=-1, norm=None):
575
606
576
607
def irfft (x , n = None , axis = - 1 , norm = None ):
577
608
"""
578
- Compute the one-dimensional inverse discrete Fourier Transform for real input.
609
+ Compute the one-dimensional inverse discrete Fourier Transform for real
610
+ input.
579
611
580
612
For full documentation refer to :obj:`numpy.fft.irfft`.
581
613
@@ -590,6 +622,8 @@ def irfft(x, n=None, axis=-1, norm=None):
590
622
"""
591
623
592
624
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
625
+ # TODO: enable implementation
626
+ # pylint: disable=condition-evals-to-constant
593
627
if x_desc and 0 :
594
628
norm_ = get_validated_norm (norm )
595
629
@@ -622,7 +656,8 @@ def irfft(x, n=None, axis=-1, norm=None):
622
656
True ,
623
657
norm_ .value ,
624
658
).get_pyobj ()
625
- # TODO tmp = utils.create_output_array(result_shape, result_c_type, out)
659
+ # TODO:
660
+ # tmp = utils.create_output_array(result_shape, result_c_type, out)
626
661
# tmp = dparray(result.shape, dtype=dpnp.float64)
627
662
# for it in range(tmp.size):
628
663
# tmp[it] = result[it].real
@@ -678,14 +713,16 @@ def irfftn(x, s=None, axes=None, norm=None):
678
713
"""
679
714
680
715
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
716
+ # TODO: enable implementation
717
+ # pylint: disable=condition-evals-to-constant
681
718
if x_desc and 0 :
682
719
if s is None :
683
- boundaries = tuple ([ x_desc .shape [i ] for i in range (x_desc .ndim )] )
720
+ boundaries = tuple (x_desc .shape [i ] for i in range (x_desc .ndim ))
684
721
else :
685
722
boundaries = s
686
723
687
724
if axes is None :
688
- axes_param = tuple ([ i for i in range (x_desc .ndim )] )
725
+ axes_param = list ( range (x_desc .ndim ))
689
726
else :
690
727
axes_param = axes
691
728
@@ -732,8 +769,10 @@ def rfft(x, n=None, axis=-1, norm=None):
732
769
Parameter `norm` is unsupported.
733
770
Only `dpnp.float64`, `dpnp.float32`, `dpnp.int64`, `dpnp.int32`,
734
771
`dpnp.complex128` data types are supported.
735
- The `dpnp.bool` data type is not supported and will raise a `TypeError` exception.
772
+ The `dpnp.bool` data type is not supported and will raise a `TypeError`
773
+ exception.
736
774
Otherwise the function will be executed sequentially on CPU.
775
+
737
776
"""
738
777
739
778
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
@@ -844,14 +883,16 @@ def rfftn(x, s=None, axes=None, norm=None):
844
883
"""
845
884
846
885
x_desc = dpnp .get_dpnp_descriptor (x , copy_when_nondefault_queue = False )
886
+ # TODO: enable implementation
887
+ # pylint: disable=condition-evals-to-constant
847
888
if x_desc and 0 :
848
889
if s is None :
849
- boundaries = tuple ([ x_desc .shape [i ] for i in range (x_desc .ndim )] )
890
+ boundaries = tuple (x_desc .shape [i ] for i in range (x_desc .ndim ))
850
891
else :
851
892
boundaries = s
852
893
853
894
if axes is None :
854
- axes_param = tuple ([ i for i in range (x_desc .ndim )] )
895
+ axes_param = list ( range (x_desc .ndim ))
855
896
else :
856
897
axes_param = axes
857
898
0 commit comments