## 3 Numerical Implementation
### Numerical Implementation of the D-Bar Algorithm
 \tag{15}\]  
The periodic version of \(\mathbf{G}_{\partial}\) is denoted as \(\widetilde{\mathbf{G}}_{\partial}\) and calculated through \(\widetilde{\mathbf{G}}_{\partial}(k)=\mathbf{G}_{\partial}(k)\odot\eta(k)\), where \(\odot\) denotes the elementwise multiplication (\"...\"--operation in Matlab(r)). Now that the periodic version of Equation (13) \(\widetilde{\mathbf{G}}_{\partial}(k)\) is calculated, the other known part of Equation (11) \(T(k,z)\) needs to be evaluated. Note that \(K\) is a subset of the larger grid \(\mathbf{Q}\). For every grid point of \(\mathbf{Q}\), \(T(k,z)=\frac{t(k)}{4\pi k}e_{-z}(k)\) is evaluated. Note that we still write \(T(k,z)\) rather than using \(Q\). This is because \(T(k,z)\) is only different from \(0\) inside the truncation radius. Thus, we use \(K\) for the computation and just pad the border with \(0\) to make the dimensions compatible with the rest of the operations on \(\mathbf{Q}\). This can be performed through the Matlab(r) function _padarray_. As explained earlier, this step (step 3) has to be repeated for every position z, where we want to know the conductivity. Thus, there is a small gain to make by computing the first part of \(T(k,z)\) (\(T_{first}(k)=\frac{t(k)}{4\pi k}\)) beforehand and saving it to memory. Now, the FFT trick from [PERSON] can be applied on Equation (11) using the fast Fourier transform, through  
\[\mathbf{\mu} = \mathbf{I}+h^{2}IFFT(FFT(\widetilde{\mathbf{G}}_{\mathbf{\bar{q}}})\odot FFT(T \overline{\mathbf{\mu}})) \tag{16}\] \[\leftrightarrow\] \[\mathbf{I} = \mathbf{I}\mathbf{\mu}-P(\mathbf{T}\overline{\mathbf{\mu}})\] (17) \[with\] \[P(\mathbf{T}\overline{\mathbf{\mu}}) = h^{2}IFFT(FFT(\widetilde{\mathbf{G}}_{\mathbf{\bar{q}}})\odot FFT(\mathbf{ T}\overline{\mathbf{\mu}})), \tag{18}\]  
where \(h\) is the spacing of the grid \(\mathbf{K}\), \(\mathbf{I}\) is the identity matrix, and \(\odot\) denotes the elementwise multiplication similar to that in Equation (7). This equation can be solved with the help of a matrix-free equation solver such as GMRES, as the function cannot be brought to the simple \(Ax=b\) form. This is due to the fact that Equation (17) has a complex conjugate of \(\mathbf{\mu}\) in it. Thus, the equation is only linear in its real part. When using GMRES, the real and imaginary parts must be detached from one another. This can be achieved by transforming \(\mathbf{\mu}\) from its matrix form to its vector form and separating the imaginary part and the real part. The complex matrix \(\mathbf{\mu}\) with dimensions \(\mathbb{C}^{H\times H}\) will become a vector of dimension \(\mathbb{R}^{(2\cdot H^{2})}\), and the vector representation is expressed as \(\vec{\mu}\). The first \(M^{2}\) entries are the real components of \(\mathbf{\mu}\), while the last \(M^{2}\) are its imaginary components. The mapping from the vector form to the matrix form is denoted as _vecmat_. This procedure is also described in [28]. A normal GMRES call in Matlab(r) to solve \(Ax=b\) would result in _gmres(\(A\), \(b\))_. This call must be modified. Instead of a matrix \(A\), a function \(f\) is given to _gmres()_. The function has two tasks; firstly, it converts \(\vec{\mu}\) from its vector to the matrix representation \(\mathbf{\mu}\) (_vecmat_); secondly, it calculates the first step inside the GMRES loop, which is called the \"Krylov vector\". The calculation is given by  
\[q_{new}=q_{old}-vecmat(P(\mathbf{T}\overline{q_{old}})), \tag{19}\]  
where \(q\) is the \"Krylov vector\" from the GMRES method. For more details about GMRES, see [31]. **Step 4**: Calculation of the conductivity. This is performed through \(\sigma(z)=\mu^{2}(k\to 0,z)\). This can be understood when observing Equation (22). \(\Psi(k,z)=\mu(k,z)\) holds true for \(k=0\), then the equation becomes \((-\Delta\,+\,\sigma^{-1/2}\Delta\sigma^{1/2})\mu(k,z)\,=\,0\).