
Nonequispaced Fast Fourier Transform (NFFT) Interface for Julia Michael Schmischke∗ This report describes the newly added Julia interface to the NFFT3 library. We explain the multidimensional NFFT algorithm and basics of the interface. Furthermore, we go into detail about the different parameters and how to adjust them properly. Keywords and phrases : Julia, NFFT, NUFFT, nonequispaced fast Fourier trans- form, FFT, fast Fourier transform 2010 AMS Mathematics Subject Classification : 65T 42B05 1 Introduction The nonequispaced fast Fourier transform [4] (NFFT or NUFFT) overcomes one of the main shortcomings of the FFT - the need for an equispaced sampling grid. Considering a d- dimensional trigonometric polynomial −2πikx f(x) := fˆke (1.1) k X∈IN N N N Zd i i Nd with an index set I := {k ∈ : − 2 ≤ ki ≤ 2 − 1, i = 0,...,d − 1} where N ∈ 2 is d the multibandlimit, the NDFT is its evaluation at M ∈ N nonequispaced points xj ∈ T for j = 0, 1,...,M, arXiv:1810.09891v1 [cs.MS] 23 Oct 2018 −2πik·xj f(xj)= fˆke , (1.2) k X∈IN with given coefficients fˆk ∈ C where we identify the smooth manifold of the torus T with [−1/2, 1/2). The NFFT is an algorithm for the fast evaluation of the sums (1.2) and the adjoint problem, the fast evaluation of M−1 2πikxj hˆk = fje , k ∈ IN (1.3) Xj=0 1Technische Universität Chemnitz, Faculty of Mathematics, 09107 Chemnitz, Germany [email protected] 1 for given coefficients fj ∈ C. The available NFFT3 library [3] provides C routines for the NFFT, applications such as the fast evaluation of sums N g(yj) := αkK(kyj − xkk2), j = 1,...,M (1.4) Xk=1 C Rd for given coefficients αk ∈ , nodes xk, yj ∈ and a radial kernel function K : [0, ∞) → [0, ∞), and generalizations such as the NNFFT for nonequispaced nodes in time and fre- quency domain. The major NFFT3 release included interfaces for the numerical computing environments MATLAB and OCTAVE, expanding the user base. In the past years, a new dynamic programming language called Julia, see [1], caught interest in the field of numerical computing. The language is designed around the idea of high per- formance and flexibility with a lot of available packages for different purposes. The growing community around Julia has led to the idea of further expanding the NFFT3’s user base by adding a corresponding interface to the library. After discussing the basic idea of the NFFT in Section 2, we go into detail on the interface in Section 3 starting with a manual on usage and parameters. Furthermore, we discuss the basic structure and Julia functions used. Section 4 contains multiple examples. 2 2 NFFT Algorithm In this section, we give a brief description of the NFFT algorithm based on [5] and [7, Chapter 7]. This will be the basis for the explanation of parameter choices later on. We consider the evaluation of the d-dimensional trigonometric polynomial d −2πik·x f : T → C, x 7→ fˆke (2.1) k X∈IN with multibandlimit N ∈ 2Nd and index set d IN := {k ∈ Z : −Ni/2 ≤ ki ≤ Ni/2 − 1 ∀i ∈ {1, 2,...,d}}. (2.2) The first approximation is a linear combination of a shifted periodized window function ϕ˜ 1 s1(x)= gℓϕ˜ x − ⊙ ℓ (2.3) ℓ n X∈In 1 where n is the elementwise inversion of the vector n. We choose an oversampling vector σ > 1 componentwise and obtain the index set by n := σ ⊙ N. (2.4) Here, ⊙ denotes the componentwise product. Note that one could skip the choice of σ entirely and directly choose ni > Ni for i = 1, 2,...,d. The standard choice in the C library is at the moment ⌈log2 Ni⌉+1 ni = 2 , i = 1, 2,...,d. If the window function ϕ : Rd → R has a one-periodization ϕ˜(x)= ϕ(x + r) (2.5) r Zd X∈ with a uniformly convergent Fourier series, we use the Poisson summation formula and obtain the Fourier coefficients ck(ϕ ˜) =ϕ ˆ(k). (2.6) Here, ϕˆ is the Fourier transform of ϕ defined by k x ϕˆ(k)= ϕ(x)e−2πi · dx. (2.7) Td Z Replacing ϕ˜ by its Fourier series and splitting the sum in (2.3) yields k x 1 ℓ −2πi ·( − n ⊙ ) s1(x)= gℓ ck(ϕ ˜)e ℓ n k Zd X∈I X∈ 1 2πi ⊙(k·ℓ) −2πik·x = ck(ϕ ˜) gℓe n e k Zd ℓ X∈ X∈In =:gˆk −2πik·x −2πi(k+n⊙r)·x = ck(ϕ ˜)ˆg|ke {z+ } ck(ϕ ˜)ˆgke . (2.8) k r Zd 0 k X∈In ∈X\{ } X∈In 3 Furthermore, a comparison of (2.8) and (2.1) suggests the choice fˆk for k ∈ IN gˆk = ck(ϕ ˜) . (2.9) (0 for k ∈ In \ IN Now, we are able to compute gℓ by an FFT of size n1 × n2 ×···× nd. The error of the first approximation f ≈ s1 is called aliasing error. For further analysis, we refer to [7, Chapter 7]. We obtain an approximation ψ for ϕ if the window function is well localized in the spatial domain by the truncation ψ(x) := ϕ(x)1 d (x) (2.10) ×i=1[−m/ni,m/ni] N with a chosen window size m ≪ mini∈{1,2,...,d}{ni},m ∈ . Following the same scheme as above, we can use the periodization ψ˜(x)= ψ(x + r) r Zd X∈ and look at the linear combination 1 s(xj) := gℓψ˜ xj − ⊙ ℓ . (2.11) ℓ n X∈In The following calculations show that s ≈ s1 1 s(x )= gℓ ψ x − ⊙ ℓ + r j j n ℓ r Zd X∈In X∈ 1 = gℓ ϕ xj − ⊙ ℓ + r 1 d (xj) n ×i=1[−m/ni,m/ni] ℓ r Zd X∈In X∈ 1 = gℓ1 d (xj)ϕ ˜ xj − ⊙ ℓ ×i=1[−m/ni,m/ni] n ℓX∈In 1 = gℓϕ˜ x − ⊙ ℓ (2.12) j n ℓ x ∈InX,m( j ) with the index set In,m(xj)= {ℓ ∈ In : n ⊙ xj − m1 ≤ ℓ ≤ n ⊙ xj + m1} (2.13) for a fixed node xj. This is motivated by m m − ≤ (xj)i ≤ ni ni in order to ensure that xj is within the support. This second approximation error is called the truncation error. Summarizing, we have f ≈ s1 ≈ s. This covers the basic idea of the algorithm, which is given in pseudo-code in Algorithm 2.1. Using the transposed index set ⊤ 1 1 In,m(ℓ)= {j = 0, 1,...,M − 1 : ℓ − m ≤ n ⊙ xj ≤ ℓ + m }, (2.14) 4 Algorithm 2.1 Nonequispaced fast Fourier transform (NFFT) Input: d ∈ N dimension N ∈ 2Nd degree of polynomial M ∈ N number of nodes d xj ∈ T , j = 0,...,M − 1 nodes fˆk ∈ C, k ∈ IN Fourier coefficients 1: for k ∈ IN do 2: gˆk ← |In|−1 · fˆk/ck(ϕ ˜) 3: end for 4: for ℓ ∈ In do 1 −2πik· ⊙ℓ ℓ k ( n ) ⊳ 5: gˆ ← k∈IN gˆ e d-variate FFT 6: end for P 7: for j = 0, 1,...,M − 1 do 1 8: ℓ x ℓ fj ← ℓ∈In,m(xj ) g ϕ˜ j − n ⊙ 9: end for P Output: fj ∈ C, j = 0, 1,...,M − 1 approximate function values Arithmetic cost: |IN | + |In| log |In| + 2(2m + 1)dM + eval. of window function Algorithm 2.2 Adjoint nonequispaced fast Fourier transform (NFFT) Input: d ∈ N dimension N ∈ 2Nd degree of polynomial M ∈ N number of nodes d xj ∈ T , j = 0,...,M − 1 nodes fˆk ∈ C, k ∈ IN Fourier coefficients 1: for ℓ ∈ In do 1 2: gℓ ← ⊤ ℓ f ϕ˜ x − ⊙ ℓ jℓ∈In,m( ) j j n 3: end for P 4: for k ∈ IN do k 1 ℓ 2πi ·( n ⊙ ) ⊳ 5: gˆk ← ℓ∈In gˆℓe d-variate inverse FFT 6: end for P 7: for k ∈ IN do 8: hˆk ← |In|−1 · gˆk/ck(ϕ ˜) 9: end for Output: hˆk ∈ C, k ∈ IN approximate coefficients Arithmetic cost: |IN | + |In| log |In| + 2(2m + 1)dM + eval. of window function we obtain the adjoint NFFT algorithm, given in pseudo-code in Algorithm 2.2. Further information regarding specific window functions with error bounds and applications is given in [7, Chapter 7.2]. 5 We consider the relative errors kf − f˜k2 E2 := (2.15) kfk2 kf − f˜k∞ E∞ := (2.16) kfˆk1 M−1 ˜ M−1 ˆ ˆ with f = (f(xj))j=0 , f = (s(xj))j=0 and f = (fk)k∈IN in order to check the quality of the approximation with fixed polynomial f. Furthermore, we want to note that the NFFT can be parallelized which is realized through OpenMP in the NFFT3 library, see [9]. 6 3 Documentation and Notes on Implementation In this section, we go into detail about the usage of the interface. Specifically, we explain the parameter choices and how they may impact computation times and accuracy of the results. Furthermore, Section 3.2 contains a brief introduction to the basics of the implementation. 3.1 Usage and Parameters The NFFT plan structure is the core of the NFFT Julia interface and has the parameters listed in Table 3.1. We go into detail about every parameter, its standard choice and how to tweak it for more speed or accuracy. parameter Julia type description N ∈ 2Nd NTuple{D,Int32} degree of polynomial f given in (2.1) d M ∈ N Int32 number of nodes xj ∈ T d n ∈ 2N NTuple{D,Int32} ni > Ni FFT length m ∈ N Int32 window size f1 ∈ N UInt32 NFFT flags f2 ∈ N UInt32 FFTW flags Table 3.1: Fields of the NFFT structure.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages19 Page
-
File Size-