Skip to content

Commit

Permalink
Relax type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobAsslaender committed Nov 23, 2023
1 parent 69476dc commit 8e25b61
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/NFFTNormalOpBasisFunc.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function calculateToeplitzKernelBasis(img_shape_os, trj::Vector{Matrix{T}}, U::Matrix{Complex{T}}; verbose = false) where {T}
function calculateToeplitzKernelBasis(img_shape_os, trj::AbstractVector{<:AbstractMatrix{T}}, U::AbstractMatrix{Tc}; verbose = false) where {T, Tc <: Union{T, Complex{T}}}

kmask_indcs = calculate_kmask_indcs(img_shape_os, trj)
@assert all(kmask_indcs .> 0) # ensure that kmask is not out of bound
Expand Down Expand Up @@ -59,13 +59,13 @@ end

function NFFTNormalOpBasisFunc(
img_shape,
trj::Vector{Matrix{T}},
U::Matrix{Complex{T}};
trj::AbstractVector{<:AbstractMatrix{T}},
U::AbstractMatrix{Tc};
cmaps = (1,),
verbose = false,
Λ_kmask_indcs = calculateToeplitzKernelBasis(2 .* img_shape, trj, U; verbose = verbose),
num_fft_threads = round(Int, Threads.nthreads()/size(U, 2))
) where {T}
) where {T, Tc <: Union{T, Complex{T}}}

Λ, kmask_indcs = Λ_kmask_indcs
@assert length(kmask_indcs) == size(Λ,3) # ensure that kmask is not out of bound as we use `@inbounds` in `mul!`
Expand Down Expand Up @@ -152,13 +152,13 @@ end

function NFFTNormalOpBasisFuncLO(
img_shape,
trj::Vector{Matrix{T}},
U::Matrix{Complex{T}};
trj::AbstractVector{<:AbstractMatrix{T}},
U::AbstractMatrix{Tc};
cmaps = (1,),
verbose = false,
Λ_kmask_indcs = calculateToeplitzKernelBasis(2 .* img_shape, trj, U; verbose = verbose),
num_fft_threads = round(Int, Threads.nthreads()/size(U, 2))
) where {T}
) where {T, Tc <: Union{T, Complex{T}}}

S = NFFTNormalOpBasisFunc(img_shape, trj, U; cmaps = cmaps, Λ_kmask_indcs = Λ_kmask_indcs, num_fft_threads = num_fft_threads)
return NFFTNormalOpBasisFuncLO(S)
Expand All @@ -170,7 +170,7 @@ end
## ##########################################################################
# Internal helper functions
#############################################################################
function calculate_kmask_indcs(img_shape_os, trj::Vector{Matrix{T}}) where T
function calculate_kmask_indcs(img_shape_os, trj::AbstractVector{<:AbstractMatrix{T}}) where T
nfftplan = plan_nfft(reduce(hcat, trj), img_shape_os; precompute = POLYNOMIAL, blocking = false, fftflags = FFTW.MEASURE, m=5, σ=1)

convolve_transpose!(nfftplan, ones(Complex{T}, size(nfftplan)[1]), nfftplan.tmpVec)
Expand Down

0 comments on commit 8e25b61

Please sign in to comment.