@@ -153,9 +153,9 @@ cdef cnp.ndarray pad_array(cnp.ndarray x_arr, cnp.npy_intp n, int axis, int real
153153 ind [axis ] = slice (0 , cnp .PyArray_DIM (x_arr , axis ), None )
154154 bo = < object > b_arr
155155 xo = < object > x_arr
156- bo [ind ] = xo
156+ bo [tuple ( ind ) ] = xo
157157 ind [axis ] = slice (cnp .PyArray_DIM (x_arr , axis ), None , None )
158- bo [ind ] = 0.0
158+ bo [tuple ( ind ) ] = 0.0
159159
160160 return b_arr
161161
@@ -843,9 +843,12 @@ def rfftn_numpy(x, s=None, axes=None):
843843 for ii in range (a .shape [la ]):
844844 ind [la ] = ii
845845 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 ,
848849 overwrite_x = True , direction = 1 )
850+ if a_res is not a_inp :
851+ a [tind ] = a_res # copy in place
849852 else :
850853 for ii in range (len (axes )- 1 ):
851854 a = fft (a , s [ii ], axes [ii ], overwrite_x = True )
@@ -871,9 +874,12 @@ def irfftn_numpy(x, s=None, axes=None):
871874 for ii in range (a .shape [la ]):
872875 ind [la ] = ii
873876 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 ,
876880 overwrite_x = True , direction = - 1 )
881+ if a_res is not a_inp :
882+ a [tind ] = a_res # copy in place
877883 else :
878884 for ii in range (len (axes )- 1 ):
879885 a = ifft (a , s [ii ], axes [ii ], overwrite_x = ovr_x )
0 commit comments