Skip to content

Commit 7fdcb4e

Browse files
committed
Fix composite complex
1 parent 3529e73 commit 7fdcb4e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/algos.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ end
99
fft!(::AbstractVector{T}, ::AbstractVector{T}, ::Int, ::Int, ::Direction, ::AbstractFFTType, ::CallGraph{T}, ::Int) where {T} = nothing
1010

1111
@inline function direction_sign(::FFT_BACKWARD)
12-
1
12+
1.
1313
end
1414

1515
@inline function direction_sign(::FFT_FORWARD)
16-
-1
16+
-1.
1717
end
1818

1919
function (g::CallGraph{T})(out::AbstractVector{T}, in::AbstractVector{U}, start_out::Int, start_in::Int, v::Direction, t::AbstractFFTType, idx::Int) where {T,U}
@@ -36,10 +36,10 @@ function fft!(out::AbstractVector{T}, in::AbstractVector{U}, start_out::Int, sta
3636
wj1 = one(T)
3737
tmp = g.workspace[idx]
3838
for j1 in 0:N1-1
39-
wk2 = wj1;
39+
wk2 = wj1
4040
g(tmp, in, N2*j1+1, start_in + j1*s_in, d, right.type, right_idx)
4141
j1 > 0 && for k2 in 1:N2-1
42-
tmp[N2*j1 + k2] *= wk2
42+
tmp[N2*j1 + k2 + 1] *= wk2
4343
wk2 *= wj1
4444
end
4545
wj1 *= w1
@@ -48,7 +48,6 @@ function fft!(out::AbstractVector{T}, in::AbstractVector{U}, start_out::Int, sta
4848
for k2 in 0:N2-1
4949
g(out, tmp, start_out + k2*s_out, k2+1, d, left.type, left_idx)
5050
end
51-
out .+= 0
5251
end
5352

5453
function fft!(out::AbstractVector{T}, in::AbstractVector{U}, start_out::Int, start_in::Int, d::Direction, ::Pow2FFT, g::CallGraph{T}, idx::Int) where {T,U}
@@ -124,7 +123,6 @@ function fft_dft!(out::AbstractVector{T}, in::AbstractVector{T}, N::Int, start_o
124123
out[start_out] = tmp
125124

126125
wk = wkn = w = convert(T, cispi(direction_sign(d)*2/N))
127-
128126
@inbounds for d in 1:N-1
129127
tmp = in[start_in]
130128
@inbounds for k in 1:N-1

test/complex_backward.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ using FFTA, Test
33
@testset verbose = true "bfft 1D complex, size $N" for N in [8, 11, 15, 100]
44
x = ones(ComplexF64, N)
55
y = bfft(x)
6-
@test y[1] N && y[2:end] 0*x[2:end] atol=1e-12
6+
b1 = isapprox(y[1], N, atol=1e-12)
7+
b2 = isapprox(y[2:end], 0*x[2:end], atol=1e-12)
8+
@test b1 && b2
79
end

0 commit comments

Comments
 (0)