[Fortran] 纯文本查看 复制代码
program main
!
integer :: N
parameter (N=80)
real in, var
real out
dimension in(N), out(N)
dimension var(N)
integer :: plan,plan2
integer :: i
real :: ran
!
do i=1,N
call random_number(ran)
in(i-1)=ran
end do
!
call rfftw_f77_create_plan(plan,N,FFTW_FORWARD,FFTW_ESTIMATE)
call rfftw_f77_one(plan,in,var)
call rfftw_f77_destroy_plan(plan)
call rfftw_f77_create_plan(plan2,N,FFTW_BACKWARD,FFTW_ESTIMATE)
call rfftw_f77_one(plan2,var,out)
call rfftw_f77_destroy_plan(plan2)
!
open(18,file='testft.dat')
do i=1,N
write(18,*)i,real(in(i)),real(out(i))
end do
close(18)
end program main