@@ -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 ,
@@ -382,18 +375,18 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
382
375
"""
383
376
cdef cnp.ndarray x_arr " x_arrayObject"
384
377
cdef cnp.ndarray f_arr " f_arrayObject"
385
- cdef int xnd, n_max = 0 , in_place, dir_
378
+ cdef int xnd, n_max = 0 , in_place
386
379
cdef long n_, axis_
387
380
cdef int x_type, f_type, status = 0
388
381
cdef int ALL_HARMONICS = 1
389
382
cdef char * c_error_msg = NULL
390
383
cdef bytes py_error_msg
391
384
cdef DftiCache * _cache
392
385
393
- x_arr = _process_arguments(
394
- x, n, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 0
395
- )
386
+ if direction not in [- 1 , + 1 ]:
387
+ raise ValueError (" Direction of FFT should +1 or -1" )
396
388
389
+ x_arr = _process_arguments(x, n, axis, & axis_, & n_, & in_place, & xnd, 0 )
397
390
x_type = cnp.PyArray_TYPE(x_arr)
398
391
399
392
if out is not None :
@@ -429,7 +422,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
429
422
_cache_capsule, capsule_name
430
423
)
431
424
if x_type is cnp.NPY_CDOUBLE:
432
- if dir_ < 0 :
425
+ if direction < 0 :
433
426
status = cdouble_mkl_ifft1d_in(
434
427
x_arr, n_, < int > axis_, fsc, _cache
435
428
)
@@ -438,7 +431,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
438
431
x_arr, n_, < int > axis_, fsc, _cache
439
432
)
440
433
elif x_type is cnp.NPY_CFLOAT:
441
- if dir_ < 0 :
434
+ if direction < 0 :
442
435
status = cfloat_mkl_ifft1d_in(
443
436
x_arr, n_, < int > axis_, fsc, _cache
444
437
)
@@ -487,7 +480,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
487
480
)
488
481
if f_type is cnp.NPY_CDOUBLE:
489
482
if x_type is cnp.NPY_DOUBLE:
490
- if dir_ < 0 :
483
+ if direction < 0 :
491
484
status = double_cdouble_mkl_ifft1d_out(
492
485
x_arr,
493
486
n_,
@@ -508,7 +501,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
508
501
_cache,
509
502
)
510
503
elif x_type is cnp.NPY_CDOUBLE:
511
- if dir_ < 0 :
504
+ if direction < 0 :
512
505
status = cdouble_cdouble_mkl_ifft1d_out(
513
506
x_arr, n_, < int > axis_, f_arr, fsc, _cache
514
507
)
@@ -518,7 +511,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
518
511
)
519
512
else :
520
513
if x_type is cnp.NPY_FLOAT:
521
- if dir_ < 0 :
514
+ if direction < 0 :
522
515
status = float_cfloat_mkl_ifft1d_out(
523
516
x_arr,
524
517
n_,
@@ -539,7 +532,7 @@ def _c2c_fft1d_impl(x, n=None, axis=-1, direction=+1, double fsc=1.0, out=None):
539
532
_cache,
540
533
)
541
534
elif x_type is cnp.NPY_CFLOAT:
542
- if dir_ < 0 :
535
+ if direction < 0 :
543
536
status = cfloat_cfloat_mkl_ifft1d_out(
544
537
x_arr, n_, < int > axis_, f_arr, fsc, _cache
545
538
)
@@ -571,18 +564,15 @@ def _r2c_fft1d_impl(
571
564
"""
572
565
cdef cnp.ndarray x_arr " x_arrayObject"
573
566
cdef cnp.ndarray f_arr " f_arrayObject"
574
- cdef int xnd, in_place, dir_
567
+ cdef int xnd, in_place
575
568
cdef long n_, axis_
576
569
cdef int x_type, f_type, status, requirement
577
570
cdef int HALF_HARMONICS = 0 # give only positive index harmonics
578
- cdef int direction = 1 # dummy, only used for the sake of arg-processing
579
571
cdef char * c_error_msg = NULL
580
572
cdef bytes py_error_msg
581
573
cdef DftiCache * _cache
582
574
583
- x_arr = _process_arguments(
584
- x, n, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 1
585
- )
575
+ x_arr = _process_arguments(x, n, axis, & axis_, & n_, & in_place, & xnd, 1 )
586
576
587
577
x_type = cnp.PyArray_TYPE(x_arr)
588
578
@@ -672,20 +662,17 @@ def _c2r_fft1d_impl(
672
662
"""
673
663
cdef cnp.ndarray x_arr " x_arrayObject"
674
664
cdef cnp.ndarray f_arr " f_arrayObject"
675
- cdef int xnd, in_place, dir_, int_n
665
+ cdef int xnd, in_place, int_n
676
666
cdef long n_, axis_
677
667
cdef int x_type, f_type, status
678
- cdef int direction = 1 # dummy, only used for the sake of arg-processing
679
668
cdef char * c_error_msg = NULL
680
669
cdef bytes py_error_msg
681
670
cdef DftiCache * _cache
682
671
683
672
int_n = _is_integral(n)
684
673
# nn gives the number elements along axis of the input that we use
685
674
nn = (n // 2 + 1 ) if int_n and n > 0 else n
686
- x_arr = _process_arguments(
687
- x, nn, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 0
688
- )
675
+ x_arr = _process_arguments(x, nn, axis, & axis_, & n_, & in_place, & xnd, 0 )
689
676
n_ = 2 * (n_ - 1 )
690
677
if int_n and (n % 2 == 1 ):
691
678
n_ += 1
@@ -774,12 +761,10 @@ def _direct_fftnd(
774
761
cdef int err
775
762
cdef cnp.ndarray x_arr " xxnd_arrayObject"
776
763
cdef cnp.ndarray f_arr " ffnd_arrayObject"
777
- cdef int dir_, in_place, x_type, f_type
764
+ cdef int in_place, x_type, f_type
778
765
779
766
if direction not in [- 1 , + 1 ]:
780
767
raise ValueError (" Direction of FFT should +1 or -1" )
781
- else :
782
- dir_ = - 1 if direction is - 1 else + 1
783
768
784
769
# convert x to ndarray, ensure that strides are multiples of itemsize
785
770
x_arr = PyArray_CheckFromAny(
@@ -824,12 +809,12 @@ def _direct_fftnd(
824
809
825
810
if in_place:
826
811
if x_type == cnp.NPY_CDOUBLE:
827
- if dir_ == 1 :
812
+ if direction == 1 :
828
813
err = cdouble_cdouble_mkl_fftnd_in(x_arr, fsc)
829
814
else :
830
815
err = cdouble_cdouble_mkl_ifftnd_in(x_arr, fsc)
831
816
elif x_type == cnp.NPY_CFLOAT:
832
- if dir_ == 1 :
817
+ if direction == 1 :
833
818
err = cfloat_cfloat_mkl_fftnd_in(x_arr, fsc)
834
819
else :
835
820
err = cfloat_cfloat_mkl_ifftnd_in(x_arr, fsc)
@@ -856,22 +841,22 @@ def _direct_fftnd(
856
841
f_arr = _allocate_result(x_arr, - 1 , 0 , f_type)
857
842
858
843
if x_type == cnp.NPY_CDOUBLE:
859
- if dir_ == 1 :
844
+ if direction == 1 :
860
845
err = cdouble_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
861
846
else :
862
847
err = cdouble_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
863
848
elif x_type == cnp.NPY_CFLOAT:
864
- if dir_ == 1 :
849
+ if direction == 1 :
865
850
err = cfloat_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
866
851
else :
867
852
err = cfloat_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
868
853
elif x_type == cnp.NPY_DOUBLE:
869
- if dir_ == 1 :
854
+ if direction == 1 :
870
855
err = double_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
871
856
else :
872
857
err = double_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
873
858
elif x_type == cnp.NPY_FLOAT:
874
- if dir_ == 1 :
859
+ if direction == 1 :
875
860
err = float_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
876
861
else :
877
862
err = float_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
0 commit comments