1-
21function nufft1_plan {T<:AbstractFloat} ( x:: AbstractVector{T} , ϵ:: T )
32(s_vec, t_idx, gam) = FindAlgorithmicParameters ( x )
43K = FindK (gam, ϵ)
@@ -15,19 +14,19 @@ In = speye(eltype(c), N, N)
1514p ( c ) = (v.* (N* conj (ifft (In[:,t_idx]* conj (Diagonal (c)* u),1 ))))* ones (K)
1615end
1716
17+
18+ nufft_plan {T<:AbstractFloat} ( x:: AbstractVectorP{T} , ϵ:: T ) = nufft1_plan ( x, ϵ )
19+ nufft {T<:AbstractFloat} ( c:: AbstractVector , x:: AbstractVector{T} , ϵ:: T ) = nufft_plan (x, ϵ)(c)
1820nufft1 {T<:AbstractFloat} ( c:: AbstractVector , x:: AbstractVector{T} , ϵ:: T ) = nufft1_plan (x, ϵ)(c)
1921nufft2 {T<:AbstractFloat} ( c:: AbstractVector , ω:: AbstractVector{T} , ϵ:: T ) = nufft2_plan (ω, ϵ)(c)
20- nuftt3 {T<:AbstractFloat} ( c:: AbstractVector , x:: AbstractVector{T} , ω:: AbstractVector{T} , ϵ:: T ) = nufft3_plan (x, ω, ϵ)(c)
2122
2223FindK {T<:AbstractFloat} (γ:: T , ϵ:: T ) = Int ( ceil (5.0 * γ.* exp (lambertw (log (10.0 / ϵ)./ γ/ 7.0 ))) )
2324
2425function FindAlgorithmicParameters {T<:AbstractFloat} ( x:: AbstractVector{T} )
25-
2626N = size (x, 1 )
2727s_vec = round (N* x)
2828t_idx = mod (round (Int64, N* x), N) + 1
2929γ = norm (N* x - s_vec, Inf )
30-
3130return (s_vec, t_idx, γ)
3231end
3332
@@ -39,14 +38,11 @@ N = size(x, 1)
3938(s_vec, t_idx, γ) = FindAlgorithmicParameters ( x )
4039er = N* x - s_vec
4140scl = exp ( - 1im * pi * er )
42-
4341# Chebyshev polynomials of degree 0,...,K-1 evaluated at er/gam:
4442TT = Diagonal (scl)* ChebyshevP (K- 1 , er/ γ)
45-
4643# Chebyshev expansion coefficients:
4744cfs = Bessel_coeffs (K, γ)
4845u = zeros (eltype (cfs), N, K)
49-
5046# Construct them now:
5147for r = 0 : K- 1
5248 for j = 1 : N
@@ -56,19 +52,15 @@ for r = 0:K-1
5652 end
5753 end
5854end
59-
6055# rowspace vectors:
6156v = ChebyshevP (K- 1 , 2.0 * collect (0 : N- 1 )/ N - ones (N) )
62-
6357return (u, v)
6458end
6559
66-
6760function Bessel_coeffs (K:: Int64 , γ:: Float64 )
6861# Calculate the Chebyshev coefficients of exp(-2*pi*1im*x*y) on [-gam,gam]x[0,1]
6962
7063cfs = complex (zeros ( K, K ))
71-
7264arg = - γ* pi / 2
7365for p = 0 : K- 1
7466 for q = mod (p,2 ): 2 : K- 1
@@ -77,37 +69,30 @@ for p = 0:K-1
7769end
7870cfs[1 ,:] = cfs[1 ,:]/ 2.0
7971cfs[:,1 ] = cfs[:,1 ]/ 2.0
80-
8172return cfs
82-
8373end
8474
85-
8675function ChebyshevP {T<:AbstractFloat} (n:: Int64 , x:: AbstractVector{T} )
8776# Evaluate Chebyshev polynomials of degree 0,...,n at x:
8877
8978N = size (x,1 )
9079Tcheb = zeros (eltype (x), N, n+ 1 )
91-
9280# T_0(x) = 1.0
9381for j = 1 : N
9482 Tcheb[j, 1 ] = 1.0
9583end
96-
9784# T_1(x) = x
9885for k = 2 : min (n+ 1 ,2 )
9986 for j = 1 : N
10087 Tcheb[j, 2 ] = x[j]
10188 end
10289end
103-
10490# 3-term recurrence relation:
10591twoX = 2.0 * x
10692for k = 2 : n
10793 for j = 1 : N
10894 Tcheb[j, k+ 1 ] = twoX[j]* Tcheb[j, k] - Tcheb[j, k- 1 ]
10995 end
11096end
111-
11297return Tcheb
11398end
0 commit comments