We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e348b15 commit f732a95Copy full SHA for f732a95
contents/cooley_tukey/code/julia/fft.jl
@@ -110,23 +110,17 @@ function butterfly(x)
110
return y
111
end
112
113
-function approx(x, y)
114
- val = true
115
- for i = 1:length(x)
116
- if (abs(x[i]) - abs(y[i]) > 1e-5)
117
- val = false
118
- end
119
120
- println(val)
121
-end
122
-
123
function main()
124
x = rand(128)
125
y = cooley_tukey(x)
126
z = iterative_cooley_tukey(x)
127
w = fft(x)
128
- approx(y, w)
129
- approx(z, w)
+ if(isapprox(y, w))
+ println("Recursive Cooley Tukey matches fft() from FFTW package.")
+ end
+ if(isapprox(z, w))
+ println("Iterative Cooley Tukey matches fft() from FFTW package.")
130
131
132
main()
0 commit comments