@@ -224,12 +224,10 @@ cdef cnp.ndarray _process_arguments(
224
224
object x,
225
225
object n,
226
226
object axis,
227
- object direction,
228
227
long * axis_,
229
228
long * n_,
230
229
int * in_place,
231
230
int * xnd,
232
- int * dir_,
233
231
int realQ,
234
232
):
235
233
"""
@@ -239,11 +237,6 @@ cdef cnp.ndarray _process_arguments(
239
237
cdef long n_max = 0
240
238
cdef cnp.ndarray x_arr " xx_arrayObject"
241
239
242
- if direction not in [- 1 , + 1 ]:
243
- raise ValueError (" Direction of FFT should +1 or -1" )
244
- else :
245
- dir_[0 ] = - 1 if direction is - 1 else + 1
246
-
247
240
# convert x to ndarray, ensure that strides are multiples of itemsize
248
241
x_arr = PyArray_CheckFromAny(
249
242
x, NULL , 0 , 0 ,
@@ -379,18 +372,18 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
379
372
"""
380
373
cdef cnp.ndarray x_arr " x_arrayObject"
381
374
cdef cnp.ndarray f_arr " f_arrayObject"
382
- cdef int xnd, n_max = 0 , in_place, dir_
375
+ cdef int xnd, n_max = 0 , in_place
383
376
cdef long n_, axis_
384
377
cdef int x_type, f_type, status = 0
385
378
cdef int ALL_HARMONICS = 1
386
379
cdef char * c_error_msg = NULL
387
380
cdef bytes py_error_msg
388
381
cdef DftiCache * _cache
389
382
390
- x_arr = _process_arguments(
391
- x, n, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 0
392
- )
383
+ if direction not in [- 1 , + 1 ]:
384
+ raise ValueError (" Direction of FFT should +1 or -1" )
393
385
386
+ x_arr = _process_arguments(x, n, axis, & axis_, & n_, & in_place, & xnd, 0 )
394
387
x_type = cnp.PyArray_TYPE(x_arr)
395
388
396
389
if out is not None :
@@ -424,7 +417,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
424
417
_cache_capsule, capsule_name
425
418
)
426
419
if x_type is cnp.NPY_CDOUBLE:
427
- if dir_ < 0 :
420
+ if direction < 0 :
428
421
status = cdouble_mkl_ifft1d_in(
429
422
x_arr, n_, < int > axis_, fsc, _cache
430
423
)
@@ -433,7 +426,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
433
426
x_arr, n_, < int > axis_, fsc, _cache
434
427
)
435
428
elif x_type is cnp.NPY_CFLOAT:
436
- if dir_ < 0 :
429
+ if direction < 0 :
437
430
status = cfloat_mkl_ifft1d_in(
438
431
x_arr, n_, < int > axis_, fsc, _cache
439
432
)
@@ -482,7 +475,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
482
475
)
483
476
if f_type is cnp.NPY_CDOUBLE:
484
477
if x_type is cnp.NPY_DOUBLE:
485
- if dir_ < 0 :
478
+ if direction < 0 :
486
479
status = double_cdouble_mkl_ifft1d_out(
487
480
x_arr,
488
481
n_,
@@ -503,7 +496,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
503
496
_cache,
504
497
)
505
498
elif x_type is cnp.NPY_CDOUBLE:
506
- if dir_ < 0 :
499
+ if direction < 0 :
507
500
status = cdouble_cdouble_mkl_ifft1d_out(
508
501
x_arr, n_, < int > axis_, f_arr, fsc, _cache
509
502
)
@@ -513,7 +506,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
513
506
)
514
507
else :
515
508
if x_type is cnp.NPY_FLOAT:
516
- if dir_ < 0 :
509
+ if direction < 0 :
517
510
status = float_cfloat_mkl_ifft1d_out(
518
511
x_arr,
519
512
n_,
@@ -534,7 +527,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
534
527
_cache,
535
528
)
536
529
elif x_type is cnp.NPY_CFLOAT:
537
- if dir_ < 0 :
530
+ if direction < 0 :
538
531
status = cfloat_cfloat_mkl_ifft1d_out(
539
532
x_arr, n_, < int > axis_, f_arr, fsc, _cache
540
533
)
@@ -566,18 +559,15 @@ def _r2c_fft1d_impl(
566
559
"""
567
560
cdef cnp.ndarray x_arr " x_arrayObject"
568
561
cdef cnp.ndarray f_arr " f_arrayObject"
569
- cdef int xnd, in_place, dir_
562
+ cdef int xnd, in_place
570
563
cdef long n_, axis_
571
564
cdef int x_type, f_type, status, requirement
572
565
cdef int HALF_HARMONICS = 0 # give only positive index harmonics
573
- cdef int direction = 1 # dummy, only used for the sake of arg-processing
574
566
cdef char * c_error_msg = NULL
575
567
cdef bytes py_error_msg
576
568
cdef DftiCache * _cache
577
569
578
- x_arr = _process_arguments(
579
- x, n, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 1
580
- )
570
+ x_arr = _process_arguments(x, n, axis, & axis_, & n_, & in_place, & xnd, 1 )
581
571
582
572
x_type = cnp.PyArray_TYPE(x_arr)
583
573
@@ -667,20 +657,17 @@ def _c2r_fft1d_impl(
667
657
"""
668
658
cdef cnp.ndarray x_arr " x_arrayObject"
669
659
cdef cnp.ndarray f_arr " f_arrayObject"
670
- cdef int xnd, in_place, dir_, int_n
660
+ cdef int xnd, in_place, int_n
671
661
cdef long n_, axis_
672
662
cdef int x_type, f_type, status
673
- cdef int direction = 1 # dummy, only used for the sake of arg-processing
674
663
cdef char * c_error_msg = NULL
675
664
cdef bytes py_error_msg
676
665
cdef DftiCache * _cache
677
666
678
667
int_n = _is_integral(n)
679
668
# nn gives the number elements along axis of the input that we use
680
669
nn = (n // 2 + 1 ) if int_n and n > 0 else n
681
- x_arr = _process_arguments(
682
- x, nn, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 0
683
- )
670
+ x_arr = _process_arguments(x, nn, axis, & axis_, & n_, & in_place, & xnd, 0 )
684
671
n_ = 2 * (n_ - 1 )
685
672
if int_n and (n % 2 == 1 ):
686
673
n_ += 1
@@ -769,12 +756,10 @@ def _direct_fftnd(
769
756
cdef int err
770
757
cdef cnp.ndarray x_arr " xxnd_arrayObject"
771
758
cdef cnp.ndarray f_arr " ffnd_arrayObject"
772
- cdef int dir_, in_place, x_type, f_type
759
+ cdef int in_place, x_type, f_type
773
760
774
761
if direction not in [- 1 , + 1 ]:
775
762
raise ValueError (" Direction of FFT should +1 or -1" )
776
- else :
777
- dir_ = - 1 if direction is - 1 else + 1
778
763
779
764
# convert x to ndarray, ensure that strides are multiples of itemsize
780
765
x_arr = PyArray_CheckFromAny(
@@ -814,12 +799,12 @@ def _direct_fftnd(
814
799
815
800
if in_place:
816
801
if x_type == cnp.NPY_CDOUBLE:
817
- if dir_ == 1 :
802
+ if direction == 1 :
818
803
err = cdouble_cdouble_mkl_fftnd_in(x_arr, fsc)
819
804
else :
820
805
err = cdouble_cdouble_mkl_ifftnd_in(x_arr, fsc)
821
806
elif x_type == cnp.NPY_CFLOAT:
822
- if dir_ == 1 :
807
+ if direction == 1 :
823
808
err = cfloat_cfloat_mkl_fftnd_in(x_arr, fsc)
824
809
else :
825
810
err = cfloat_cfloat_mkl_ifftnd_in(x_arr, fsc)
@@ -846,22 +831,22 @@ def _direct_fftnd(
846
831
f_arr = _allocate_result(x_arr, - 1 , 0 , f_type)
847
832
848
833
if x_type == cnp.NPY_CDOUBLE:
849
- if dir_ == 1 :
834
+ if direction == 1 :
850
835
err = cdouble_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
851
836
else :
852
837
err = cdouble_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
853
838
elif x_type == cnp.NPY_CFLOAT:
854
- if dir_ == 1 :
839
+ if direction == 1 :
855
840
err = cfloat_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
856
841
else :
857
842
err = cfloat_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
858
843
elif x_type == cnp.NPY_DOUBLE:
859
- if dir_ == 1 :
844
+ if direction == 1 :
860
845
err = double_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
861
846
else :
862
847
err = double_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
863
848
elif x_type == cnp.NPY_FLOAT:
864
- if dir_ == 1 :
849
+ if direction == 1 :
865
850
err = float_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
866
851
else :
867
852
err = float_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
0 commit comments