using FFTW
Copyright By PowCoder代写 加微信 powcoder
θ = range(0, 2π; length=n+1)[1:end-1]
Q = 1/sqrt(n) * [exp(-im*(k*θ[j])) for k=0:n-1, j=1:n]
b = randn(n)
norm(Q’b – sqrt(n)*ifft(b))
norm(Q*b – 1/sqrt(n)*fft(b))
2.999301662503971e-14
@time Q’b;
0.000017 seconds (3 allocations: 1.141 KiB)
@time ifft(b);
0.000062 seconds (35 allocations: 3.094 KiB)
b = randn(n)
@time ifft(b);
0.043449 seconds (37 allocations: 32.002 MiB)
n = 1_000_000
b = randn(n)
@time ifft(b);
0.036335 seconds (37 allocations: 30.520 MiB, 9.98% gc time)
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com