Skip to content

Commit e7ddc21

Browse files
committed
Turbo doesn't work?
1 parent a7ac3e6 commit e7ddc21

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/NSFFT.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module NSFFT
22

33
using Primes, StaticArrays, LoopVectorization
4-
export pow2FFT!, myfft_sv
4+
export pow2FFT!, DFT!
55

66
include("algos.jl")
77

src/algos.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,29 @@ function pow2FFT!(out::AbstractVector{T}, in::AbstractVector{T}, ::Val{FFT_BACKW
4848
out[j+m] = out_j - wj*out[j+m]
4949
wj *= w1
5050
end
51+
end
52+
53+
function DFT!(out::AbstractVector{T}, in::AbstractVector{T}, ::Val{FFT_FORWARD}) where {T<:Complex}
54+
N = length(out)
55+
inc = 2*π/N
56+
wn² = wn = w = T(cos(inc), -sin(inc));
57+
wn_1 = T(1., 0.);
58+
59+
tmp = in[1];
60+
out .= tmp;
61+
tmp = sum(in)
62+
out[1] = tmp;
63+
64+
wk = wn²;
65+
@turbo for d in 1:N
66+
for k in (d+1):N
67+
wk *= wn
68+
out[d] = in[k]*wk + out[d]
69+
out[k] = in[d]*wk + out[k]
70+
end
71+
wn_1 = wn
72+
wn *= w
73+
wn² *= (wn*wn_1)
74+
wk = wn²
75+
end
5176
end

0 commit comments

Comments
 (0)