1 Introduction

We consider cosine sums of the form

$$ f(t) = \sum\limits_{j=1}^{M} \gamma_{j} \cos(\phi_{j} t), $$
(1.1)

where \(M \in {\mathbb N}\), \(\gamma _{j} \in {\mathbb R}\setminus \{ 0\}\), and the frequency parameters ϕj ∈ [0,K) (with K > 0) are pairwise distinct. We define a step size h with \(h=\frac {\pi }{K}\) and want to study the following reconstruction problems:

  1. 1.

    How to reconstruct a function f in a stable way from function values \(f_{k} = f(\frac {h(2k +1)}{2})\), k = 0,…,N − 1, N > 2M?

  2. 2.

    How to reconstruct a function f in a stable way from noisy function values \(y_{k} = f(\frac {h(2k +1)}{2})+ \epsilon _{k}\), k = 0,…,N − 1, N > 2M, where the noise vector \((\epsilon _{k})_{k=0}^{N-1}\) has a Gaussian or uniform distribution with mean value 0?

  3. 3.

    How to approximate some given even function (in the paper we consider an even Bessel function) by a short cosine sum in an efficient way?

The recovery of cosine sums from a finite set of possibly corrupted signal samples as well as the approximation with short cosine sums play an important role in many signal processing problems. Applications of sparse cosine sums can be found in sparse phase retrieval [1], and for exact approximation of Bessel functions [8]. Other applications concern the recovery of cosine sums that appear in optical models as measured spectral interferograms, as for example in optical coherence tomography [14].

The problem is closely related with the recovery of and approximation by sums of exponentials of the form \({\sum }_{j=1}^{2M} \gamma _{j} {\mathrm e}^{{\mathrm i} \phi _{j} t }\), which has been extensively studied within the last years, see e.g. [2, 10, 11, 19,20,21, 23, 26, 27, 29, 32, 34]. Moreover, there is a close connection to the question of extrapolation of the given sequence of input values \((f_{k})_{k=0}^{N-1}\), see e.g. [5,6,7].

At the first glance, the known reconstruction algorithms for exponential sums in [11, 13, 27, 29, 30] seem to cover also the problems raised above, since the cosine sum f in (1.1) can be simply transferred into an exponential sum \( \frac {1}{2}{\sum }_{j=1}^{M} \gamma _{j}({\mathrm e}^{{\mathrm i}\phi _{j}t} + {\mathrm e}^{-{\mathrm i}\phi _{j}t})\), which is just a special case of an exponential sum of length 2M. Indeed, in case of exact measurement data, any reconstruction algorithm for exponential sums can be directly used for the recovery of the parameters of f in (1.1). However, if we have noisy input data, or if we want to approximate a given function g by a real cosine sum, then the known algorithms for general exponential sums usually no longer provide us a real solution that can be represented in the form (1.1), i.e., the desired real frequency parameters ϕj cannot be derived from the reconstruction of the corresponding exponential sum.

There exist already some approaches that are directly concerned with the reconstruction of cosine sums, see e.g. [1, 8, 9, 15, 24, 31], which are all based on Prony’s method. An explicit recovery algorithm has been for example derived in [8]. In [17, 28], the reconstruction of sparse Chebyshev polynomials has been considered, which can be seen as a special case of the recovery of (1.1) if ϕj are restricted to the set \(c {\mathbb N}\) with some constant c > 0.

Further we would also like to mention papers [3, 22] and [33], where the close relation between approximation by exponential sums in Fourier space and trigonometric rational approximation in time domain is applied. The approach in [22] employes the idea to approximate the Fourier coefficients ck(f) of a (piecewise) continuous periodic function f by a short exponential sum, i.e., \(c_{k}(f) \approx {\sum }_{\ell =1}^{M} a_{\ell } z_{\ell }^{k}\) for k ≥ 0. For |z| < 1, this representation is equivalent to a trigonometric rational approximation of f in time domain. The opposite approach has been taken in [33], where a trigonometric variant of the AAA algorithm is used to construct a rational trigonometric function that approximates a continuous periodic function from noisy samples f(xj) + 𝜖j. This idea is also based on a Fourier inversion technique in [3]. The approximations considered in [22, 33] can be understood as a generalization of Fourier sums to rational trigonometric sums, but this generalization is different from the model (1.1) that we consider here.

The goal of this paper is to propose two different recovery algorithms for cosine sums of the type (1.1). In Section 2, we start with repeating a variant of Prony’s method for direct recovery of cosine sums in (1.1) for exact input data \(f_{k} = f(\frac {h(2k +1)}{2})\), k = 0,…,N − 1, N > 2M, and derive an ESPRIT-type algorithm in real arithmetics. Our ESPRIT algorithm for cosine sums is based on a matrix pencil method for Hankel + Toeplitz matrices and can be seen as a modification of the algorithms given in [8, 17, 28] which employs the given data fk for reconstruction. The derived ESPRIT algorithm will then use exactly the same input data as our new ESPIRA algorithm in Section 3.

In a recent paper [11], we had proposed an ESPIRA (Estimation of Signal Parameters by Iterative Rational Approximation) algorithm for recovery of exponential sums. As shown in [11], this new method can be successfully applied for reconstruction of exponential sums from noisy data as well as for function approximation, and it essentially outperforms all previous methods in both regards. In Section 3, we now present a new ESPIRA algorithm, which is especially adapted to cosine sums. For this purpose, the problem of parameter reconstruction is transferred to a problem of rational approximation of DCT (Discrete cosine transform) transformed data. The rational approximation problem is then solved in a stable way using the recently proposed AAA algorithm, [18]. In Section 4, we show that the ESPIRA algorithm from Section 3 can be reinterpreted as a matrix-pencil method for special Loewner matrices. This representation enables us to derive a slightly different algorithm (called ESPIRA-II) which employs this matrix pencil approach. Finally, in Section 5 we show at several examples that the new ESPRIT and ESPIRA algorithms work efficiently for reconstruction, but moreover also for function recovery from noisy data and for function approximation in double precision arithmetics.

Throughout this paper, we will use the matrix notation AM,N for real matrices of size M × N and the submatrix notation AM,N(m : n,k : ) to denote a submatrix of AM,N with rows indexed m to n and columns indexed k to , where (as in Matlab) the first row and first column has index 1 (even though the row- and column indices for the definition of the matrix may start with 0). For square matrices we often use the short notation AM instead of AM,M.

2 Prony’s method and ESPRIT for cosine sums

2.1 A variant of Prony’s method for cosine sums

We briefly summarize approaches for the reconstruction of sparse cosine sums f in (1.1) using a variant of the classical Prony method, see e.g. [8, 17, 24, 28, 31]. We modify those results with regard to the structure of the needed input values.

Theorem 2.1

Let some K > 0 be given. Assume that f is of the form (1.1), where M is known beforehand, and where the pairwise distinct parameters \(\phi _{j} \in [0, K) \subset {\mathbb R}\) and \(\gamma _{j} \in {\mathbb R}\setminus \{0\}\), j = 1,…,M, are unknown. Then f can be uniquely reconstructed from the samples \(f(\frac {h(2k+1)}{2})\), k = 0,…,2M − 1, with \(h=\frac {\pi }{K}\), i.e., all parameters of f can be uniquely recovered.

proof

We define the (characteristic) polynomial

$$ p(z) = \prod\limits_{j=1}^{M} \left( z- \cos (\phi_{j} h) \right) $$

of degree M, where by assumption the zeros \(\cos \limits (\phi _{j} h )\) are pairwise distinct. Then p(z) can be rewritten as

$$ p(z) = \sum\limits_{\ell=0}^{M} p_{\ell} T_{\ell}(z), $$
(2.1)

where T(z), \(\ell \in {\mathbb N}_{0}\), denotes the Chebyshev polynomial of first kind of degree , which is for z ∈ [− 1,1] given by \(T_{\ell }(z) = {\cos \limits } (\ell \arccos z)\). For ≥ 1 the leading coefficient of T is 2− 1, therefore it follows that pM = 2M+ 1.

Observe that f in (1.1) is an even function, therefore we have

$$ f_{k}\! :=\! f\left( \frac{h(2k+1)}{2}\right) \! =\! f\left( -\frac{h(2k+1)}{2}\right) \! =\! f_{-k-1}, \qquad k=0, {\ldots} , 2M-1. $$
(2.2)

The coefficients p of the polynomial p(z) in (2.1) satisfy for m = 0,…,M − 1, the equations

$$ \begin{array}{@{}rcl@{}} \!\!\!\!\!\!\!\!\! \sum\limits_{\ell=0}^{M} p_{\ell} (f_{m+\ell} + f_{m-\ell}) & = & \sum\limits_{\ell=0}^{M} p_{\ell} \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos\left( \left( \frac{\phi_{j} h (1+2(m+\ell))}{2}\right)\right)\right.\\ &&+\left. \cos\left( \left( \frac{\phi_{j} h(1+2(m-\ell))}{2}\right) \right) \right)\\ & = & \sum\limits_{\ell=0}^{M} p_{\ell} \sum\limits_{j=1}^{M} \gamma_{j} 2 \left( \cos((\frac{\phi_{j} h(1+2m)}{2})) \cos (\phi_{j} h \ell) \right)\\ & = & 2 \sum\limits_{j=1}^{M} \gamma_{j} {{\cos\left( \left( \frac{\phi_{j} h(1+2m)}{2}\right)\right)}} \sum\limits_{\ell=0}^{M} p_{\ell} \cos(\phi_{j} h \ell)\\ & = & 2 \sum\limits_{j=1}^{M}\!\gamma_{j} {{\cos\!\left( \! \left( \!\frac{\phi_{j} h(1\! +\! 2m)}{2}\!\right)\!\right)}}\!\sum\limits_{\ell=0}^{M} \! p_{\ell} T_{\ell}(\cos (\phi_{j} h)\!) = 0.~~~~ \end{array} $$
(2.3)

Using the 6nown function values fk, k = − 2M,…,2M − 1, we define the M × M-matrix

$$ {\mathbf M}_{M} := \left( f_{m+\ell} + f_{m - \ell} \right)_{m,\ell=0}^{M-1}. $$

Further, let p := (p0,…,pM− 1)T be the vector of polynomial coefficients in (2.1). Then, with pM = 2M+ 1, (2.3) yields the equation system

$$ {\mathbf M}_{M} {\mathbf p} = - 2^{-M+1} \left( f_{m+M} + f_{m-M} \right)_{m=0}^{M-1}. $$
(2.4)

The matrix MM has Toeplitz + Hankel structure. It is invertible, since we obtain the factorization

$$ \begin{array}{@{}rcl@{}} {\mathbf M}_{M}\! &=&\! \left( \sum\limits_{j=1}^{M} \gamma_{j}\! \left( \!\cos\! \left( \phi_{j} h \left( \frac{1\! +\! 2(m\! +\! \ell)}{2}\right)\!\right) \! + \cos\left( \phi_{j} h \left( \frac{1+2(m-\ell)}{2}\right)\right) \right)\! \right)_{m,\ell=0}^{M-1} \!\\ &=& 2 \left( \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos \left( \phi_{j} h \left( \frac{1+2m}{2}\right) \right) \cos(\phi_{j} h \ell) \right) \right)_{m,\ell=0}^{M-1} \\ &=& 2 {\mathbf V}_{M}^{(1)} \text{diag} (\gamma_{j})_{j=1}^{M} ({\mathbf V}_{M}^{(2)})^{T} \end{array} $$
(2.5)

with the generalized Vandermonde matrices

$$ {\mathbf V}_{M}^{(1)} = \left( \cos \left( \left( \frac{\phi_{j} h(1+2m)}{2} \right) \right) \right)_{m=0,j=1}^{M-1,M}, \qquad {\mathbf V}_{M}^{(2)} = \left( \cos(\phi_{j} h \ell) \right)_{\ell=0,j=1}^{M-1,M}. $$

The two Vandermonde matrices \({\mathbf V}_{M}^{(1)}\) and \({\mathbf V}_{M}^{(2)}\) as well as the diagonal matrix are invertible by assumption. Therefore, p(z) is uniquely defined by (2.4) and its zeros \(\cos \limits (\phi _{j} h)\) are uniquely determined. Having \(\cos \limits (\phi _{j} h)\), frequencies ϕj can be unambiguously extracted if 0 ≤ ϕjhπ, which gives us the restriction ϕj ∈ [0,K]. Finally, the coefficients γj of f in (1.1) are determined by the linear system

$$ f_{k} = \sum\limits_{j=1}^{M} \gamma_{j} \cos \left( \frac{\phi_{j} h(2k+1)}{2}\right), \ k=0,\ldots, 2M-1. $$

Remark 2.2

The factorization of MM obtained in (2.5) is similar to the factorization of HM(0) in Lemma 2.2 in [28], where input values of the form \(f(\tau k) = g(\cos \limits (\tau k))\) with \(\tau =\frac {\pi }{2N-1}\) have been employed to reconstruct a sparse Chebyshev expansion \(g(x) = {\sum }_{j=1}^{M} c_{j} T_{n_{j}}(x)\). A similar factorization approach in [17] uses the input values \(g(\cosh (k\tau ))\) for sparse Chebyshev polynomial reconstruction. The reconstruction procedures for cosine sums in [9] and in [24] apply the more general input data f(x0 + hk), k = − 2M + 1,…,2M − 1. Theorem 2.1 can be seen as a the special case of the results in [24], where \(x_{0}= \frac {h}{2}\), and where the set of needed input data can be reduced since f is even. The factorization in [9] for the special case \(x_{0}= \frac {h}{2}\) is similar but slightly different. In [31], the reconstruction of cosine sums is treated by the generalized operator Prony method, which also leads to the factorization in (2.5).

2.2 ESPRIT for sparse cosine sums

While the reconstruction of sparse cosine sums can be theoretically performed according to the constructive method described in the proof of Theorem 2.1, this procedure is numerically not stable. We are particularly interested in the recovery of cosine sums from noisy data and in function approximation by short cosine sums. Therefore we need a method which is able to estimate the number M of terms and provides a good function approximation also in the case of noisy data. In this section, we will transfer the well-known ESPRIT method [30] to our setting. For a related approach, we refer to [28], where such a method has been derived for the reconstruction of sparse Chebyshev polynomials, and to [15], where the ESPRIT method is considered for the generalized Prony method. Further, in [8], an ESPRIT-like method has been employed for other input data, namely f(jΔ) with \({\Delta }=\frac {B}{2M-1}\) or \({\Delta }=\frac {B}{2M}\) for approximation of f by a cosine sum with M terms in [0,B]. We remark that all earlier approaches differ from the ESPRIT method that we will present here, since we use input data of the form (2.2).

Let us assume that L is a given upper bound of the sparsity M in (1.1), and let N be a sufficiently large number of given function samples \(f_{k} = f\left (\frac {h(1+2k)}{2}\right )\), k = −N,…,N − 1, such that MLN/2. We consider now the following three Toeplitz + Hankel matrices of size (NL,L),

$$ \begin{array}{@{}rcl@{}} {\mathbf M}_{N-L,L}^{(-1)} &:=& \frac{1}{2} \left( f_{m+\ell-1} + f_{m-\ell-1} \right)_{m=0,\ell=0}^{N-L-1,L-1}, \\ {\mathbf M}_{N-L,L}^{(0)} &:=& \frac{1}{2} \left( f_{m+\ell} + f_{m-\ell} \right)_{m=0,\ell=0}^{N-L-1,L-1}, \\ {\mathbf M}_{N-L,L}^{(1)} &:=& \frac{1}{2} \left( f_{m+\ell+1} + f_{m-\ell+1} \right)_{m=0,\ell=0}^{N-L-1,L-1}. \\ \end{array} $$

Then, similarly as in the proof of Theorem 2.1, we observe that these matrices possess the representations

$$ \begin{array}{@{}rcl@{}} {\mathbf M}_{N-L,L}^{(-1)} &=& \left( \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos\left( \phi_{j} h \left( \frac{-1+2m}{2}\right) \right) \cos (\phi_{j} h \ell ) \right) \right)_{m=0,\ell=0}^{N-L-1,L-1}, \\ {\mathbf M}_{N-L,L}^{(0)} &=& \left( \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos\left( \phi_{j} h \left( \frac{1+2m}{2}\right) \right) \cos (\phi_{j} h \ell ) \right) \right)_{m=0,\ell=0}^{N-L-1,L-1}, \\ {\mathbf M}_{N-L,L}^{(1)} &=& \left( \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos\left( \phi_{j} h \left( \frac{3+2m}{2}\right) \right) \cos (\phi_{j} h \ell ) \right) \right)_{m=0,\ell=0}^{N-L-1,L-1}. \end{array} $$

Therefore, we conclude that

$$ \begin{array}{@{}rcl@{}} & & \frac{1}{2} \Big({\mathbf M}_{N-L,L}^{(-1)} + {\mathbf M}_{N-L,L}^{(1)} \Big) \\ \!\! &=&\! \left( \sum\limits_{j=1}^{M} \frac{\gamma_{j}}{2}\! \left( \!\cos\!\left( \! \phi_{j} h\!\left( \!\frac{-1\! +\! 2m}{2}\right)\! \right) \! + \cos\!\left( \! \phi_{j} h \! \left( \!\frac{3\! +\! 2m}{2}\right)\! \right) \!\right) \cos (\phi_{j} h \ell) \right)_{m=0,\ell=0}^{N-L-1,L-1} \\ \!\!&=&\! \left( \sum\limits_{j=1}^{M} \gamma_{j} \left( \cos\left( \phi_{j} h \left( \frac{1+2m}{2}\right) \right) \cos(\phi_{j} h ) \cos (\phi_{j} h \ell) \right) \right)_{m=0,\ell=0}^{N-L-1,L-1} \\ \!\!&=&\! {\mathbf V}_{N-L,M}^{(1)} \text{diag} \left( \left( \gamma_{j} \right)_{j=1}^{M} \right) \text{diag} \left( \left( \cos(\phi_{j} h)\right)_{j=1}^{M} \right) ({\mathbf V}_{L, M}^{(2)})^{T} \end{array} $$

with the generalized Vandermonde matrices

$$ {\mathbf V}_{N-L,M}^{(1)} = \Big(\cos \Big(\phi_{j} h \Big(\frac{1+2m}{2} \Big) \Big)\Big)_{m=0,j=1}^{N-L-1,M}, \qquad {\mathbf V}_{L, M}^{(2)} = \Big(\cos (\phi_{j} h \ell) \Big)_{\ell=0,j=1}^{L-1,M}, $$

with full column rank M, while \({\mathbf M}_{N-L,L}^{(0)}\) possesses the factorization

$$ {\mathbf M}_{N-L,L}^{(0)} = {\mathbf V}_{N-L,M}^{(1)} \text{diag} \Big(\gamma_{j} \Big)_{j=1}^{M} ({\mathbf V}_{L, M}^{(2)})^{T}. $$
(2.6)

Thus, it follows that the values \(\cos \limits (\phi _{j} h)\), j = 1,…,M, are eigenvalues of the matrix pencil

$$ z {\mathbf M}_{N-L,L}^{(0)} - \frac{1}{2} \Big({\mathbf M}_{N-L,L}^{(-1)} + {\mathbf M}_{N-L,L}^{(1)} \Big). $$
(2.7)

The three matrices \({\mathbf M}_{N-L,L}^{(\kappa )}\), κ = − 1,0,1, can be all obtained as submatrices of

$$ {\mathbf M}_{N-L+2,L} := \frac{1}{2} \left( f_{m+\ell-1} + f_{m-\ell-1}\right)_{m=0,\ell=0}^{N-L+1,L-1}, $$
(2.8)

where, using the Matlab notation of submatrices, we have

$$ \begin{array}{@{}rcl@{}} {\mathbf M}_{N-L,L}^{(-1)} & =& {\mathbf M}_{N-L+2,L}(1\!:\!N-L, 1\!:\!L), \\ {\mathbf M}_{N-L,L}^{(0)} & =& {\mathbf M}_{N-L+2,L}(2\!:\!N-L+1, 1\!:\!L), \\ {\mathbf M}_{N-L,L}^{(1)} & =& {\mathbf M}_{N-L+2,L}(3\!:\!N-L+2, 1\!:\!L), \end{array} $$

i.e., \({\mathbf M}_{N-L,L}^{(-1)}\) is obtained from MNL+ 2,L by removing the last two rows, \({\mathbf M}_{N-L,L}^{(0)}\) is found from MNL+ 2,L by removing the first row and the last row, and finally \({\mathbf M}_{N-L,L}^{(1)}\) is obtained by removing the first two rows.

Remark 2.3

Using similar ideas as in [28], applied to our setting, the eigenvalue problem (2.7) can be also obtained as follows for given M = LN/2. The roots of the polynomial p(z) in (2.1) are eigenvalues of a Chebyshev companion matrix \(C_{M}(p) \in \mathbb {R}^{M\times M}\) defined by

$$ {\mathbf C}_{M}(p)= \left( \begin{array}{cccccc} 0 & \frac{1}{2} & 0 & {\ldots} & 0 & -\frac{p_{0}}{2p_{M}} \\ 1 & 0 & \frac{1}{2} & {\ldots} & 0 & -\frac{p_{1}}{2p_{M}} \\ 0 & \frac{1}{2} & 0 & {\ldots} & 0 & -\frac{p_{2}}{2p_{M}} \\ {\vdots} & & & {\ddots} & & \\ 0 & 0 & {\ldots} & \frac{1}{2} & 0 & -\frac{p_{M-2}}{2p_{M}}+\frac{1}{2} \\ 0 & 0 & 0 & {\ldots} & \frac{1}{2} & -\frac{p_{M-1}}{2p_{M}} \end{array} \right), $$
(2.9)

see for example [4], i.e.,

$$ \det (z \mathbf{I}_{M}- {\mathbf C}_{M}(p))= \frac{1}{2^{M-1}} p(z). $$
(2.10)

Then (2.3) implies that

$$ {\mathbf M}_{M}^{(0)} {\mathbf C}_{M}(p)= \frac{1}{2} \Big({\mathbf M}_{M}^{(-1)} + {\mathbf M}_{M}^{(1)} \Big). $$
(2.11)

Since \({\mathbf M}_{M}^{(0)}\) has full rank M, it follows that the matrix pencil

$$ {\mathbf M}_{M}^{(0)} (z {\mathbf I}_{M} - {\mathbf C}_{M}(p)) = z {\mathbf M}_{M}^{(0)} - \frac{1}{2} \Big({\mathbf M}_{M,M}^{(-1)} + {\mathbf M}_{M,M}^{(1)} \Big) $$

possesses the roots of polynomial p(z), i.e., \(\cos \limits (\phi _{j} h )\) for j = 1,…,M, as eigenvalues. If M is unknown and we have L as an upper bound for M such that MLN/2, we can modify the procedure to get the rectangular matrix pencil (2.7).

To derive a more stable representation of the matrix pencil problem in (2.7) we proceed similarly as in [27] for exponentials sums. We employ the SVD of MNL+ 2,L in (2.8),

$$ {\mathbf M}_{N-L+2,L} = {\mathbf U}_{N-L+2} {\mathbf D}_{N-L+2,L} {\mathbf W}_{L}, $$
(2.12)

where UNL+ 2 and WL are orthogonal square matrices of size NL + 2 and L respectively, and

$$ {\mathbf D}_{N-L+2,L} = \left( \begin{array}{c} \text{diag} (\sigma_{\ell})_{\ell=1}^{L} \\ {\mathbf 0}_{N-2L+2,L} \end{array} \right) $$

contains the singular values σ of MNL+ 2,L, where 0N− 2L+ 2,L is a zero matrix of the given size. Since MNL+ 2,L possesses a factorization of the form

$$ {\mathbf M}_{N-L+2,L} = {\mathbf V}_{N-L+2,M}^{(1)} \text{diag} \Big(\gamma_{j} \Big)_{j=1}^{M} ({\mathbf V}_{L, M}^{(2)})^{T}, $$

similarly to (2.6), it follows that only M singular values σj in DNL+ 2,L are non-zero, and M can be found as the numerical rank of MNL+ 2,L. The SVD in (2.12) also yields similar factorizations for the three submatrices. Using the short notation

$$ {\mathbf U}_{N-L,N-L+2}^{(\kappa)} = {\mathbf U}_{N-L+2}(\kappa+2\!:\!N-L+\kappa+1,1\!:\!N-L+2), \qquad \kappa=-1,0,1, $$

we find

$$ {\mathbf M}_{N-L,N-L+2}^{(\kappa)} = {\mathbf U}_{N-L,N-L+2}^{(\kappa)} {\mathbf D}_{N-L+2,L} {\mathbf W}_{L}, \qquad \kappa=-1,0,1. $$

By multiplication with \({\mathbf W}_{L}^{-1} = {\mathbf W}_{L}^{T}\) from the right, the matrix pencil in (2.7) can therefore be rewritten as

$$ \begin{array}{@{}rcl@{}} & \Big(z {\mathbf U}_{N-L,N-L+2}^{(0)} - \frac{1}{2} \Big({\mathbf U}_{N-L,N-L+2}^{(-1)} + {\mathbf U}_{N-L,N-L+2}^{(1)} \Big) \Big) {\mathbf D}_{N-L+2,L}. \end{array} $$

Finally, a multiplication with the pseudo inverse of DNL+ 2,L yields

$$ z {\mathbf U}_{N-L,M}^{(0)} - \frac{1}{2} \Big({\mathbf U}_{N-L,M}^{(-1)} + {\mathbf U}_{N-L,M}^{(1)} \Big), $$

where we removed the zero columns. This matrix pencil problem is equivalent to the problem to find the eigenvalues 2z of

$$ ({\mathbf U}_{N-L,M}^{(0)})^{\dagger} \Big({\mathbf U}_{N-L,M}^{(-1)} + {\mathbf U}_{N-L,M}^{(1)} \Big), $$

where \(({\mathbf U}_{N-L,M}^{(0)})^{\dagger }\) denotes the Moore Penrose inverse of \({\mathbf U}_{N-L,M}^{(0)}\). The coefficient vector \(\mathbf {\gamma }=(\gamma _{j})_{j=1}^{M}\) of f in (1.1) is found as solution of the linear system

$$ {\mathbf V}_{N,M} \mathbf{\gamma} = \left( f\left( \frac{h(2k+1)}{2}\right)\right)_{k=0}^{N-1}, $$

with the generalized Vandermonde matrix

$$ {\mathbf V}_{N,M}= \left( \cos \left( \phi_{j} h \Big(\frac{2k+1}{2}\Big)\right) \right)_{k=0,j=1}^{N-1,M}. $$
(2.13)

The corresponding ESPRIT algorithm is summarized in Algorithm 1.

Algorithm 1
figure a

ESPRIT algorithm for recovery of cosine sums.

Remark 2.4

  1. 1.

    The arithmetical complexity of the SVD decomposition of the Toeplitz + Hankel matrix MNL+ 2,L+ 1 in step 1 of Algorithm 1 requires \({\mathcal O}\big ((N-L)L^{2}\big )\) operations. Step 2 involves besides the matrix inversion and matrix multiplication the solution of the eigenvalue problem for an (NL) × (NL) matrix with \({\mathcal O}((N-L)^{3})\) operations. Thus, we have overall computational costs of \({\mathcal O}((N-L)^{3})\), and for LN/2 we require \({\mathcal O}(N^{3})\) operations. The computational costs can be reduced by employing a partial SVD.

  2. 2.

    Instead of applying an SVD of the matrix MNL+ 2,L+ 1 in the first step of the algorithm 1, we can use also the QR decomposition of this matrix to improve numerical stability. This approach has been also employed for exponential sums, see [11, 13, 27] and is called matrix pencil method (MPM).

3 ESPIRA for reconstruction of cosine sums

3.1 ESPIRA-I based on rational approximation

In this section, we will derive a new algorithm for the recovery of sparse cosine sums f as in (1.1). As before, we assume that we are given the (possibly corrupted) samples

$$ f_{\ell}= f\left( \frac{h (2\ell+1)}{2}\right) + \epsilon_{\ell}, \qquad \ell=0,\ldots,N-1, $$

with N > 2M, \(h=\frac {\pi }{K}\), K > 0. Our goal is to recover all parameters \(M \in {\mathbb N}\), \(\gamma _{j} \in {\mathbb R}\setminus \{0\}\), ϕj ∈ [0,K), j = 1,…,M, of f in (1.1).

We recall that the discrete cosine transform of type II (DCT-II) is given as a matrix vector product \(\hat {\mathbf f} = {\mathbf C}_{N}^{II} {\mathbf f}\) with the cosine matrix

$$ {\mathbf C}_{N}^{II} := \left( \cos \left( \frac{k(2\ell+1) \pi}{2N} \right)\right)_{k,\ell=0}^{N-1}. $$
(3.1)

Then

$$ \sqrt{\frac{2}{N}} \text{diag} (\frac{1}{\sqrt{2}}, 1, {\ldots} , 1) {\mathbf C}_{N}^{II} $$

is an orthogonal matrix. The DCT-II of length N can be performed with a fast and numerically stable algorithm with complexity \({\mathcal O}(N \log N)\) see e.g. [25] or [23], Section 6.3. Using the structure of f in (1.1) (assuming that we have exact samples), we obtain for the components \(\hat {f}_{k}\), k = 0,…,N − 1,

$$ \begin{array}{@{}rcl@{}} \!\!\!\!\!\!\!\hat{f_{k}} & = & \sum\limits_{\ell=0}^{N-1} f_{\ell} \cos\left( \frac{\pi k(2\ell+1)}{2N} \right) \\ & = & \sum\limits_{\ell=0}^{N-1} \left( \sum\limits_{j=1}^{M} \gamma_{j} \cos \left( \frac{\phi_{j} h (2\ell+1)}{2}\right) \right) \cos\left( \frac{\pi k(2\ell+1)}{2N} \right) \\ & = & \sum\limits_{j=1}^{M} \gamma_{j} \sum\limits_{\ell=0}^{N-1} \frac{1}{2} \!\left( \! \cos\! \left( \!(2\ell + 1) \Big(\frac{\phi_{j} h}{2} + \frac{k \pi}{2N}\Big)\!\right) + \cos\! \left( \!(2\ell + 1) \Big(\frac{\phi_{j} h}{2} - \frac{k \pi}{2N}\!\Big)\! \right)\!\right).~~~~~ \end{array} $$
(3.2)

Recall that

$$ \sum\limits_{\ell=0}^{N-1} \cos \left( {(2\ell+1)x}\right) = \frac{\sin (2N x)}{2 \sin x}, \qquad x \not\in \pi {\mathbb Z}. $$
(3.3)

We assume first that \(\phi _{j} h \not \in \frac {\pi }{N} {\mathbb Z}\) for j = 1,…,M, such that for all \(k \in {\mathbb Z}\) we can apply formula (3.3) for \(x= \Big (\frac {\phi _{j} h}{2} \pm \frac {k \pi }{2N}\Big ) \not \in \pi {\mathbb Z}\), then

$$ \begin{array}{@{}rcl@{}} \hat{f_{k}} = \sum\limits_{j=1}^{M} \frac{\gamma_{j}}{4} \left( \frac{\sin (\phi_{j} hN +k\pi)}{\sin\big(\frac{\phi_{j} h}{2} + \frac{k \pi}{2N}\big)} + \frac{\sin (\phi_{j} hN -k\pi)}{\sin\big(\frac{\phi_{j} h}{2} - \frac{k \pi}{2N}\big) } \right). \end{array} $$
(3.4)

Now, observe that \(\sin \limits (\phi _{j} hN +k\pi ) = \sin \limits (\phi _{j} hN -k\pi ) = (-1)^{k} \sin \limits (\phi _{j} hN)\). Therefore,

$$ \begin{array}{@{}rcl@{}} \hat{f_{k}} &=& (-1)^{k} \sum\limits_{j=1}^{M} \frac{\gamma_{j}}{4} \sin(\phi_{j} hN) \left( \frac{\sin\big(\frac{\phi_{j} h}{2} - \frac{k \pi}{2N}\big) + \sin\big(\frac{\phi_{j} h}{2} + \frac{k \pi}{2N}\big) }{\sin\big(\frac{\phi_{j} h}{2} + \frac{k \pi}{2N}\big) \sin\big(\frac{\phi_{j} h}{2} - \frac{k \pi}{2N}\big)} \right)\\ &=& (-1)^{k} \sum\limits_{j=1}^{M} \gamma_{j} \sin(\phi_{j}h N) \left( \frac{\sin \big(\frac{\phi_{j} h}{2} \big) \cos \big(\frac{\pi k}{2N}\big)}{\cos \big(\frac{k\pi}{N}\big) - \cos \big(\phi_{j} h \big)} \right) \\ &= & (-1)^{k} \cos\left( \frac{\pi k}{2N}\right) \sum\limits_{j=1}^{M} \left( \frac{\gamma_{j} \sin(\phi_{j}h N) \sin \big(\frac{\phi_{j} h}{2} \big) }{\cos \big(\frac{k\pi}{N}\big) - \cos \big(\phi_{j} h\big)} \right) . \end{array} $$
(3.5)

The representation for \(\widehat {f}_{k}\) in (3.5) is well-defined if \(\phi _{j} \not \in \frac {\pi }{hN} \mathbb {Z}\) for j = 1,…,M. For \(\phi _{j} \in \frac {\pi }{hN}\mathbb {Z}\) and k = 1,…,N − 1, the rule of L’Hospital leads to

$$ \lim\limits_{\phi_{j} \to \frac{\pi k}{hN} }\frac{ \sin (\phi_{j} hN) \sin\big(\frac{\phi_{j} h}{2} \big) }{ \cos\big(\frac{\pi k}{N} \big)- \cos\big(\phi_{j} h \big) } = \frac{N \cos (\pi k) \sin\big(\frac{\pi k}{2N} \big)}{\sin\big(\frac{\pi k}{N} \big)}=\frac{(-1)^{k} N }{2 \cos\big(\frac{\pi k}{2N} \big)}. $$
(3.6)

For \(\phi _{j} \not \in \frac {\pi }{hN}\mathbb {Z}\) for j = 1,…,M, formula (3.5) implies

$$ \displaystyle(-1)^{k} \left( \cos\big(\frac{\pi k}{2N} \big) \right)^{-1} \widehat{f}_{k} = \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin(\phi_{j}h N) \sin \big(\frac{\phi_{j} h}{2} \big) }{\cos \big(\frac{k\pi}{N}\big) - \cos \big(\phi_{j} h\big)} , \qquad k=0, {\ldots} , N-1. $$
(3.7)

Therefore the problem of reconstruction of all parameters of the representation (1.1) can be reformulated as rational interpolation problem. We define now a rational function of type (M − 1,M),

$$ r_{M}(z) := \sum\limits_{j=1}^{M} \frac{a_{j}}{z-b_{j}} $$
(3.8)

with

$$ \begin{array}{@{}rcl@{}} a_{j} & := & \gamma_{j} \sin \left( \frac{\phi_{j} h}{2} \right) \sin (\phi_{j} h N), \\ b_{j} &:= & \cos\big(\phi_{j} h \big) . \end{array} $$

In other words, rM is determined by the desired parameters M, γj, ϕj, j = 1,…,M. Now the conditions in (3.7) can be interpreted as N interpolation conditions for the rational function rM,

$$ r_{M} \left( \cos\big(\frac{\pi k}{N} \big) \right) =(-1)^{k} \left( \cos\big(\frac{\pi k}{2N} \big) \right)^{-1} \widehat{f}_{k}, \qquad k=0, \ldots, N-1 . $$
(3.9)

The recovery of all parameters of f in (1.1) can now be achieved as follows. First we compute a rational function \(r_{M^{\prime }}\) of minimal type \((M^{\prime }-1,M^{\prime })\) that satisfies all interpolation conditions (3.9). Then we have to rewrite this rational function as a partial fraction decomposition as in (3.8), i.e., we determine the parameters aj, bj, \(j=1, {\ldots } , M^{\prime }\). The type of the rational function \(r_{M^{\prime }}\) provides us the number \(M=M^{\prime }\). The values \(b_{j} =\cos \limits (\phi _{j} h)\), j = 1,…,M, are the poles of rM, and we can extract ϕj by taking

$$ \phi_{j}= \frac{\arccos b_{j}}{h}. $$

Once the ϕj’s are known, the parameters γj can be simply recovered from aj.

We will use the AAA algorithm proposed in [18] to compute the rational function rM. The main steps of ESPIRA-I for cosine sums are described in Algorithm 2.

Algorithm 2
figure b

ESPIRA-I for cosine sums.

The computation of the DCT-II in Step 1 of Algorithm 2 requires \({\mathcal O}(N \log N)\) operations, see [25]. The complexity of the AAA Algorithm 3 is \({\mathcal O}(N M^{3})\), since Algorithm 3 involves SVDs of Loewner matrices of dimension (Nj) × j for j = 1,…,M + 1, [18]. Finally, Algorithm 4 involves an eigenvalue problem with complexity \({\mathcal O}(M^{3})\). Therefore, the overall computational costs of Algorithm 2 are \({\mathcal O}(N (M^{3}+\log N))\), which is very reasonable for small M.

As we will outline in the last section on numerical experiments, for recovery of cosine sums from a large number of noisy input data, we will slightly change Algorithm 2 by taking only the function values gk for \(k=0, {\ldots } , \frac {N}{2}-1\) in step 2 of the algorithm. In this way we improve the stability of the algorithm by avoiding amplification of the error by the factor \(\cos \limits (\frac {\pi k}{2N})^{-1}\) in the definition of gk.

3.2 The AAA Algorithm for rational approximation

We will employ the recently proposed AAA algorithm [18] for rational approximation in order to perform step 2 in Algorithm 2. Therefore, we shortly summarize this algorithm in our setting. For more detailed information we refer to [12, 18] or to [11], where we have applied this algorithm for the recovery of complex exponential sums. The AAA algorithm is numerically stable due to an iterative procedure using adaptively chosen interpolation sets and barycentric representation of the rational interpolant.

Let I := {0,…,N − 1} be the index set, \(Z =\{ z_{k} := \cos \limits \left (\frac {\pi k}{N} \right ): k \in I \}\) the set of support points, and \( G:=\left \{ g_{k} := (-1)^{k} \left (\cos \limits \left (\frac {\pi k}{2N} \right ) \right )^{-1} \widehat {f}_{k}, {k \in I} \right \}\) the corresponding set of known function values. Then the AAA algorithm will find a rational function \(\tilde {r}_{M}(z)\) in barycentric representation of type (M,M) such that

$$ \tilde{r}_{M} \left( z_{k} \right) = g_{k}, \qquad k \in I, $$
(3.10)

where N/2 is an upper bound of the unknown degree M. In our application, we actually need a rational function of type (M − 1,M) instead of (M,M). This will be forced using the model (3.8) to transfer \(\tilde {r}_{M}\) into a partial fraction decomposition in Algorithm 4. In case of exact data the resulting function \(\tilde {r}_{M}\) will have a type (M − 1,M) (see Corollaries 3.3 and 3.4).

We briefly describe the iteration steps of the AAA algorithm.

We initialize the sets S0 := and Γ0 := I. At step J = 1, we determine \(k_{1} := \mathop {\text {argmax}}_{k \in I} |g_{k}|\), update S1 := S0 ∪{k1}, Γ1 := Γ0 ∖{k1}, and choose \(\tilde {r}_{0}(z) := g_{k_{1}}\) of type (0,0), such that \(\tilde {r}_{0}(z_{k_{1}}) = g_{k_{1}}\). At the iteration step J > 1, we proceed as follows, see also [10, 18, 21]. The algorithm terminates if \(\max \limits _{\ell \in {\Gamma }_{J-1}} | \tilde {r}_{J-2}\left (z_{\ell }\right ) - g_{\ell }| < \epsilon \) for a predetermined bound 𝜖 or if J reaches a predetermined maximal value. Otherwise, we determine the updated index sets as

$$ S_{J} := S_{J-1} \cup \mathop{\text{argmax}}_{\ell \in {\Gamma}_{J-1}}| \tilde{r}_{J-2}\left( z_{\ell}\right) - g_{\ell}|, \qquad {\Gamma}_{J} = I \setminus S_{J}. $$

Then we compute a rational function \(\tilde {r}_{J-1}\) of type (J − 1,J − 1) as follows. We employ its barycentric form

$$ \tilde{r}_{J-1}(z) = \frac{\tilde{p}_{J-1}(z)}{\tilde{q}_{J-1}(z)} := \frac{\sum\limits_{k \in S_{J}} \frac{w_{k} g_{k}}{z- z_{k} }}{\sum\limits_{k \in S_{J}} \frac{w_{k}}{z- z_{k} }}, $$
(3.11)

where \({\mathbf w}_{J} = {\mathbf w}=(w_{k})_{k \in S_{J}}\), is a normalized vector of real weights, i.e., \(\| {\mathbf w} \|_{2}^{2} = \sum \limits _{k \in S_{J}} {w_{k}^{2}} = 1\). Then we already have by construction \(\tilde {r}_{J-1}(z_{k}) = g_{k}\) for all kSJ if wk≠ 0. The weight vector w is now chosen such that \(\tilde {r}_{J-1}(z)\) approximates the remaining data g, ∈ΓJ. To compute w, we consider the restricted least-squares problem obtained by linearizing the interpolation conditions for ∈ΓJ,

$$ \min_{\mathbf w} \sum\limits_{\ell \in {\Gamma}_{J}} \left|g_{\ell} \tilde{q}_{J-1}\left( z_{\ell} \right)-\tilde{p}_{J-1}\left( z_{\ell} \right) \right|^{2}, \quad \textrm{such~that} \quad \| {\mathbf w} \|_{2}^{2} = 1. $$
(3.12)

We define the Loewner matrix

$$ {\mathbf L}_{N-J,J} := \left( \frac{g_{\ell} - g_{k}}{z_{\ell} - z_{k} } \right)_{\ell \in {\Gamma}_{J}, k \in S_{J}}, $$

and rewrite the term in (3.12) as

$$ {\sum}_{\ell \in {\Gamma}_{J}} \left|g_{\ell} \tilde{q}_{J-1}\left( z_{\ell} \right)-\tilde{p}_{J-1}\left( z_{\ell} \right)\right|^{2} = {\sum}_{\ell \in {\Gamma}_{J}} \left| {{\mathbf w}}^{T} \left( \frac{g_{\ell} - g_{k}}{z_{\ell}- z_{k} }\right)_{k \in S_{J}} \right|^{2} =\| {\mathbf L}_{N-J,J} {{\mathbf w}} \|_{2}^{2}. $$

Thus, the minimization problem in (3.12) takes the form \( \min \limits _{\|{\mathbf w}\|_{2} = 1 }\| {\mathbf L}_{N-J,J} {{\mathbf w}} \|_{2}^{2} \), and the solution vector \( \mathbf{w} \in \mathbb{C}^{J}\) is the right singular vector corresponding to the smallest singular value of LNJ,J. Having determined the weight vector w, the rational function \(\tilde {r}_{J-1}\) is completely fixed by (3.11). The procedure is summarized in Algorithm 3.

Algorithm 3
figure c

Iterative rational approximation by AAA algorithm [18].

Algorithm 3 provides the rational function \(\tilde {r}_{M}(z)\) in barycentric form \(\tilde {r}_{M}(z) = \frac {\tilde {p}_{M}(z)}{\tilde {q}_{M}(z)}\) with

$$ \tilde{p}_{M}(z) := \sum\limits_{k \in S_{M+1}} \frac{w_{k} g_{k}}{z-\cos\left( \frac{\pi k}{N} \right) }, \qquad \tilde{q}_{M}(z) := \sum\limits_{k \in S_{M+1}} \frac{w_{k}}{z-\cos\left( \frac{\pi k}{N} \right) }, $$
(3.13)

which are determined by the output parameters of this algorithm. Note that it is important to take the occurring index sets and data sets in Algorithm 3 as ordered sets, therefore they are given as vectors S, Γ, gS and gΓ, as in the original algorithm, [18].

3.3 Partial fraction decomposition

For exact data \(\hat {f}_{k}\), k = 0,…,N − 1 of a function f in (1.1), there exists a rational function rM of type (M − 1,M) as in (3.8) satisfying all interpolation conditions (3.7). As we will show in Section 3.5, Algorithm 3 provides this rational function in barycentric form, i.e., \(\tilde {r}_{M}= r_{M}\). It remains to rewrite \(\tilde {r}_{M}\) in (3.13) in the form of a partial fraction decomposition,

$$ r_{M}(z) = \sum\limits_{j=1}^{M} \frac{a_{j}}{z-b_{j}}, $$
(3.14)

i.e., we need to determine a1,…,aM and b1,…,bM from the output of Algorithm 3. In case of noisy data or numerical errors, we will approximate the output \(\tilde {r}_{M}\) of Algorithm 3 by a function rM of type (M − 1,M) as in (3.14).

The zeros of the denominator \(\tilde {q}_{M}(z)\) are the poles bj of rM(z) and can be computed by solving an (M + 2) × (M + 2) generalized eigenvalue problem (see [18] or [21]), that has for SM+ 1 = {k1,…,kM+ 1} the form

$$ \left( \begin{array}{ccccc} 0 & w_{k_{1}} & w_{k_{2}} & {\ldots} & w_{k_{M+1}} \\ 1 & \cos\left( \frac{\pi k_{1}}{N} \right)& & & \\ 1 & & \cos\left( \frac{\pi k_{2}}{N} \right)& & \\ {\vdots} & & & {\ddots} & \\ 1 & & & & \cos\left( \frac{\pi k_{M+1}}{N} \right) \end{array} \right) {\mathbf v}_{z}= z \left( \begin{array}{ccccc} 0 & & & & \\ & 1 & & & \\ & & 1 & & \\ & & & {\ddots} & \\ & & & & 1 \end{array} \right) {\mathbf v}_{z}. $$
(3.15)

Two eigenvalues of this generalized eigenvalue problem are infinite and the other M eigenvalues are the wanted zeros bj of \(\tilde {q}_{M}(z)\) (see [16, 18, 21] for more detailed explanation). We apply Algorithm 4 to the output of Algorithm 3.

Algorithm 4
figure d

Reconstruction of parameters aj and bj of partial fraction representation.

3.4 Recovery of parameters \(\phi _{j} \in \frac {\pi }{h N}\mathbb {Z}\)

For reconstruction of a cosine sum f in (1.1) from exact function values, we still need to study the problem of recovering frequency parameters ϕj satisfying ϕjhN = kπ, k ∈{0,…,N − 1}, since for these parameters we did not obtain a fractional structure of the DCT-II coefficients \(\widehat {f}_{k}\) as exploited in Section 3.1.

Assume now that the function f in (1.1) also contains parameters ϕj such that ϕjhN = kπ, k ∈{0,…,N − 1}, and that the input data fk in (2.2) are exact. Then we can write f(t) as a sum f(t) = f(1)(t) + f(2)(t), where

$$ f^{(1)}(t) = \sum\limits_{j=1}^{M_{1}} \gamma_{j} \cos(\phi_{j} t), \qquad \phi_{j} h N \not \in \pi \mathbb{Z}, \ j=1,\ldots,M_{1}, $$
(3.16)

and

$$ f^{(2)}(t) = \sum\limits_{j=M_{1}+1}^{M} \gamma_{j} \cos(\phi_{j} t), \qquad \phi_{j} h N \!\in\! \{0, {\ldots} ,\pi(N-1)\}, \ j = M_{1}+1,{\ldots} ,M. $$
(3.17)

Let \(\hat {\mathbf f}^{(1)} = \big ((\hat {f}^{(1)})_{k}\big )_{k=0}^{N-1}\) and \(\hat {\mathbf f}^{(2)} = \big ((\hat {f}^{(2)})_{k}\big )_{k=0}^{N-1}\) denote the DCT-II vectors of \(\big (f^{(1)}_{\ell }\big )_{\ell =0}^{N-1}\) and \(\big (f^{(2)}_{\ell }\big )_{\ell =0}^{N-1}\) respectively. Again we aim at exploiting the special structure of these two DCT-II-vectors.

It follows as in (3.7) that for k = 0,…,N − 1,

$$ (-1)^{k} \left( \cos\left( \frac{\pi k}{2N} \right) \right)^{-1} \widehat{f}^{(1)}_{k} = \sum\limits_{j=1}^{M_{1}} \frac{\gamma_{j} \sin \left( \frac{ \phi_{j} h}{2} \right) \sin (\phi_{j} h N) }{ \cos\left( \frac{\pi k}{N} \right)- \cos\left( \phi_{j} h \right) }. $$

Now we compute \(\hat {\mathbf f}^{(2)} = \big (\hat {f}^{(2)}_{\ell }\big )_{\ell =0}^{N-1}\). As in (3.2) we have for k = 0,…,N − 1,

$$ \widehat{f}^{(2)}_{k} = \sum\limits_{j=M_{1}+1}^{M} \gamma_{j} \sum\limits_{\ell=0}^{N-1} \frac{1}{2}\! \left( \! \cos \left( \!(2\ell + 1) \Big(\frac{\phi_{j} h}{2} + \frac{k\pi}{2N} \Big)\right) + \cos\! \left( \!(2\ell + 1) \Big(\frac{\phi_{j} h}{2} \! -\! \frac{k\pi}{2N} \Big)\!\right)\! \right)\!. $$
(3.18)

We distinguish three cases. If \(k \not \in \frac {h N}{\pi } \{\phi _{M_{1}+1}, {\ldots } , \phi _{M}\}\), then \(\left (\frac {\phi _{j}h}{2} \pm \frac {k\pi }{2N}\right ) \not \in \pi \mathbb {Z}\), and therefore (3.4) implies

$$ \widehat{f}^{(2)}_{k} = \sum\limits_{j=M_{1}+1}^{M} \frac{\gamma_{j}}{4} \left( \frac{\sin (\phi_{j} hN +k\pi)}{\sin\left( \frac{\phi_{j}h}{2} + \frac{k\pi}{2N} \right)} + \frac{\sin (\phi_{j} h N -k\pi)}{\sin\left( \frac{\phi_{j}h}{2} - \frac{k\pi}{2N} \right) } \right) =0. $$

If \(k \in \frac {h N}{\pi } \{\phi _{M_{1}+1}, {\ldots } , \phi _{M}\} \setminus \{ 0 \}\), say \(k\pi =\phi _{j^{\prime }} hN\), then we have \(\left (\frac {\phi _{j}h}{2} \pm \frac {k\pi }{2N} \right ) \not \in \pi \mathbb {Z}\) for \(j \in \{M_{1}+1, {\ldots } , M\} \setminus \{j^{\prime }\}\). Thus, from (3.18) applying again (3.4) and (3.3), we get

$$ \begin{array}{@{}rcl@{}} \widehat{f}^{(2)}_{k} &= & \sum\limits_{\substack{j=M_{1}+1 \\ j\neq j^{\prime}}}^{M} \frac{\gamma_{j}}{4} \left( \frac{\sin (\phi_{j} hN +k\pi)}{\sin\left( \frac{\phi_{j}h}{2} + \frac{k\pi}{2N} \right)} + \frac{\sin (\phi_{j} h N -k\pi)}{\sin\left( \frac{\phi_{j}h}{2} - \frac{k\pi}{2N} \right) } \right)\\ &&+ \frac{\gamma_{j^{\prime}}}{2} \sum\limits_{\ell=0}^{N-1} \left( \cos \left( (2\ell+1) \frac{k\pi}{N} \right) + \cos (0) \right) \\ &=& \frac{\gamma_{j^{\prime}} \sin(2k \pi)}{4\sin\left( \frac{k\pi}{N} \right)} + \frac{\gamma_{j^{\prime}}}{2} N= \frac{\gamma_{j^{\prime}}}{2} N. \end{array} $$
(3.19)

Finally, if there exists a \(\phi _{j^{\prime }} \in \{\phi _{M_{1}+1}, {\ldots } , \phi _{M} \}\) with \(\phi _{j^{\prime }} =0\), then (3.18) implies

$$ \widehat{f}^{(2)}_{0} = \gamma_{j^{\prime}} N. $$

Summarizing, we have for k = 0,…,N

$$ \widehat{f}_{k} = \begin{cases} \widehat{f}^{(1)}_{k} & k \not\in \frac{h N}{\pi} \{\phi_{M_{1}+1}, {\ldots} ,\phi_{M}\}, \\ \widehat{f}^{(1)}_{k} + \frac{N}{2} \gamma_{j^{\prime}} & k= \frac{\phi_{j^{\prime}} h N}{\pi} \in \frac{h N}{\pi} \{\phi_{M_{1}+1}, {\ldots} ,\phi_{M}\} \setminus \{0\}, \\ \widehat{f}^{(1)}_{k} + N \gamma_{j^{\prime}} & k= \frac{\phi_{j^{\prime}} h N}{\pi} =0 \in \frac{h N}{\pi} \{\phi_{M_{1}+1}, {\ldots} ,\phi_{M}\} . \end{cases} $$
(3.20)

In other words, we have \(\widehat {f}_{k}= \widehat {f}^{(1)}_{k}\) for NM + M1 indices k ∈{0,…,N − 1}. Similarly as in [11], we can therefore apply the ESPIRA-I Algorithm 2 also in this case. Then the application of the AAA Algorithm 3 in the second step will lead to a rational function \(r_{M_{1}}\) of type (M1,M1) that satisfies \(r_{M_{1}}(\cos \limits (\frac {\pi k}{N})) = g_{k} = (-1)^{k} (\cos \limits (\frac {\pi k}{2N}))^{-1} \widehat {f}_{k}\) for all \(k \not \in \{\phi _{M_{1}+1}, {\ldots } ,\phi _{M}\}\), while the interpolation values at indices \(k \in \{\phi _{M_{1}+1}, {\ldots } ,\phi _{M}\}\) will be recognized as so-called unattainable points. Therefore, Algorithm 2 will provide all parameters to recover the function f(1). We refer to Section 3.5 to show that, for exact input data, Algorithm 3 indeed stops after M + 1 iteration steps regardless of occurring integer frequencies. The periodic function f(2) can be determined in a post-processing step. Considering the vector \(\widehat {\mathbf f }^{(2)} = \left (\widehat {f}^{(2)}_{k} \right )_{k=0}^{N-1} = \left (\widehat {f}_{k} - \widehat {f}^{(1)}_{k}\right )_{k=0}^{N-1}\), we simply recognize the indices k corresponding to the nonzero components of \(\widehat {\mathbf f}^{(2)}\) and obtain \(\phi _{j^{\prime }} = \frac {k \pi }{h N}\) as well as the corresponding coefficients \(\gamma _{j^{\prime }}\) from (3.20).

Remark 3.1

In case of noisy data or for function approximation, this special case of frequencies \(\phi _{j} = \frac {k \pi }{h N} \) with \(k \in {\mathbb Z}\) does not usually occur. One indication of frequency parameters close to \(\frac { \pi }{h N} \mathbb {Z}\) is provided by the weight vector in Algorithm 3. If components of wS are close to zero, then the corresponding sample value is not interpolated but an unattainable point. In this case, a post-processing step to add frequencies from \(\frac { \pi }{h N} {\mathbb Z}\) may be applied.

3.5 Interpolation for exact input data

In this subsection we will study the AAA Algorithm 3 in our setting for the reconstruction of cosine sums (1.1) from exact input data. We will show that in this case the AAA algorithm will terminate after M + 1 iteration steps and provides a rational function of type (M − 1,M) that satisfies all interpolation conditions (3.9).

Based on the observations above, we first consider the Loewner matrices LNj,j obtained in step 2 of Algorithm 3 more closely. We will prove that LNj,j has rank M for any j with MjNM.

Theorem 3.2

Let f be an M-sparse cosine sum as in (1.1), and let \({\mathbf f} =(f_{\ell })_{\ell =0}^{N-1}\) with \(f_{\ell } = f\left (\frac {h(2\ell +1)}{2} \right )\) be given, where N > 2M. Further let \(\hat {\mathbf f} = {\mathbf C}_{N}^{{II}} {\mathbf f}\) be the DCT-II vector with \({\mathbf C}_{N}^{{II}}\) as in (3.1). Then, for any partition S ∪Γ of {0,…,N − 1}, where both subsets have at least M elements, i.e., |S|≥ M and |Γ|≥ M, it follows that the Loewner matrix

$$ {\mathbf L}_{|{\Gamma}|, |S|} = \left( \frac{g_{\ell} - g_{k}}{\cos \big(\frac{\pi \ell}{N}\big)- \cos \big(\frac{\pi k}{N} \big)} \right)_{\ell \in {\Gamma}, k \in S} $$

with \(g_{k} = (-1)^{k} \big ({\cos \limits } \big (\frac {\pi k}{2N}\big )\big )^{-1} \hat {f}_{k}\) for k = 0,…,N − 1, has exactly rank M.

proof

  1. 1.

    Assume first that all frequencies ϕj satisfy \(\phi _{j} \not \in \frac { \pi }{h N} {\mathbb Z}\). Then by (3.7) we obtain

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}_{|{\Gamma}|, |S|} &=& \left( \frac{\sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos \big(\frac{\pi \ell}{N} \big)- \cos \big(\phi_{j} h \big) } - \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos \big(\frac{\pi k}{N} \big)- \cos \big(\phi_{j} h\big) }}{\cos \big(\frac{\pi \ell}{N} \big)- \cos \big(\frac{\pi k}{N} \big)} \right)_{\ell \in {\Gamma}, k \in S} \\ &=& \left( \frac{\sum\limits_{j=1}^{M} \gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) \frac{ \left( \cos \big(\frac{\pi k}{N} \big)- \cos \big(\phi_{j} h\big) - \cos \big(\frac{\pi \ell}{N}\big) + \cos \big(\phi_{j} h\big) \right)}{\left( \cos \big(\frac{\pi k}{N} \big)- \cos \big(\phi_{j} h\big) \right) \left( \cos \big(\frac{\pi \ell}{N} \big)- \cos \big(\phi_{j} h\big) \right)}}{\cos \big(\frac{\pi \ell}{N} \big) - \cos \big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}, k \in S} \\ &=& \left( - \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN )}{\left( \cos \big(\frac{\pi k}{N} \big)- \cos \big(\phi_{j} h\big) \right) \left( \cos \big(\frac{\pi \ell}{N}\big) - \cos \big(\phi_{j} h\big) \right)} \right)_{\ell \in {\Gamma}, k \in S} \\ &=& {\mathbf C}_{|{\Gamma}|,M} \text{diag} \left( -\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin \big(\phi_{j} hN\big) \right)_{j=1}^{M} {\mathbf C}_{|S|,M}^{T} \end{array} $$
    (3.21)

    with the Cauchy matrices

    $$ \textstyle {\mathbf C}_{|{\Gamma}|,M} := \left( \frac{1}{\cos \big(\frac{\pi \ell}{N}\big)- \cos\big(\phi_{j} h \big)} \right)_{\ell \in {\Gamma}, j=1, \ldots, M}, \quad {\mathbf C}_{|S|,M}:= \left( \frac{1}{\cos \big(\frac{\pi k}{N}\big) - \cos \big(\phi_{j} h\big)} \right)_{k \in S, j=1, \ldots, M}. $$

    The assertion now directly follows from this factorization since C|Γ|,M and C|S|,M have full column rank M, while the diagonal matrix has full rank by assumption.

  2. 2.

    Assume now that f in (1.1) also contains frequencies \(\phi _{j} \in \frac { \pi }{h N} {\mathbb Z}\). Then we can apply our considerations from Section 3.4. Assume that f = f(1) + f(2) where f(1) contains the frequencies \(\phi _{j} \not \in \frac { \pi }{h N}{\mathbb Z}\) for j = 1,…,M1, and f(2) contains the frequencies \(\phi _{j}= \frac { \pi }{h N}k_{j}\) with kj ∈{0,…,N − 1} for j = M1 + 1,…,M. We denote \(g_{k}^{(1)} := (-1)^{k} \big ({\cos \limits } \big (\frac {\pi k}{2N}\big )\big )^{-1} \hat {f}^{(1)}_{k}\) and \(g_{k}^{(2)} := (-1)^{k} \big (\cos \limits \big (\frac {\pi k}{2N}\big )\big )^{-1} \hat {f}^{(2)}_{k}\). Then, by (3.7) and (3.20) we still have for all k with \(k \notin \frac { hN}{\pi } \{ \phi _{M_{1}+1}, {\ldots } , \phi _{M}\}\),

    $$ \begin{array}{@{}rcl@{}} g_{k} &=& g_{k}^{(1)} = (-1)^{k} \big(\cos \big(\frac{\pi k}{2N} \big) \big)^{-1} \hat{f}^{(1)}_{k} = \sum\limits_{j=1}^{M_{1}} \frac{\gamma_{j} \sin \big(\frac{h \phi_{j} }{2} \big) \sin (\phi_{j} hN) }{ \cos\big(\frac{\pi k}{N} \big)- \cos\big(\phi_{j} h\big)},\\ g_{k}^{(2)} &=& 0, \end{array} $$

    while for all \(k_{j} = \frac {\phi _{j} hN}{\pi }\), j = M1 + 1,…,M,

    $$ \begin{array}{@{}rcl@{}} g_{k_{j}} & = & (-1)^{k_{j}} \big(\cos \big(\frac{\pi k_{j}}{2N}\big)\big)^{-1} \big(\hat{f}^{(1)}_{k_{j}} + \hat{f}^{(2)}_{k_{j}} \big)=g_{k_{j}}^{(1)} + g_{k_{j}}^{(2)}\\ &= & (-1)^{k_{j}} \big(\cos \big(\frac{\pi k_{j}}{2N}\big)\big)^{-1} \hat{f}^{(1)}_{k_{j}} + (-1)^{k_{j}} \big(\cos \big(\frac{\pi k_{j}}{2N} \big) \big)^{-1} \epsilon_{j} N \frac{\gamma_{j}}{2} \end{array} $$

    with 𝜖j = 1 for kj≠ 0 and 𝜖j = 2 for kj = 0. Assume that \( k_{j} = \frac {\phi _{j} hN}{\pi } \in {\Gamma }\) for j = M1 + 1,…,M. Then it follows that the Loewner matrix L|Γ|,|S| is of the form

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}_{|{\Gamma}|,|S|} &= \widetilde{\mathbf L}_{|{\Gamma}|,|S|}+ \overset{\approx}{\mathbf L}_{|{\Gamma}|,|S|}, \end{array} $$
    (3.22)

    where

    $$ \begin{array}{@{}rcl@{}} \displaystyle\widetilde{\mathbf L}_{|{\Gamma}|,|S|} &:=& \left( \frac{g_{\ell}^{(1)} - g_{k}^{(1)}}{\cos \big(\frac{\pi \ell}{N} \big)- \cos \big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}, k \in S} \\ &=&\left( \frac{\sum\limits_{j=1}^{M_{1}} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos\big(\frac{\pi \ell}{N} \big)- \cos\big(\phi_{j} h \big) } - \sum\limits_{j=1}^{M_{1}} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos\big(\frac{\pi k}{N} \big)- \cos\big(\phi_{j} h \big) }}{\cos \big(\frac{\pi \ell}{N} \big)- \cos\big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}, k \in S} \\ &=& {\mathbf C}_{|{\Gamma}|,M_{1}} \text{diag} \left( - \gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin \left( \phi_{j} hN \right) \right)_{j=1}^{M_{1}} {\mathbf C}_{|S|,M_{1}}^{T} \end{array} $$
    (3.23)

    corresponds to the function f(1) and where

    $$ \begin{array}{@{}rcl@{}} \!\displaystyle\overset{\approx}{\mathbf L}_{|{\Gamma}|,|S|}\! &: =&\!\! \left( \frac{ g_{\ell}^{(2)} - g_{k}^{(2)}}{\cos \big(\frac{\pi \ell}{N}\big) - \cos\big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}, k \in S} = \left( \frac{ g_{\ell}^{(2)}}{\cos \big(\frac{\pi \ell}{N}\big) - \cos\big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}, k \in S} \\ &= &\!\! \sum\limits_{j=M_{1}+1}^{M} \! \epsilon_{j} N \frac{\gamma_{j}}{2} (-1)^{k_{j}}\!\big(\!\cos\! \big(\frac{\pi k_{j}}{2N}\big)\big)^{-1} {\mathbf e}_{\text{ind}(k_{j})}\!\! \ \left( \! \frac{1}{\cos\!\big(\frac{\pi k_{j} }{N}\big) \! -\! \cos\!\big(\frac{\pi k}{N}\big) } \!\right)^{T}_{k \in S}\!\\ \end{array} $$
    (3.24)

    corresponds to f(2). Here \({\mathbf e}_{\text {ind}(k_{j})} \) denotes the ind(kj)-th unit vector of length |Γ| and ind(kj) denotes the position, or index, of kj in the ordered set Γ. Therefore we have rank \(\widetilde {\mathbf L}_{|{\Gamma }|,|S|} = M_{1}\) and rank \(\overset {\approx }{\mathbf L}_{|{\Gamma }|,|S|} = M-M_{1}\), such that rank \({\mathbf L}_{|{\Gamma }|,|S|} \le \text {rank} \widetilde {\mathbf L}_{|{\Gamma }|,|S|} + \text {rank} \overset {\approx }{\mathbf L}_{|{\Gamma }|,|S|} = M\). The image of \(\widetilde {\mathbf L}_{|{\Gamma }|,|S|}\) is spanned by the M1 independent columns of the Cauchy matrix \({\mathbf C}_{|{\Gamma }|,M_{1}} = \Big (\frac {1}{{\cos \limits } \big (\frac {\pi \ell }{N}\big ) - {\cos \limits } \big (\phi _{j} h\big )} \Big )_{\ell \in {\Gamma }, j=1}^{M_{1}}\), while the image of \(\overset {\approx }{\mathbf L}_{|{\Gamma }|,|S|}\) is spanned by the MM1 unit vectors \({\mathbf e}_{\text {ind}(k_{j})}\), j = M1 + 1,…,M. Since these two spans are linearly independent, we have indeed rank L|Γ|,|S| = M. The remaining cases, where either \(k_{j} = \frac {\phi _{j} hN}{\pi }\), j = M1 + 1,…,M, are all contained in S, or that the set \(\{k_{j} = \frac {\phi _{j} hN}{\pi }, j=M_{1}, {\ldots } , M\}\) is split into two subsets, one contained in Γ and one in S, can be treated similarly.

Using Theorem 3.2 we will show that Algorithm 3 stops after step M + 1, since we will find a singular vector w in the kernel of LNM− 1,M+ 1. Thus, the minimal value of the sum in (3.12) will be equal to zero. First we consider the case when all parameters ϕj are not in \(\frac { \pi }{h N} {\mathbb Z}\).

Corollary 3.3

Let f be an M-sparse cosine sum as in (1.1) with \(\phi _{j} \not \in \frac { \pi }{h N} {\mathbb Z}\) for j = 1,…,M, and let \({\mathbf f} =(f_{\ell })_{\ell =0}^{N-1}\) with \(f_{\ell } = f\left (\frac {h(2\ell +1)}{2} \right )\) be given, where N > 2M. Further let \(\hat {\mathbf f} = {\mathbf C}_{N}^{{II}} {\mathbf f}\) be the DCT-II vector with \({\mathbf C}_{N}^{{II}}\) as in (3.1). Then Algorithm 3 terminates after M + 1 steps and determines a partition SM+ 1 ∪ΓM+ 1 of I := {0,…,N − 1} with |SM+ 1| = M + 1 and |ΓM+ 1| = NM − 1 and a rational function rM(z) of type (M − 1,M) satisfying interpolation conditions

$$ r_{M} \left( \cos\left( \frac{\pi k}{N} \right) \right) =(-1)^{k} \left( \cos\left( \frac{\pi k}{2N} \right) \right)^{-1} \widehat{f}_{k} $$
(3.25)

for k = 0,…,N − 1.

proof

First observe that a rational function \(r_{M}(z) = \frac {p_{M-1}(z)}{q_{M}(z)} \) with numerator polynomial pM− 1(z) of degree at most M − 1 and denominator polynomial qM(z) of degree M is already completely determined by 2M (independent) interpolation conditions if the rational interpolation problem is solvable at all. But solvability is clear because of (3.7). In particular, the given data \((-1)^{k} \left (\cos \limits \big (\frac {\pi k}{2N} \big ) \right )^{-1} \widehat {f}_{k}\), kI, cannot be interpolated by a rational function of smaller type than (M − 1,M).

Assume now that at the (M + 1)-st iteration step in Algorithm 3, the index set SM+ 1I with M + 1 interpolation indices has been chosen, and let ΓM+ 1 = ISM+ 1. Then the Loewner matrix LNM− 1,M+ 1 obtained after M + 1 iterations steps has rank M according to Theorem 3.2. Therefore, the kernel of LNM− 1,M+ 1 has dimension 1, and the normalized vector w = wS in step 3 of Algorithm 3 satisfies LNM− 1,M+ 1w = 0. According to (3.21) we observe that

$$ {\mathbf C}_{M+1,M}^{T} {\mathbf w} =\left( \frac{1}{\cos \big(\frac{\pi k}{N}\big) - \cos \big(\phi_{j} h\big)} \right)_{j=1, \ldots, M, \ k \in S_{M+1}} {\mathbf w} = {\mathbf 0}. $$

Since any M columns of the Cauchy matrix \({\mathbf C}_{M+1,M}^{T}\) are linearly independent, we conclude that all components of w are nonzero. By construction it follows that a rational function \(\tilde {r}_{M}\) in (3.13) satisfies interpolation conditions (3.25) for kSM+ 1. On the other hand, since LNM− 1,M+ 1w = 0 we find that

$$ \sum\limits_{k\in S_{M+1}}\left( \frac{g_{\ell} w_{k}}{\cos\frac{\pi \ell}{N} -\cos\frac{\pi k}{N} } - \frac{g_{k} w_{k}}{\cos\frac{\pi \ell}{N} -\cos\frac{\pi k}{N} } \right)=0, \ \ \ell\in {\Gamma}_{M+1}, $$

with \(g_{k}=(-1)^{k} \left (\cos \limits \big (\frac {\pi k}{2N} \big ) \right )^{-1} \widehat {f}_{k}\), which implies that for \(\tilde {r}_{M}\) in (3.13) the interpolation conditions (3.25) hold also for ∈ΓM+ 1. Since a rational function satisfying all interpolation conditions is uniquely determined, the obtained rational function \(\tilde {r}_{M}\) in barycentric form (3.13) coincides with rM in (3.8) and needs to have type (M − 1,M). That means that Algorithm 3 provides the wanted rational function rM(z). □

Similarly, we show the following result for the case of frequency parameters \(\phi _{j} \in \frac { \pi }{h N} {\mathbb Z}\).

Corollary 3.4

Let f(t) = f1(t) + f2(t) be of the form (3.16) and (3.17) with \(0 \le M_{1} <M \in {\mathbb N}\). Let \({\mathbf f} =(f_{\ell })_{\ell =0}^{N-1}\) with \(f_{\ell } = f\left (\frac {h(2\ell +1)}{2} \right )\) be given, where N > 2M. Further let \(\hat {\mathbf f} = {\mathbf C}_{N}^{{II}} {\mathbf f}\) be the DCT-II vector with \({\mathbf C}_{N}^{{II}}\) as in (3.1). Then the modification of Algorithm 3 described in Section 3.4 terminates after M + 1 steps and determines a partition SM+ 1 ∪ΓM+ 1 of I := {0,…,N − 1} and a rational function \(r_{M_{1}}(z)\) of type (M1 − 1,M1) satisfying

$$ r_{M_{1}} \left( \cos\big(\frac{\pi k}{N} \big) \right) =(-1)^{k} \left( \cos\big(\frac{\pi k}{2N} \big) \right)^{-1} \widehat{f}^{(1)}_{k}, $$
(3.26)

k = 0,…,N − 1.

proof

At the (M + 1)-st iteration step of Algorithm 3 we obtain a Loewner matrix LNM− 1,M+ 1, which according to Theorem 3.2 has rank M. Similarly as in the proof of Theorem 3.2 we can show that a Loewner matrix LNJ,J, computed at the J-th iteration step of Algorithm 3 with J < M + 1, has full column rank J. Thus the Algorithm 3 does not stop earlier than after M + 1 iteration steps.

At the (M + 1)-st iteration step of Algorithm 3 we obtain a partition SM+ 1 ∪ΓM+ 1 of the set I. Similarly as in the proof of Theorem 3.2, we assume that \(k_{j} = \frac {\phi _{j} hN}{\pi } \in {\Gamma }_{M+1}\) for j = M1 + 1,…,M. Then the Loewner matrix LNM− 1,M+ 1 has the structure as in (3.22) with sets ΓM+ 1 and SM+ 1 instead of Γ and S respectively. Since the Loewner matrix LNM− 1,M+ 1 has rank M, the Loewner matrix \(\tilde {\mathbf L}_{N-M-1, M+1}\) has rank M1 due to factorization (3.23) and we have MM1 frequency parameters ϕj satisfying ϕjhN ∈{0,…,π(N − 1)}, j = M1 + 1,…,M. Then, each of MM1 rank-1 matrices in (3.24) enlarges the rank of LNM− 1,M+ 1 by 1. Therefore, the normalized kernel vector \( \mathbf{w} = \mathbf{w}_{S}\in \mathbb{C}^{M+1}\) in step 3 of Algorithm 3 is uniquely defined and satisfies LNM− 1,M+ 1w = 0 as well as \(\tilde {{\mathbf L}}_{N-M-1,M+1} {\mathbf w}={\mathbf 0}\) and \(\left (\frac {1}{\cos \limits \big (\frac {\pi k_{j} }{N}\big ) - \cos \limits \big (\frac {\pi k}{N}\big ) } \right )^{T}_{k \in S_{M+1}} {\mathbf w}={\mathbf 0}\). Let \(\tilde {r}_{M}\) be a rational function in barycentric form (3.13) constructed by Algorithm 3 after M + 1 iteration steps. Then from \(\tilde {\mathbf {L}}_{N-M-1,M+1} {\mathbf w}={\mathbf 0}\) we get the interpolation conditions (3.26) for k ∈ΓM+ 1. According to the construction procedure we find (3.26) also for kSM+ 1. Further we simplify \(\tilde {r}_{M}\) by removing all zero components of w in definition (3.13). Then, instead of \(\tilde {r}_{M}\) we obtain a rational function \(r_{M_{1}}\) of type (M1 − 1,M1) satisfying (3.26). If the frequencies \(k_{j} = \frac {\phi _{j} hN}{\pi }\) are contained in SM+ 1 or in both index sets SM+ 1 and ΓM+ 1, the assertions can be shown similarly. □

3.6 ESPIRA II: ESPIRA as matrix pencil method for Loewner matrices

At the first glance, the two algorithms ESPRIT in Algorithm 1 and ESPIRA-I in Algorithm 2 for reconstruction of cosine sums seem to be completely unrelated. In this section, we will show that the ESPIRA algorithm can be also understood as a matrix pencil method, but for Loewner instead of Hankel + Toeplitz matrices.

Theorem 3.5

Let f be an M-sparse cosine sum as in (1.1), and let \({\mathbf f} =(f_{\ell })_{\ell =0}^{N-1}\) with \(f_{\ell } = f\big (\frac {h(2\ell +1)}{2} \big )\) be given, where N > 2M. Further let \(\hat {\mathbf f} = {\mathbf C}_{N}^{{II}} {\mathbf f}\) be the DCT-II vector with \({\mathbf C}_{N}^{{II}}\) as in (3.1). Let SM ∪ΓM be a partition of {0,…,N − 1} with |SM| = M and |ΓM| = NM. Then the values \(z_{j}= {\cos \limits } \big (\phi _{j} h\big )\), j = 1,…,M, with frequencies ϕj of f in (1.1) are the eigenvalues of the Loewner matrix pencil

$$ z {\mathbf L}^{(0)}_{N-M,M} - {\mathbf L}^{(1)}_{N-M,M} $$
(3.27)

with

$$ \begin{array}{@{}rcl@{}} {\mathbf L}^{(0)}_{N-M,M} & = & \left( \frac{g_{\ell} - g_{k}}{\cos \big(\frac{\pi \ell}{N}\big) - \cos \big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}_{M}, k \in S_{M}},\\ {\mathbf L}^{(1)}_{N-M,M} & = & \left( \frac{g_{\ell} \cos \big(\frac{\pi \ell}{N}\big)- g_{k} \cos \big(\frac{\pi k}{N}\big)}{\cos \big(\frac{\pi \ell}{N}\big) - \cos \big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}_{M}, k \in S_{M}}, \end{array} $$

where \(g_{k} = (-1)^{k} \big (\cos \limits \big (\frac {\pi k}{2N}\big )\big )^{-1} \hat {f}_{k}\) for k = 0,…,N − 1.

proof

  1. 1.

    Assume first that all wanted frequencies ϕj are not in \(\frac {\pi }{hN} {\mathbb Z}\). Then, as in (3.21), we find for \({\mathbf L}^{(0)}_{N-M,M}\) the factorization

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}^{(0)}_{N-M,M} = {\mathbf C}_{N-M,M} \text{diag} \left( - \gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin \left( \phi_{j} hN \right) \right)_{j=1}^{M} {\mathbf C}_{M,M}^{T} \end{array} $$

    with Cauchy matrices

    $$ \begin{array}{@{}rcl@{}} {\mathbf C}_{N-M,M} & := & \left( \frac{1}{\cos \big(\frac{\pi \ell}{N}\big) - \cos (\phi_{j} h) }\right)_{\ell \in {\Gamma}_{M}, j=1, {\ldots} , M}, \\ {\mathbf C}_{M,M} & := & \left( \frac{1}{\cos \big(\frac{\pi k}{N}\big)- \cos(\phi_{j}h) } \right)_{k \in S_{M}, j=1, {\ldots} , M}. \end{array} $$

    For the second Loewner matrix we find with (3.7)

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}^{(1)}_{N-M,M} &=& \textstyle \left( \frac{ \cos \big(\frac{\pi\ell}{N}\big) \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos\big(\frac{\pi \ell}{N}\big) - \cos (\phi_{j} h) } - \cos\big(\frac{\pi k}{N}\big) \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) }{ \cos\big(\frac{\pi k}{N}\big) - \cos (\phi_{j} h) }}{\cos \big(\frac{\pi \ell}{N}\big) - \cos \big(\frac{\pi k}{N}\big)} \right)_{\ell \in {\Gamma}_{M}, k \in S_{M}}\\ &=& \!\textstyle \left( \sum\limits_{j=1}^{M}\! \frac{\gamma_{j} \sin \! \big(\frac{\phi_{j} h}{2}\big) \sin (\phi_{j} hN) \left( \cos \!\big(\frac{\pi\ell}{N}\big) \big(\cos \! \big(\frac{\pi k}{N}\big) - \cos(\phi_{j} h)\big) - \cos\big(\frac{\pi k}{N}\big) \big(\cos \big(\frac{\pi \ell}{N}\big) - \cos(\phi_{j}h)\big)\right)}{\big(\cos \left( \frac{\pi k}{N}\right) - \cos(\phi_{j} h)\big) \big(\cos\left( \frac{\pi \ell}{N}\right) - \cos(\phi_{j} h)\big) \big(\cos \left( \frac{\pi \ell}{N}\right) - \cos \frac{\pi k}{N}\big)} \!\right)_{\!\ell \in {\Gamma}_{M}, k \in S_{M}} \\ &=& \textstyle -\left( \sum\limits_{j=1}^{M} \frac{\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) \cos \big(\phi_{j}h \big)}{\big(\cos \big(\frac{\pi k}{N}\big) - \cos \big(\phi_{j} h\big) \big) \big(\cos \big(\frac{\pi \ell}{N}\big) - \cos\big(\phi_{j} h\big)\big) } \right)_{\ell \in {\Gamma}, k \in S}\\ &= &\textstyle {\mathbf C}_{N-M,M} \text{diag} \left( -\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN ) \cos \big(\phi_{j} h\big) \!\right)_{j=1}^{M} {\mathbf C}_{M,M}^{T}. \end{array} $$

    Therefore

    $$ \begin{array}{@{}rcl@{}} && z {\mathbf L}^{(0)}_{N-M,M} - {\mathbf L}^{(1)}_{N-M,M}\\ & =& {\mathbf C}_{N-M,M} \text{diag} \left( -\gamma_{j} \sin \big(\frac{\phi_{j} h}{2}\big) \sin (\phi_{j} hN) \big(z-\cos(\phi_{j}h)\big) \right)_{j=1}^{M} {\mathbf C}_{M,M}^{T} \end{array} $$

    has a reduced rank M − 1 if and only if \(z-\cos \limits (\phi _{j}h) = 0\).

  2. 2.

    Assume now that \(\phi _{j} \not \in \frac {\pi }{hN}{\mathbb Z}\) for j = 1,…,M1 and that \(\frac {h N}{\pi } \phi _{j} = k_{j} \in \{0, {\ldots } , N-1\}\) for j = M1 + 1,…,M. Similarly as in the proof of Theorem 3.2, assume for simplicity that all these indices kj are in ΓM. Then we find as in the proof of Theorem 3.2 that

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}_{N-M,M}^{(0)}\! &=& \! {\mathbf C}_{N-M,M_{1}} \text{diag} \left( -\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin \big(\phi_{j} hN\big) \right)_{j=1}^{M_{1}} {\mathbf C}_{M,M_{1}}^{T} \\ && \!+ \! \sum\limits_{j=M_{1}+1}^{M} \epsilon_{j} N (-1)^{k_{j}} \big(\cos \big(\frac{k_{j} \pi}{2N}\big)\big)^{-1} \frac{\gamma_{j}}{2} {\mathbf e}_{\text{ind}(k_{j})} \left( \frac{1}{\cos\big(\frac{ \pi k_{j} }{N}\big) - \cos\big(\frac{\pi k}{N}\big) } \right)^{T}_{k \in S_{M}}. \end{array} $$

    For the second matrix we find analogously as above

    $$ \begin{array}{@{}rcl@{}} {\mathbf L}_{N-M,M}^{(1)} & =& \textstyle {\mathbf C}_{N-M,M_{1}} \text{diag} \left( - \gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN) \cos \big(\phi_{j} h \big) \right)_{j=1}^{M_{1}} {\mathbf C}_{M,M_{1}}^{T} \\ && + \textstyle \sum\limits_{j=M_{1}+1}^{M} \epsilon_{j} N (-1)^{k_{j}} \big(\cos \big(\frac{k_{j} \pi}{2N}\big)\big)^{-1} \frac{\gamma_{j}}{2} {\mathbf e}_{\text{ind}(k_{j})} \ \left( \frac{\cos \big(\phi_{j} h\big)}{\cos\big(\frac{\pi k_{j}}{N}\big) - \cos\big(\frac{\pi k}{N}\big) } \right)^{T}_{k \in S_{M}}, \end{array} $$

    where we have used the fact that \({\cos \limits } \big (\frac {\pi k_{j}}{N} \big )= {\cos \limits } \big (\phi _{j} h \big )\). Thus again, the matrix \(z {\mathbf L}_{N-M,M}^{(0)}- {\mathbf L}_{N-M,M}^{(1)}\) has only rank M − 1 if \(z= {\cos \limits } \big (\phi _{j} h\big )\) for j ∈{1,…,M}, where either the first matrix difference

    $$ {\mathbf C}_{N-M,M_{1}} \text{diag} \left( -\gamma_{j} \sin \big(\frac{\phi_{j} h}{2} \big) \sin (\phi_{j} hN ) \big(z-\cos \big(\phi_{j} h \big)\big) \right)_{j=1}^{M_{1}} {\mathbf C}_{M,M_{1}}^{T} $$

    has only rank M1 − 1 (if j ∈{1,…,M1}), or the second matrix difference

    $$ \sum\limits_{j=M_{1}+1}^{M} \epsilon_{j} N (-1)^{k_{j}} \big(\cos \big(\frac{k_{j} \pi}{2N}\big)\big)^{-1} \frac{\gamma_{j}}{2} {\mathbf e}_{\text{ind}(k_{j})} \ \left( \frac{ z-\cos \big(\phi_{j} h\big)}{\cos\big(\frac{\pi k_{j} }{N}\big) - \cos\big(\frac{\pi k}{N}\big) } \right)^{T}_{k \in S_{M}} $$

    has only rank MM1 − 1 instead of MM1 because of one vanishing term (if \(z= {\cos \limits } \big (\phi _{j}h\big )\) for j ∈{M1 + 1,…,M}). All further cases can be treated similarly.

Theorem 3.5 provides now a new approach to reconstruct all frequencies ϕj of f in (1.1). If the number of terms M is known, then we can theoretically use any arbitrary partition SM ∪ΓM to build the two Loewner matrices in Theorem 3.5 and to extract the frequencies ϕj ∈ [0,K] by solving the matrix pencil problem (3.27).

However in order to obtain better numerical stability, we will apply the greedy procedure of the AAA Algorithm 3 to build the index sets SM and ΓM and use this partition to construct the Loewner matrices. Moreover, incorporating this preconditioning procedure, we can still determine M. The complete algorithm for ESPIRA-II based on the matrix pencil method for Loewner matrices is summarized in Algorithm 5.

Algorithm 5
figure e

ESPIRA II.

Remark 3.6

Instead of solving \(\tilde {\mathbf C}_{N,M} {\mathbf a} = {\mathbf g}\) in step 5 of Algorithm 5 we could also directly solve VN,Mγ = f as in step 3 of Algorithm 1. Indeed, multiplying the system VN,Mγ = f with \(\text {diag}\big ((-1)^{k} \big ({\cos \limits } \big (\frac {\pi k}{2 N} \big )\big )^{-1} \big )_{k=0}^{N-1} {\mathbf C}_{N}^{II} \) from the left, where \({\mathbf C}_{N}^{II}\) is the cosine matrix defined by (3.1), we get

$$ \text{diag} \left( \!(-1)^{k} \big(\!\cos \big(\frac{\pi k}{2 N}\big) \!\big)^{-1} \right)_{k=0}^{N-1} {\mathbf C}_{N}^{II} {\mathbf V}_{N,M} {\mathbf{\gamma}} = \text{diag}\! \left( \!(-1)^{k} \big(\!\cos \big(\frac{\pi k}{2 N} \big)\!\big)^{-1} \!\right)_{k=0}^{N-1} {\mathbf C}_{N}^{II} {\mathbf f}. $$
(3.28)

Since \(\hat {\mathbf f} = {\mathbf C}_{N}^{II} {\mathbf f}\), we get for the right hand side of (3.28)

$$ \begin{array}{@{}rcl@{}} \text{diag} \left( (-1)^{k} \big(\cos \big(\frac{\pi k}{2 N} \big)\big)^{-1} \right)_{k=0}^{N-1} {\mathbf C}_{N}^{II} {\mathbf f} &=& \text{diag}\left( (-1)^{k} \big(\cos \big(\frac{\pi k}{2 N} \big)\big)^{-1} \right)_{k=0}^{N-1} \hat{\mathbf f}\\ &=& \left( (-1)^{k} \big(\cos\big(\frac{\pi k}{2N} \big) \big)^{-1} \widehat{f}_{k}\right)_{k=0}^{N-1}. \end{array} $$

For the left hand side of (3.28), using a similar computation as for \(\hat {\mathbf f}\) in Section 3.1, we have

$$ \begin{array}{@{}rcl@{}} \!\!\!&&\text{diag} \left( (-1)^{k} \big(\cos \big(\frac{\pi k}{2 N} \big)\big)^{-1} \right)_{k=0}^{N-1} {\mathbf C}_{N}^{II} {\mathbf V}_{N,M} {\mathbf{\gamma}}\\ \!\!&=& \text{diag}\! \left( \!(-1)^{k} \big(\cos \big(\frac{\pi k}{2 N}\big)\! \big)^{-1} \!\right)_{k=0}^{N-1} \!\left( \!(-1)^{k} \cos\! \big(\frac{\pi k}{2N}\big) \frac{\sin (\phi_{j} hN) \sin \big(\frac{\phi_{j} h}{2}\big)}{\cos\big(\frac{k\pi}{N}\big)\! -\!\cos\big(\phi_{j} h\big)} \right)_{k=0,j=1}^{N-1,M} {\mathbf{\gamma}} \\ \!\!&=& \left( \frac{1}{ \cos\big(\frac{k\pi}{N}\big)-\cos\big(\phi_{j} h\big) } \right)_{k=0,j=1}^{N-1,M} \text{diag} \left( \sin (\phi_{j} hN) \sin\big(\frac{\phi_{j} h}{2}\big) \right)_{j=1}^{M} {\mathbf{\gamma}} \\ \!\!& =& \left( \frac{1}{ \cos\big(\frac{k\pi}{N}\big)-\cos\big(\phi_{j} h\big) } \right)_{k=0,j=1}^{N-1,M} \left( \gamma_{j} \sin (\phi_{j} hN) \sin\big(\frac{\phi_{j} h}{2}\big) \right)_{j=1}^{M}, \end{array} $$

which proves the equivalence.

Algorithm 5 employs in the preconditioning step the greedy strategy of the AAA algorithm to find a suitable partition of the index set. Afterwords, we need to solve the matrix pencil problem for the Loewner matrices. This is done similarly as in the ESPRIT algorithm 1 for Toeplitz + Hankel matrices. One important advantage of the ESPIRA-II algorithm 5 is that we don’t longer need to treat integer frequencies in a post-processing step but can determine them directly. Analogously as for ESPIRA-I, we have for ESPIRA-II an overall computational cost of \({\mathcal O}(N (M^{3}+\log N))\), where the computation of DCT-II(N) requires \({\mathcal O}(N \log N)\) operations, the preconditioning step based on the AAA algorithm requires \({\mathcal O}(N M^{3})\) operations, and the SVD of the Loewner matrix of size (NM,2M) requires \({\mathcal O}(N M^{2})\) operations. For comparison, ESPRIT in Section 2 requires \({\mathcal O}(N L^{2})\) flops, and good recovery results are only achieved with LN/2, i.e. with complexity \({\mathcal O}(N^{3})\). This computational cost for ESPRIT can be reduced using truncated SVD.

4 Numerical experiments

In this section we compare the performance of all three algorithms, ESPIRA-I, ESPIRA-II, and ESPRIT, for reconstruction of cosine sums from exact and noisy input data. Further, we apply these algorithms to approximate even Bessel functions by short cosine sums. All algorithms are implemented in Matlab and use IEEE standard floating point arithmetic with double precision. The Matlab implementations can be found on http://na.math.uni-goettingen.de under software.

We consider short cosine sums as in (1.1),

$$ f(t) = \sum\limits_{j=1}^{M} \gamma_{j} \cos(\phi_{j} t), $$

with \(M \in {\mathbb N}\), \(\gamma _{j} \in {\mathbb R}\setminus \{ 0\}\), and the pairwise distinct frequency parameters ϕj ∈ [0,K) (with some K > 0 be given). By \(\tilde {f}\), \(\tilde {\phi }_{j}\) and \(\tilde {\gamma }_{j}\) we denote exponential sum, frequencies and coefficients respectively, reconstructed by our algorithms, and we define the relative errors by the following formulas

$$ e(\boldsymbol{\phi}) := \frac{\max\limits_{j=1,\ldots,M}|\phi_{j}-\tilde{\phi}_{j}|}{\max\limits_{j=1,\ldots,M}|\phi_{j}|} \quad\text{and}\quad e(\boldsymbol{\gamma}) := \frac{\max\limits_{j=1,\ldots,M}|\gamma_{j}-\tilde{\gamma}_{j}|}{\max\limits_{j=1,\ldots,M}|\gamma_{j}|}, \quad e(f) := \frac{\max|f(t)-\tilde{f}(t)|}{\max|f(t)|}, $$

i.e., e(ϕ) and e(γ) are the relative errors for the frequencies ϕj and the coefficients γj, respectively, and e(f) is the relative error of the exponential sum, where the maximum is taken over the equidistant values \(t \in [0, \frac {\pi N}{K}]\) with the step size 0.001.

4.1 Reconstruction of cosine sums from exact data

First, we consider one example for reconstruction of cosine sums from exact data. In order to get optimal recovery results from the ESPRIT algorithm, we always take the upper bound L for the order of exponential sums M to be L = N/2, where N is the number of given function samples. The number M of terms is not given beforehand but is recovered by each method.

Example 4.1

Let a signal f as in (1.1) be given by parameters M = 7, γj = j for j = 1,...,7 and

$$ \mathbf{\phi}=\left( \sqrt{20}, \sqrt{0.2}, \sqrt{5}, \sqrt{15}, \sqrt{3}, \sqrt{15.1}, \sqrt{7} \right). $$

We reconstruct f from N samples \(f_{\ell }= f\left (\frac {h (2\ell +1)}{2}\right )\), = 0,…,N − 1, with \(h=\frac {\pi }{K}\) for different values of N and K (see Table 1), but each time we consider the segment [0,5π]. We take ε = 10− 10 for ESPRIT and tol = 10− 13 for ESPIRA-I and -II. We see that for this example all algorithms work equally well.

Table 1 Results of Example 4.1

4.2 Reconstruction of cosine sums from noisy data

In this subsection we consider reconstruction of noisy data, where we assume that the given signal values fk from (1.1) are corrupted with additive noise, i.e., the measurements are of the form

$$ y_{k} = f_{k} + \epsilon_{k} = f\Big(\frac{h(2k+1)}{2} \Big) + \epsilon_{k}, \qquad k=0, {\ldots} , N-1, $$

where 𝜖k are assumed to be from a uniform distribution with mean value 0. We will compare the performance of ESPRIT and ESPIRA-II.

Example 4.2

Let f be given as in Example 4.1. We employ N noisy signal values yk = fk + 𝜖k, k = 0,…,N − 1, where the random noise \((\epsilon _{k})_{k=0}^{N-1}\) is generated in Matlab by 20⋆(rand(N,1)-0.5), i.e., we take uniform noise in the interval [− 10,10] with SNR (signal-to-noise ratio) and PSNR (peak signal-to-noise ratio) values as in Table 2. We employ N = 1600 or N = 2000 equidistant measurements with stepsize \(h=\frac {\pi }{50}\), i.e., K = 50. In the first case we use values on the interval [0,32π), in the second case on [0,40π). We compute 10 iterations and give the reconstruction errors for ESPRIT and for ESPIRA-II in Table 3. In the two algorithms ESPRIT and ESPIRA-II we assume that M = 7 is known beforehand and modify the algorithms accordingly. For ESPRIT we compute the SVD decomposition in step 1 of Algorithm 1 but do not compute the numerical rank of MNL+ 2,L and instead take the known M = 7 in step 2. For ESPIRA-II we set jmax = M + 1 = 8 in Algorithm 5. Further, for ESPIRA-II we use only the data gk, \(k=0, {\ldots } , \frac {N}{2}-1\) in order to avoid amplification of the error by the factor \(\cos \limits (\frac {\pi k}{2N})^{-1}\) in the definition of gk in Algorithm 5.

Table 2 SNR and PSNR values of the given noisy data with additive i.i.d. noise drawn from uniform distribution in [− 10,10] in Example 4.2 for N = 2000
Table 3 Reconstruction error for noisy data with additive i.i.d. noise drawn from uniform distribution in [− 10,10] in Example 4.2

As it can be seen in Table 3, the two algorithms ESPRIT and ESPIRA-II provide almost equally good results (ESPIRA-II works slightly better). In Fig. 1, we present the reconstruction results of the original function from the noisy data for ESPRIT and for ESPIRA-II. We plot the graphics and compute the relative errors e(f) in the segment [0,10].

Fig. 1
figure 1

Plot of the original function f(t) (black), the given noisy data (red dots), and the achieved reconstructions restricted to the interval [0,10] with N = 2000. Left: reconstruction by ESPRIT (blue). Right: reconstruction by ESPIRA-II (magenta)

Similarly good reconstruction results are obtained from noisy input data for the case where 𝜖k are i.i.d. random variables drawn from a standard normal distribution with mean value 0.

4.3 Approximation of even Bessel functions by short cosine sums

We consider one example for approximation of an even Bessel function by short cosine sums by three methods ESPIRA-I and -II and ESPRIT. The algorithms are implemented in Matlab and use IEEE standard floating point arithmetic with double precision.

By Jn(t), \(t \in \mathbb {R}\), we denote the Bessel function of the first kind of order \(n \in \mathbb {N}\). The power series expansion of this function is given by

$$ J_{n}(t)=\sum\limits_{k=0}^{\infty} \frac{(-1)^{k}}{k! (n+k)!} \left( \frac{t}{2}\right)^{2k+n}, \ t\geq 0. $$

Similarly as in [8], we define a modified Bessel function on the interval [0,B] by

$$ J_{n}(B,t)=\frac{B}{t} J_{n}(t), \ \ 0<t\leq B. $$
(4.1)

See Fig. 2 for n = 3 and B = 126. Then, J2m+ 1(B,t), m = 0,1,2,…, are even functions and therefore can be efficiently approximated by cosine sums.

Fig. 2
figure 2

Bessel function J3(B,t) on the interval [0,B] with B = 126

We take m = 1 and two different values of B = 95 and B = 126 and consider the approximation error

$$ \max\limits_{t \in [0, B]}\left| J_{3}\left( B, t \right)-\sum\limits_{j=1}^{25} \gamma_{j} \cos(\phi_{j} t) \right|. $$
(4.2)

We apply ESPIRA-I and ESPRIT with the following parameters: for the case B = 95 we take N = 300 values of the function \(J_{3}\left (95,t \right )\) at points \(t_{\ell } =\frac {h(2 \ell +1)}{2 }\) for = 0,1,…,299, with \(h=\frac {\pi }{10}\), i.e., t ∈ (0,30π) ⊂ (0,95). For the case B = 126 we use N = 400 values of the function \(J_{3}\left (126,t \right )\) at points \(t_{\ell } =\frac {h(2 \ell +1)}{2 }\) for = 0,1,…,399, with \(h=\frac {\pi }{10}\), i.e., t ∈ (0,40π) ⊂ (0,126). For ESPRIT each time we take L = N/2.

In case B = 95, the maximum approximation error in (4.2) provided by ESPIRA-I and ESPRIT are 1.60 ⋅ 10− 10 and 3.78 ⋅ 10− 8 respectively (see Fig. 3, left). For B = 126 ESPIRA-I gives the approximation error in (4.2) equal to 7.74 ⋅ 10− 8 and ESPRIT, 1.78 ⋅ 10− 6 (see Fig. 3, right).

Fig. 3
figure 3

The approximation error in (4.2) in logarithmic scale obtained using a cosine sum with M = 25 terms with ESPIRA-I (red) and ESPRIT (blue). Left: for B = 95. Right: for B = 126

Note that obtained approximation error in (4.2) depends on the values of parameters N, K and L and for some special choices ESPRIT may give better results.

In [8], high precision arithmetics with 800 to 2200 digits has been employed to find approximations of J0(B,t) by sparse cosine sums for B = 1,5,20. Our results have been obtained in double precision arithmetics for B = 95 and B = 126 and are therefore not comparable. However, similarly as in [8] we observe that the found frequencies ϕj, j = 1,…,25, in (4.2) have special locations. They are real and lie in the interval [0,1], and their distribution becomes denser towards the point 1, see Fig. 4.

Fig. 4
figure 4

Distribution of the frequencies ϕj, j = 1,…,25 in (4.2) computed with ESPIRA-I for B = 126

5 Conclusions

In this paper we have proposed three algorithms, ESPRIT, ESPIRA-I and ESPIRA-II, for stable recovery or approximation of functions by cosine sums of the form

$$ f(t) = \sum\limits_{j=1}^{M} \gamma_{j} \cos(\phi_{j} t), $$

where \(M \in {\mathbb N}\), \(\gamma _{j} \in {\mathbb R}\setminus \{ 0\}\), and where ϕj ∈ [0,K) are pairwise distinct. We use N samples \(f_{k} = f(\frac {\pi (2k +1)}{2K})\), k = 0,…,N − 1, with N > 2M to compute all parameters of this function model.

Our new modification of the ESPRIT algorithm differs from similar methods considered in [8, 15], and [28] regarding the employed input values, which are here identical to the input values used for ESPIRA-I and ESPIRA-II. In this way, we achieve a better comparability of the three algorithms. The ESPRIT algorithm provides the values \(\cos \limits (\phi _{j} h)\) as eigenvalues of a matrix pencil problem with Toeplitz+Hankel matrices.

The new ESPIRA algorithm for cosine sums is based on the observation that the DCT-II coefficients corresponding to the given vector of function values possesses a special rational structure if the frequencies satisfy \(\phi _{j} \not \in \frac {\pi }{hN}\mathbb {Z}\) for j = 1,…,M. Therefore, the problem of parameters estimation can be reformulated as a rational interpolation/approximation problem. We have applied the stable AAA algorithm for iterative rational approximation. Frequency parameters \(\phi _{j} \in \frac {\pi }{hN}\mathbb {Z}\) are reconstructed in a post-processing step.

We have shown that the ESPIRA approach can be reformulated as a matrix pencil problem applied to Loewner matrices. This observation leads to a new version of the algorithm, called ESPIRA-II, which has the advantage that case study of frequencies ϕj (and a corresponding post-processing step) is no longer needed.

All three methods provide very good results for reconstruction of cosine sums from exact data. For reconstruction from noisy data and for the approximation of even Bessel functions the algorithms ESPIRA-I and ESPIRA-II both outperform ESPRIT.