## 3 Description of Numerical Algorithms
### Contour Integration Methods  
Contour integration methods find the eigenvalues of the pencil \(s\mathbf{E}-\mathbf{A}\) that are inside a given, user-defined domain of the complex plane. The method that was proposed by [PERSON] and [PERSON] [33] and its variants [34; 54], are the most characteristic examples of this class. Suppose that \(p\) distinct eigenvalues \(\lambda_{1},\lambda_{2},\ldots,\lambda_{p}\) are located inside positively oriented simple closed curve \(\Gamma\) in \(\mathbb{C}\). The contour integration method with Hankel matrices (CI-Hankel) applies a moment-based approach in order to reduce the problem of finding the \(p\) eigenvalues of \(s\mathbf{E}-\mathbf{A}\) to finding the eigenvalues of a \(p\times p\) matrix pencil. For a non-zero vector \(\mathbf{b}\), consider the moments:  
\[\mu_{k}=\frac{1}{2\pi i}\int_{\Gamma}(s-\gamma)^{k}(\mathbf{E}\,\mathbf{b})^{ \intercal}(s\mathbf{E}-\mathbf{A})^{-1}\mathbf{E}\,\mathbf{b}\,ds\,, \tag{34}\]  
where \(k=0,1,\ldots,p-1\); \(\gamma\) is a user-defined point that lies in \(\Gamma\). A standard case is to define \(\Gamma\) as a circle with center \(\gamma\) and radius \(\rho\). The moments \(\mu_{k}\) are used to construct the \(p\times p\) Hankel matrices \(\mathbf{J}_{p}:=\left[\mu_{i+j-2}\right]_{i,j=1}^{p}\) and \(\mathbf{J}_{p}^{<}:=\left[\mu_{i+j-1}\right]_{i,j=1}^{p}\). Subsequently, the eigenvalues of the matrix pencil \(s\mathbf{J}_{p}^{<}-\mathbf{J}_{p}\) are given by \(\lambda_{1}-\gamma\), \(\lambda_{2}-\gamma\), \(\ldots\), \(\lambda_{p}-\gamma\). The corresponding eigenvectors are found through the contour integral:  
\[\boldsymbol{\psi}_{k}=\frac{1}{2\pi i}\int_{\Gamma}(s-\gamma)^{k}(s\mathbf{E} -\mathbf{A})^{-1}\mathbf{E}\,\mathbf{b}\,ds\;, \tag{35}\]  
where \(k=0,1,\ldots,p-1\). Given the eigenvectors associated to \(\lambda_{1}-\gamma\), \(\lambda_{2}-\gamma\), \(\ldots\), \(\lambda_{p}-\gamma\), the eigenvectors of \(s\mathbf{E}-\mathbf{A}\) are retrieved through a simple vector manipulation. In practice, integrals (34), (35) are approximated through a numerical integration technique. For example, the following approximations of (34), (35) are obtained while using the \(N\)-point trapezoidal rule when \(\Gamma\) is defined as the circle with center \(\gamma\) and radius \(\rho\):  
\[\mu_{k} \approx \frac{1}{N}\sum_{j=0}^{N-1}(w_{j}-\gamma)^{k+1}(\mathbf{E} \mathbf{b})^{\intercal}(w)\mathbf{E}-\mathbf{A})^{-1}\mathbf{E}\mathbf{b}\;, \tag{36}\] \[\boldsymbol{\psi}_{k} \approx \frac{1}{N}\sum_{j=0}^{N-1}(w_{j}-\gamma)^{k+1}(w_{j}\mathbf{E}- \mathbf{A})^{-1}\mathbf{E}\mathbf{b}\;, \tag{37}\]  
where \(k=0,1,\ldots,p-1\); \(w_{j}=\gamma+\rho\,\mathrm{e}^{(2\pi i/N)(j+1/2)}\), \(j=0,1,\ldots,N-1\). In order to compute (36), (37), the following linear systems need to be solved:  
\[(w_{j}\mathbf{E}-\mathbf{A})\mathbf{y}_{j}=\mathbf{E}\mathbf{b}\;,\;j=0,1, \ldots,N-1\;. \tag{38}\]  
Systems (38) are independent for each \(j\), and hence, they can be solved in parallel. A parallel implementation can significantly improve the computational efficiency, especially if the dimensions of \(\mathbf{A}\), \(\mathbf{E}\) are large. In the case that some eigenvalues in the defined region are very close, the accuracy of the CI-Hankel method decreases, as the associated Hankel matrices become ill-conditioned. An alternative approach is to use contour integration to construct a subspace that is associated to the eigenvalues in \(\Gamma\), and then extract the eigenpairs from such subspace while using the Rayleigh-Ritz procedure. The resulting method is the CI-RR (Contour Integration with Rayleigh-Ritz).