Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/FFTA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ include("callgraph.jl")
include("algos.jl")
include("plan.jl")

function __init__()
activate!()
end

end
14 changes: 10 additions & 4 deletions src/plan.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Base: *
import LinearAlgebra: mul!

export FFTABackend
struct FFTABackend <: AbstractFFTBackend end
backend() = FFTABackend()
activate!() = AbstractFFTs.set_active_backend!(FFTA)


abstract type FFTAPlan{T,N} <: Plan{T} end

struct FFTAInvPlan{T,N} <: FFTAPlan{T,N} end
Expand All @@ -20,7 +26,7 @@ struct FFTAPlan_re{T,N} <: FFTAPlan{T,N}
flen::Int
end

function AbstractFFTs.plan_fft(x::AbstractArray{T}, region; kwargs...)::FFTAPlan_cx{T} where {T <: Complex}
function AbstractFFTs.plan_fft(::FFTABackend, x::AbstractArray{T}, region; kwargs...)::FFTAPlan_cx{T} where {T <: Complex}
N = length(region)
@assert N <= 2 "Only supports vectors and matrices"
if N == 1
Expand All @@ -36,7 +42,7 @@ function AbstractFFTs.plan_fft(x::AbstractArray{T}, region; kwargs...)::FFTAPlan
end
end

function AbstractFFTs.plan_bfft(x::AbstractArray{T}, region; kwargs...)::FFTAPlan_cx{T} where {T <: Complex}
function AbstractFFTs.plan_bfft(::FFTABackend, x::AbstractArray{T}, region; kwargs...)::FFTAPlan_cx{T} where {T <: Complex}
N = length(region)
@assert N <= 2 "Only supports vectors and matrices"
if N == 1
Expand All @@ -52,7 +58,7 @@ function AbstractFFTs.plan_bfft(x::AbstractArray{T}, region; kwargs...)::FFTAPla
end
end

function AbstractFFTs.plan_rfft(x::AbstractArray{T}, region; kwargs...)::FFTAPlan_re{Complex{T}} where {T <: Real}
function AbstractFFTs.plan_rfft(::FFTABackend, x::AbstractArray{T}, region; kwargs...)::FFTAPlan_re{Complex{T}} where {T <: Real}
N = length(region)
@assert N <= 2 "Only supports vectors and matrices"
if N == 1
Expand All @@ -68,7 +74,7 @@ function AbstractFFTs.plan_rfft(x::AbstractArray{T}, region; kwargs...)::FFTAPla
end
end

function AbstractFFTs.plan_brfft(x::AbstractArray{T}, len, region; kwargs...)::FFTAPlan_re{T} where {T}
function AbstractFFTs.plan_brfft(::FFTABackend, x::AbstractArray{T}, len, region; kwargs...)::FFTAPlan_re{T} where {T}
N = length(region)
@assert N <= 2 "Only supports vectors and matrices"
if N == 1
Expand Down
Loading