Full reference of implemented functions
GFFT.gfft_data
— Typegfft_data{FType, TI<:Integer, TF<:Real}
Container for gfft!-data that makes repeated application fast.
Fields
method::Symbol
: The method to use for the FFT (e.g., :fft or :ifft).sgn::TI
: The sign used in the expression ĥ(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x).N::TI
: The length of the FFT-array (the full array is N+1).Nh::TI
: The index of the middle of the array (non-padded).Nr::TI
: The length of the array with padding.Nrh::TI
: The index of the middle of the array with padding.r::TI
: The padding ratio.a::TF
: The lower boundary of the integral ∫ₐ.b::TF
: The upper boundary of the integral ∫ᵇ.dx::TF
: The discretization spacing of data to be transformed, calculated as (b - a) / N.x::Vector{Float64}
: An array of data values, representing either time (t) or frequency (w).ea::Vector{ComplexF64}
: Corrective phase factors for the lower boundary.eb::Vector{ComplexF64}
: Corrective phase factors for the upper boundary.Mfft::FType
: The "Matrix" that applies the FFT or IFFT operation.pad_container::Vector{ComplexF64}
: A container for the padded array.W::Vector{Float64}
: Attenuation factors used for Spline-FFT.A::Matrix{ComplexF64}
: Boundary corrections for Spline-FFT.
GFFT.gfft_data
— Methodgfft_data(sgn; N, r, a, b, method)
Constructor for gfft_data struct, that contains FFT-data. sgn
describes which transform is caluclated.
Numerically calculate ĥ(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x)
for many values of y. The resulting argument-array y of a FFT is: input ∈ [a, b] -> output = 2π/(r * (b-a)) * fftshift(-N*r/2, ..., N*r/2-1)
Arguments
sgn::Integer:
sgn = ±1+1: fft [f(t) -> f̂(ω)] and -1: ifft [f̂(ω) -> f(t)]
N::Integer:
Length of initial-data to perform the FFT on (Array is N+1)r::Integer:
Pading ratio (sinc(x) interpolation of the initial-data)a, b::Float64:
Lower and upper bound of x-array (No fftshift!)method{:spl3 (default), :trap, :riem}:
Method used for the FFTeps::Float64:
Crossover value, at which we switch between the analytical expression and the Taylor expansionreturn:
gfft_data struct
GFFT.FFTWeights
— MethodFFTWeights(x::Vector{<:AbstractFloat}, delta::Real; eps::Real=5.0e-2)
Generate W and A for the cubic spline-FFT. See numerical-recipies for definition of coeffs (http://numerical.recipes/book.html).
Arguments
eps::Float64
denotes the crossover value, at which we switch between the analytical expression and the Taylor expansion (default experimentally found to optimze error)return:
W, A where A[:, i] is the i-th boundary correction
GFFT.fftshift_odd!
— Methodfftshift_odd!(x::AbstractArray)
Inplace FFT-shift of x
(odd-array) which has index-structure [fftshift(-N/2:1:N/2-1); N/2]
.
These arrays apear e.g. when using the gfft
for the iterative solution. This function still allocates, but modifies the underlying x.
GFFT.fftshift_odd
— Methodfftshift_odd(x::AbstractArray)
Copy FFT-shift of x
(odd-array) which has index-structure [fftshift(-N/2:1:N/2-1); N/2]
, i.e. while keeping the last index fixed.
GFFT.gfft!
— Methodgfft!(hy, hx; param::gfft_data, kwargs...)
gfft!(sgn, hy, hx; a, b, r, kwargs...)
Numerically calculate $ĥ(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x)$ for many values of y.
Resulting y(=t, ω) vectors will have the form $x ∈ [a, b] -> y = 2π/(r * (b-a)) * (-N*r/2, ..., N*r/2)$ (Assuming Isort=true
).
Note: Isort, Osort decides wether input/output are ordered or in the "FFT-ordering" (0, ..., x_{N/2-1}, x_{-N/2}, ..., x_{-1}, x_{N/2})
`
Arguments
In iterative version (provides gfft_data) only:
sgn::Int:
sgn = ±1 in $h(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x)$ (+1: fft (t->ω) and -1: ifft (ω->t))param::gfft_data
Struct generated with gfft_data
In standalone-version only:
r:
Pading ratio (sinc(x) interpolation of the data)a, b:
Lower and upper bound of w array (No fftshift!)
General:
hx:
h(x)-data (x=a+dx*j with j=0,...,N or FFT-ordering)(len=N+1)
hy:
ĥ(y) containerIsort/Osort:
If true, Input/Output in physical ordering. -boundary{:nearest (default), :spl3, :matsubara}:
Decide method for extrapolation.:nearest
approximatesh(N/2)≈h(N/2-1)
while:spl3
uses k=3 extrapolation. Matsubara uses:spl3
for the final point (different because of ordering)method{:spl3, :trap, :riem}:
Method to use for calculating FT
(usually set when generating gfft_data).
return:
nothing
GFFT.gfft
— Methodgfft(sgn, hx; a, b, r=1, kwargs...)
Numerically calculate $ĥ(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x)$ for many values of y. Allocates new array for hy-output. Returns Vector of FFT.
Resulting y(=t, ω) vectors will have the form $x ∈ [a, b] -> y = 2π/(r * (b-a)) * (-N*r/2, ..., N*r/2)$ (Assuming Isort=true
).
Note: Isort, Osort decides wether input/output are ordered or in the "FFT-ordering" (0, ..., x_{N/2-1}, x_{-N/2}, ..., x_{-1}, x_{N/2})
`
Arguments
In iterative version (provides gfft_data) only:
sgn::Int:
sgn = ±1 in $h(y) = ∫ₐᵇ dx exp(sgn⋅ixy)h(x)$ (+1: fft (t->ω) and -1: ifft (ω->t))r:
Pading ratio (sinc(x) interpolation of the data)a, b:
Lower and upper bound of w array (No fftshift!)hx:
h(x)-data (x=a+dx*j with j=0,...,N or FFT-ordering)(len=N+1)
Isort/Osort:
If true, Input/Output in physical ordering. -boundary{:nearest (default), :spl3, :matsubara}:
Decide method for extrapolation.:nearest
approximatesh(N/2)≈h(N/2-1)
while:spl3
uses k=3 extrapolation. Matsubara uses:spl3
for the final point (different because of ordering)method{:spl3, :trap, :riem}:
Method to use for calculating FT
(usually set when generating gfft_data).
return:
nothing
GFFT.gfftCorr!
— MethodgfftCorr!(sgn, hy, endpts, param, Isort, method)
Apply corrections to hy, for cubic-spline fft (:spl3) or trapezoidal-fft (:trap)correction. If Isort=true
, one needs to multiply the data with ea
.
Arguments
endpts
: Array of the endpoints in input array (len=8 for :spl2)method{:spl3(default), :trap, :riem}:
Method endpoint correctionsreturn
: nothing