数组放在左边没有越界,放在等式右边就出现了越界。上传的图片中前面用来测试的y(k)好好的,循环里就有问题了,求大神帮忙
subroutine wfft(y,forback)
use fft_mod
implicit none
real*8,parameter :: pi=3.141592654_DP
complex*16,intent(inout) :: y(
integer,intent(in) :: forback
real*8 :: e
integer :: N2,N,k,ktem,kN
complex*16 W,temp
integer,external :: reverse
N=size(y)
N2=N
kN=N/2
k=0
e=forback*2.0_DP*pi/N
W=exp(cmplx(0.0_DP,e))
do k=1,kN,1
y(k)=cmplx(real(y(k)),0.0_DP)
write(*,*) k,real(Y(k))
enddo
do
N2=N2/2
if(N2<1)exit
do k=1,kN
write(*,*) k,kN,k+kN,y(k)
temp=W**(reverse(k))*y(k+KN)
y(k+kN)=y(k)-temp
y(k)=y(k)+temp
enddo
enddo
endsubroutine
![放在循环里的数组越界了,求帮忙]()
_7P4OEAHC(UFOUR8$Z%~R`4.png
![放在循环里的数组越界了,求帮忙-1]()
2L1Y{@@TDQ%Z056K0N%[IOC.png |