@@ -10,67 +10,6 @@ include("algos.jl")
10
10
include (" plan.jl" )
11
11
12
12
#=
13
- """
14
- $(TYPEDSIGNATURES)
15
- Perform a fast Fourier transform of a vector. Preserves types given by the
16
- user.
17
-
18
- # Arguments
19
- x::AbstractVector: The vector to transform.
20
-
21
- # Examples
22
- ```julia
23
- julia> x = rand(ComplexF64, 10)
24
-
25
- julia> y = fft(x)
26
- ```
27
- """
28
- function fft(x::AbstractVector{T}) where {T}
29
- y = similar(x)
30
- g = CallGraph{T}(length(x))
31
- fft!(y, x, 1, 1, FFT_FORWARD, g[1].type, g, 1)
32
- y
33
- end
34
-
35
- function fft(x::AbstractVector{T}) where {T <: Real}
36
- y = similar(x, Complex{T})
37
- g = CallGraph{Complex{T}}(length(x))
38
- fft!(y, x, 1, 1, FFT_FORWARD, g[1].type, g, 1)
39
- y
40
- end
41
-
42
- """
43
- $(TYPEDSIGNATURES)
44
- Perform a fast Fourier transform of a matrix. Preserves types given by the
45
- user.
46
-
47
- # Arguments
48
- x::AbstractMatrix: The matrix to transform (columnwise then rowwise).
49
-
50
- # Examples
51
- ```julia
52
- julia> x = rand(ComplexF64, 10, 10)
53
-
54
- julia> y = fft(x)
55
- ```
56
- """
57
- function fft(x::AbstractMatrix{T}) where {T}
58
- M,N = size(x)
59
- y1 = similar(x)
60
- y2 = similar(x)
61
- g1 = CallGraph{T}(size(x,1))
62
- g2 = CallGraph{T}(size(x,2))
63
-
64
- for k in 1:N
65
- @views fft!(y1[:,k], x[:,k], 1, 1, FFT_FORWARD, g1[1].type, g1, 1)
66
- end
67
-
68
- for k in 1:M
69
- @views fft!(y2[k,:], y1[k,:], 1, 1, FFT_FORWARD, g2[1].type, g2, 1)
70
- end
71
- y2
72
- end
73
-
74
13
function fft(x::AbstractMatrix{T}) where {T <: Real}
75
14
M,N = size(x)
76
15
y1 = similar(x, Complex{T})
@@ -88,79 +27,13 @@ function fft(x::AbstractMatrix{T}) where {T <: Real}
88
27
y2
89
28
end
90
29
91
- """
92
- $(TYPEDSIGNATURES)
93
- Perform a backward fast Fourier transform of a vector, where "backward"
94
- indicates the same output signal down to a constant factor. Preserves types
95
- given by the user.
96
-
97
- # Arguments
98
- x::AbstractVector: The vector to transform
99
-
100
- # Examples
101
- ```julia
102
- julia> x = rand(ComplexF64, 10)
103
-
104
- julia> y = bfft(x)
105
-
106
- julia> z = fft(y)
107
-
108
- julia> x ≈ z/10
109
- true
110
- ```
111
- """
112
- function bfft(x::AbstractVector{T}) where {T}
113
- y = similar(x)
114
- g = CallGraph{T}(length(x))
115
- fft!(y, x, 1, 1, FFT_BACKWARD, g[1].type, g, 1)
116
- y
117
- end
118
-
119
30
function bfft(x::AbstractVector{T}) where {T <: Real}
120
31
y = similar(x, Complex{T})
121
32
g = CallGraph{Complex{T}}(length(x))
122
33
fft!(y, x, 1, 1, FFT_BACKWARD, g[1].type, g, 1)
123
34
y
124
35
end
125
36
126
- """
127
- $(TYPEDSIGNATURES)
128
- Perform a backward fast Fourier transform of a matrix, where "backward"
129
- indicates the same output signal down to a constant factor. Preserves types
130
- given by the user.
131
-
132
- # Arguments
133
- x::AbstractMatrix: The matrix to transform
134
-
135
- # Examples
136
- ```julia
137
- julia> x = rand(ComplexF64, 10, 10)
138
-
139
- julia> y = bfft(x)
140
-
141
- julia> z = fft(y)
142
-
143
- julia> x ≈ z/100
144
- true
145
- ```
146
- """
147
- function bfft(x::AbstractMatrix{T}) where {T}
148
- M,N = size(x)
149
- y1 = similar(x)
150
- y2 = similar(x)
151
- g1 = CallGraph{T}(size(x,1))
152
- g2 = CallGraph{T}(size(x,2))
153
-
154
- for k in 1:N
155
- @views fft!(y1[:,k], x[:,k], 1, 1, FFT_BACKWARD, g1[1].type, g1, 1)
156
- end
157
-
158
- for k in 1:M
159
- @views fft!(y2[k,:], y1[k,:], 1, 1, FFT_BACKWARD, g2[1].type, g2, 1)
160
- end
161
- y2
162
- end
163
-
164
37
function bfft(x::AbstractMatrix{T}) where {T <: Real}
165
38
M,N = size(x)
166
39
y1 = similar(x, Complex{T})
0 commit comments