@@ -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
@@ -668,20 +658,17 @@ def _c2r_fft1d_impl(
668
658
"""
669
659
cdef cnp.ndarray x_arr " x_arrayObject"
670
660
cdef cnp.ndarray f_arr " f_arrayObject"
671
- cdef int xnd, in_place, dir_, int_n
661
+ cdef int xnd, in_place, int_n
672
662
cdef long n_, axis_
673
663
cdef int x_type, f_type, status
674
- cdef int direction = 1 # dummy, only used for the sake of arg-processing
675
664
cdef char * c_error_msg = NULL
676
665
cdef bytes py_error_msg
677
666
cdef DftiCache * _cache
678
667
679
668
int_n = _is_integral(n)
680
669
# nn gives the number elements along axis of the input that we use
681
670
nn = (n // 2 + 1 ) if int_n and n > 0 else n
682
- x_arr = _process_arguments(
683
- x, nn, axis, direction, & axis_, & n_, & in_place, & xnd, & dir_, 0
684
- )
671
+ x_arr = _process_arguments(x, nn, axis, & axis_, & n_, & in_place, & xnd, 0 )
685
672
n_ = 2 * (n_ - 1 )
686
673
if int_n and (n % 2 == 1 ):
687
674
n_ += 1
@@ -770,12 +757,10 @@ def _direct_fftnd(
770
757
cdef int err
771
758
cdef cnp.ndarray x_arr " xxnd_arrayObject"
772
759
cdef cnp.ndarray f_arr " ffnd_arrayObject"
773
- cdef int dir_, in_place, x_type, f_type
760
+ cdef int in_place, x_type, f_type
774
761
775
762
if direction not in [- 1 , + 1 ]:
776
763
raise ValueError (" Direction of FFT should +1 or -1" )
777
- else :
778
- dir_ = - 1 if direction is - 1 else + 1
779
764
780
765
# convert x to ndarray, ensure that strides are multiples of itemsize
781
766
x_arr = PyArray_CheckFromAny(
@@ -815,12 +800,12 @@ def _direct_fftnd(
815
800
816
801
if in_place:
817
802
if x_type == cnp.NPY_CDOUBLE:
818
- if dir_ == 1 :
803
+ if direction == 1 :
819
804
err = cdouble_cdouble_mkl_fftnd_in(x_arr, fsc)
820
805
else :
821
806
err = cdouble_cdouble_mkl_ifftnd_in(x_arr, fsc)
822
807
elif x_type == cnp.NPY_CFLOAT:
823
- if dir_ == 1 :
808
+ if direction == 1 :
824
809
err = cfloat_cfloat_mkl_fftnd_in(x_arr, fsc)
825
810
else :
826
811
err = cfloat_cfloat_mkl_ifftnd_in(x_arr, fsc)
@@ -847,22 +832,22 @@ def _direct_fftnd(
847
832
f_arr = _allocate_result(x_arr, - 1 , 0 , f_type)
848
833
849
834
if x_type == cnp.NPY_CDOUBLE:
850
- if dir_ == 1 :
835
+ if direction == 1 :
851
836
err = cdouble_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
852
837
else :
853
838
err = cdouble_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
854
839
elif x_type == cnp.NPY_CFLOAT:
855
- if dir_ == 1 :
840
+ if direction == 1 :
856
841
err = cfloat_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
857
842
else :
858
843
err = cfloat_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
859
844
elif x_type == cnp.NPY_DOUBLE:
860
- if dir_ == 1 :
845
+ if direction == 1 :
861
846
err = double_cdouble_mkl_fftnd_out(x_arr, f_arr, fsc)
862
847
else :
863
848
err = double_cdouble_mkl_ifftnd_out(x_arr, f_arr, fsc)
864
849
elif x_type == cnp.NPY_FLOAT:
865
- if dir_ == 1 :
850
+ if direction == 1 :
866
851
err = float_cfloat_mkl_fftnd_out(x_arr, f_arr, fsc)
867
852
else :
868
853
err = float_cfloat_mkl_ifftnd_out(x_arr, f_arr, fsc)
0 commit comments