@@ -153,9 +153,9 @@ cdef cnp.ndarray pad_array(cnp.ndarray x_arr, cnp.npy_intp n, int axis, int real
153
153
ind [axis ] = slice (0 , cnp .PyArray_DIM (x_arr , axis ), None )
154
154
bo = < object > b_arr
155
155
xo = < object > x_arr
156
- bo [ind ] = xo
156
+ bo [tuple ( ind ) ] = xo
157
157
ind [axis ] = slice (cnp .PyArray_DIM (x_arr , axis ), None , None )
158
- bo [ind ] = 0.0
158
+ bo [tuple ( ind ) ] = 0.0
159
159
160
160
return b_arr
161
161
@@ -843,9 +843,12 @@ def rfftn_numpy(x, s=None, axes=None):
843
843
for ii in range (a .shape [la ]):
844
844
ind [la ] = ii
845
845
tind = tuple (ind )
846
- a [tind ] = _fftnd_impl (
847
- a [tind ], shape = ss , axes = aa ,
846
+ a_inp = a [tind ]
847
+ a_res = _fftnd_impl (
848
+ a_inp , shape = ss , axes = aa ,
848
849
overwrite_x = True , direction = 1 )
850
+ if a_res is not a_inp :
851
+ a [tind ] = a_res # copy in place
849
852
else :
850
853
for ii in range (len (axes )- 1 ):
851
854
a = fft (a , s [ii ], axes [ii ], overwrite_x = True )
@@ -871,9 +874,12 @@ def irfftn_numpy(x, s=None, axes=None):
871
874
for ii in range (a .shape [la ]):
872
875
ind [la ] = ii
873
876
tind = tuple (ind )
874
- a [tind ] = _fftnd_impl (
875
- a [tind ], shape = ss , axes = aa ,
877
+ a_inp = a [tind ]
878
+ a_res = _fftnd_impl (
879
+ a_inp , shape = ss , axes = aa ,
876
880
overwrite_x = True , direction = - 1 )
881
+ if a_res is not a_inp :
882
+ a [tind ] = a_res # copy in place
877
883
else :
878
884
for ii in range (len (axes )- 1 ):
879
885
a = ifft (a , s [ii ], axes [ii ], overwrite_x = ovr_x )
0 commit comments