Skip to content

Commit

Permalink
Add range inferrence
Browse files Browse the repository at this point in the history
  • Loading branch information
nHackel committed Sep 7, 2024
1 parent d4d8caf commit 43c1fe6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions AbstractNFFTs/src/derived.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ for op in [:nfft, :nfct, :nfst]
planfunc = Symbol("plan_"*"$op")
@eval begin

# The following automatically call the plan_* version for type Array
# The following try to find a plan function with the correct array type parameters

$(planfunc)(k::arrT, N::Union{Integer,NTuple{D,Int}}, args...; kargs...) where {D, arrT <: AbstractArray} =
$(planfunc)(strip_type_parameters(arrT), k, N, args...; kargs...)

$(planfunc)(k::arrT, y::AbstractArray, args...; kargs...) where {arrT <: AbstractArray} =
$(planfunc)(strip_type_parameters(arrT), k, y, args...; kargs...)
$(planfunc)(k::arrT, args...; kargs...) where {arrT <: AbstractArray} =
$(planfunc)(strip_type_parameters(arrT), k, args...; kargs...)

$(planfunc)(k::arrL, args...; kargs...) where {T, arrT <: AbstractArray{T}, arrL <: Union{Adjoint{T, arrT}, Transpose{T, arrT}}} =
$(planfunc)(strip_type_parameters(arrT), k, y, args...; kargs...)

$(planfunc)(k::AbstractRange, args...; kargs...) = $(planfunc)(collect(k), args...; kargs...)

# The follow convert 1D parameters into the format required by the plan

$(planfunc)(Q::Type, k::AbstractVector, N::Integer, rest...; kwargs...) =
Expand Down

0 comments on commit 43c1fe6

Please sign in to comment.