1 Introduction

In this paper, we consider the constrained \(\ell _2-\ell _0\) problem:

$$\begin{aligned} \min _{x\in {\mathbb {R}}^N} \frac{1}{2}\Vert Ax-d\Vert ^2 \text { such that }\Vert x\Vert _0\le k \end{aligned}$$
(1)

where \(A\in {\mathbb {R}}^{M\times N}\) is an observation matrix, \(d\in {\mathbb {R}}^M\) is the data, and \(\Vert \cdot \Vert _0 \) is, by abuse of terminology, referred to as the \(\ell _0\)-norm:

$$\begin{aligned} \Vert x\Vert _0=\#\{x_i , i=1,\cdots , N : x_i\ne 0\} \end{aligned}$$

with \(\#S\) defined as the number of elements in S. This formulation ensures that the solution \({\hat{x}}\) has at maximum k nonzero entries. This type of problem appears in many applications, such as source separation, machine learning, and single-molecule localization microscopy. These problems are often underdetermined, i.e., problems where \(M\ll N\). A more studied sparse problem is the penalized \(\ell _2-\ell _0\) problem:

$$\begin{aligned} \min _{x\in {\mathbb {R}}^N} \frac{1}{2}\Vert Ax-d\Vert ^2 +\lambda \Vert x\Vert _0 \end{aligned}$$
(2)

where \(\lambda \in {\mathbb {R}}_{\ge 0}\) is a trade-off parameter. Even though the formulations (1) and (2) are similar, they are not equivalent (see, for example, [25] for a theoretical comparison). These problems also differ in their sparsity parameter. With the \(\lambda \) parameter, it is not possible to know the sparsity of the solution without testing it. The constrained problem does not have this problem as k fixes the number of nonzero components. However, the problems are both non-convex, non-smooth and NP-hard. In the following paragraph, we will outline the different methods to solve (1) and (2).

Greedy algorithms Greedy algorithms are designed to solve problems of the form (1). These algorithms start with a zero initialization and add one component to the signal x at each iteration until the wished-for sparsity is obtained. Among them, we find the matching pursuit (MP) algorithm [23], and the orthogonal matching pursuit (OMP) [26]. Newer algorithms add and subtract components at each iteration, among them are the algorithm greedy sparse simplex [3] or single best replacement (SBR) [37].

Mathematical program with equilibrium constraint Another method to solve a sparse optimization problem is to introduce auxiliary variables to simulate the nature of the \(\ell _0\)-norm and add a constraint between primaries and auxiliaries, and thus called a mathematical program with equilibrium constraint. Mixed integer reformulations [8] and Boolean relaxation [28] are two among the many algorithms based on this method. Algorithms entering these families have been proposed to solve sparse problems (see [6, 22], for example). A recent paper [2] proved the exactness of a reformulation of the constrained \(\ell _2-\ell _0\) problem and showed its abilities on single-molecule localization microscopy.

Relaxations An alternative to working with the non-convex \(\ell _0\)-norm is to replace it with the convex \(\ell _1\)-norm. This is called convex relaxation, but only under strict assumptions such as the RIP conditions, the original, and the convex relaxed problems are equivalent in terms of minimizers [11]. Furthermore, \(\Vert x\Vert _1\) penalizes not only the number of components in x but also their magnitude. Thus, the \(\ell _0\)-norm and \(\ell _1\)-norm are very different when x contains large values. Non-smooth, non-convex but continuous relaxations were primarily introduced to avoid this difference. These relaxations are still non-convex, and the convergence of the algorithms to a global minimum is not assured. Some of the non-convex continuous relaxations are the nonnegative garrote [9], the log-sum penalty [12] or capped-\(\ell _1\) [27] to mention some. The continuous exact \(\ell _0\) penalty introduced in [35] proposes an exact relaxation for problem (2), and a unified view of these functions is given in [36]. A recent convex relaxation has been proposed in [33], which replace the \(\ell _0\)-norm with a non-convex term, but where the sum of the data-fitting term and the relaxation is convex. Relaxation of the constrained \(\ell _2-\ell _0\) problem is less studied. However, the fixed rank problem and its convex envelope have been presented in [1], and the problem has certain similarities with the constrained \(\ell _2-\ell _0\) problem.

Contributions and outline The paper presents and studies a non-smooth and non-convex relaxation of the constrained problem (1). Following the procedure used to design the CEL0-relaxation of problem (2) [35], we want to explore if an equivalent continuous relaxation can be found for (1). The next section shows the computation of the convex hull of the constrained \(\ell _2-\ell _0\) formulation in the case of orthogonal matrices. The convex hull yields the square norm plus a penalty term that we name Q(x). Note that the expression of Q(x) could be obtained by applying the quadratic envelope presented in [14], choosing the right parameters. In other words, the present paper provides exact relaxation properties of the quadratic envelope [14] in a new regime that goes beyond those previously identified in [14]. In particular, our results are independent of A. This will be discussed later in Sect. 3. In the same section, the relaxed formulation is investigated as a continuous relaxation of the initial problem for any matrix A. We prove some basic properties of Q(x) to show that the relaxation favors k-sparse vectors. The relaxation does not always ensure a k-sparse solution, but it promotes sparsity. We show that if a minimizer of the relaxed expression is k-sparse, then the minimizer of the relaxed problem is a minimizer of the initial one. We propose an algorithm to minimize the relaxed formulation using an accelerated FBS method, and we add a “fail-safe” strategy which ensures convergence to a critical point of the initial problem. The relaxation and its associated algorithm is applied to the problem of single-molecule localization microscopy and compared to other state-of-the-art algorithms in \(\ell _2-\ell _0\) minimization.

Notations and Assumption

  • \(A\in {\mathbb {R}}^{M \times N}\) is an \(M \times N\) matrix.

  • The vector \(x^{\downarrow }\in {\mathbb {R}}^N\) is the vector x where its components are sorted by their magnitude, i.e., \(|x^{\downarrow }_1|\ge |x^{\downarrow }_2|\ge \dots \ge |x^{\downarrow }_N|\).

  • Let \(P^{(y)}\in {\mathbb {R}}^{N\times N}\) a permutation matrix such that \(P^{(y)}y=y^{\downarrow }\), we denote the vector \(x^{\downarrow y}= P^{(y)}x\).

  • \(a_i\) is the ith column of A. We suppose \(\Vert a_i\Vert \ne 0\, \forall i\).

  • The indicator function \(\chi _{_X}\) is defined for \(X\subset {\mathbb {R}}^N\) as

    $$\begin{aligned} \chi _{_X}(x)={\left\{ \begin{array}{ll} +\infty \text { if } x\notin X\\ 0 \text { if } x\in X. \end{array}\right. } \end{aligned}$$
  • \({{\,\mathrm{sign}\,}}^*(x)\) is the function \({{\,\mathrm{sign}\,}}\) for \(x\ne 0\) and \({{\,\mathrm{sign}\,}}^*(0)=\{-1,1\}\).

  • \({\mathbb {R}}_{\ge 0}^N\) denotes the space \(\{x\in {\mathbb {R}}^N | x_i\ge 0, \forall i\}\).

Proposition 1

We can suppose that \(\Vert a_i\Vert _2=1, \,\, \forall \,\, i\), without loss of generality.

Proof

The proof is based on the fact that \(\ell _0\)-norm is invariant to a multiplication factor. Let \(\Lambda _{\Vert a_i\Vert }\) and \(\Lambda _\frac{1}{\Vert a_i\Vert }\) be diagonal matrices with the norm of \(a_i\) (respectively, \(1/||a_i||\)) on its diagonal, and let \(z=\Lambda _{\Vert a_i\Vert } x\), then \(\Vert \Lambda _\frac{1}{\Vert a_i\Vert }z\Vert _0=\Vert z\Vert _0=\Vert x\Vert _0\), and thus,

$$\begin{aligned}&\mathop {{\mathrm{arg\, min}}}\limits _x \frac{1}{2}\Vert Ax-d\Vert _2^2+{\chi _{}}_{\Vert \cdot \Vert _0\le k}(x)\\&\quad =\Lambda _{\frac{1}{\Vert a_i\Vert }}\mathop {{\mathrm{arg\, min}}}\limits _z\frac{1}{2}\Vert A_n z-d\Vert ^2_2+\chi _{\Vert \cdot \Vert _0\le k}(z) \end{aligned}$$

where \(A_n\) is a matrix deduced from A where the norm of each column is 1. \(\square \)

We assume therefore that A has normalized columns throughout this paper.

2 The Convex Envelope of the Constrained \(\ell _2-\ell _0\) Problem when A is Orthogonal

In this section, we are interested in the case where A is an orthogonal matrix, i.e., \(<a_j,a_i>=0, \forall \, i\ne j\). In contrast to the penalized form (2), the functional with A orthogonal is not separable so the computation of the convex envelope in the N dimensional case cannot be reduced to the sum of N one-dimensional cases (as in [35]). The problem (1) can be written as the minimization of

$$\begin{aligned} G_k(x)= \frac{1}{2}\Vert Ax-d\Vert ^2+\chi _{_{\Vert \cdot \Vert _0\le k}}(x) \end{aligned}$$
(3)

where \(\chi \) is the indicator function defined in notations. Before calculating the convex envelope, we need some preliminary results.

Proposition 2

Let \(x\in {\mathbb {R}}^N.\) There exists \(j\in {\mathbb {N}}\) such that \(0<j\le k\) and

$$\begin{aligned} |x_{k-j+1}^\downarrow |\le \frac{1}{j}\sum _{i=k-j+1}^N |x_i^\downarrow |\le |x_{k-j}^\downarrow | \end{aligned}$$
(4)

where the left inequality is strict if \(j\ne 1\), and where \(x_0=+\infty \). Furthermore, \(T_k(x)\) is defined as the smallest integer that verifies the double inequality.

The proof of existence is given in “Appendix A.1.” We will also use the Legendre–Fenchel transformation which is essential in the calculation of the convex envelope.

Definition 1

The Legendre–Fenchel transformation of a function \(f:{\mathbb {R}}^N \rightarrow {\mathbb {R}}\cup \{+\infty \}\) is defined as:

$$\begin{aligned} f^*(u^*)= \sup _{u\in {\mathbb {R}}^N} <u,u^*> - f(u). \end{aligned}$$

The biconjugate of a function, that is applying the Legendre–Fenchel transformation twice, is the convex envelope of the function.

Following [35], we present the convex envelope of \(G_k\) (3) when A is orthogonal.

Theorem 1

Let \(A\in {\mathbb {R}}^{M \times N}\) be such that \(A^TA=I\). The convex envelope of \(G_k(x)\) is

$$\begin{aligned} G_k^{**}(x)=\frac{1}{2}\Vert Ax-d\Vert _2^2+Q(x) \end{aligned}$$
(5)

where

$$\begin{aligned} Q(x)=-\frac{1}{2} \sum _{i=k-T_k(x)+1}^{N} x_i^{\downarrow 2} + \frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^ N |x_i^\downarrow | \right) ^2 \end{aligned}$$
(6)

and where \(T_k(x)\) is defined as in Proposition 2.

Proof

Since \(A^TA=I\), the function \(G_k\) (3) can be rewritten as:

$$\begin{aligned} G_k(x)=\chi _{_{\Vert \cdot \Vert _0\le k}}(x)+\frac{1}{2}\left\| d-b\right\| _2^2+\frac{1}{2}\left\| x-z\right\| _2^2 \end{aligned}$$
(7)

where \(b=AA^Td\) and \(z=A^T d\). This reformulation allows us to decompose the data-fitting term into a sum of one-dimensional functions. We apply the Legendre transformation on the functional (7):

$$\begin{aligned} G_k^*(y)= & {} \sup _{x\in {\mathbb {R}}^N} <x,y>-\chi _{_{\Vert \cdot \Vert _0\le k}}(x)-\frac{1}{2}\left\| d-b\right\| _2^2\\&-\frac{1}{2}\left\| x-z\right\| _2^2. \end{aligned}$$

We leave out the terms that are not depending on x.

$$\begin{aligned} G_k^*(y)= & {} -\frac{1}{2}\left\| d-b\right\| _2^2\\&+\sup _{x\in {\mathbb {R}}^N} \left( <x,y>-\chi _{_{\Vert \cdot \Vert _0\le k}}(x)-\frac{1}{2}\left\| x-z\right\| _2^2\right) . \end{aligned}$$

Writing differently the expression inside the supremum, we get

$$\begin{aligned} G_k^*(y)&=-\frac{1}{2}\left\| d-b\right\| _2^2\\&\quad +\sup _{x\in {\mathbb {R}}^N}\left( -\chi _{_{\Vert \cdot \Vert _0\le k}}(x)-\frac{1}{2}\left\| x-\left( z+y\right) \right\| _2^2 \right. \\&\quad \left. +\frac{1}{2}\Vert z+y\Vert _2^2 -\frac{1}{2}\Vert z\Vert ^2_2\right) . \end{aligned}$$

We develop further

$$\begin{aligned} G_k^*(y)&=-\frac{1}{2}\left\| d-b\right\| _2^2-\frac{1}{2}\Vert z\Vert ^2_2+ \frac{1}{2}\Vert z+y\Vert _2^2\\&\quad +\sup _{x\in {\mathbb {R}}^N}\left( -\chi _{_{\Vert \cdot \Vert _0\le k}}(x)-\frac{1}{2}\left\| x-(z+y)\right\| _2^2 \right) . \end{aligned}$$

The supremum is reached when \(x_i=(z+y)^{\downarrow }_i\), \(i \le k\), and \(x_i=0\), \(\forall i>k\). The Legendre transformation of \(G_k\) is therefore

$$\begin{aligned} G_k^*(y)=-\frac{1}{2}\left\| d-b\right\| _2^2-\frac{1}{2}\Vert z\Vert ^2_2+\frac{1}{2}\sum _{i=1}^{k} (z+y)_i^{\downarrow 2}. \end{aligned}$$

To obtain the convex envelope of the function \(G_k\), we compute the Legendre transformation of \(G_k^*\).

$$\begin{aligned} G_k^{**}(x)= & {} \sup _y<x,y>+\frac{1}{2}\left\| d-b\right\| _2^2\\&+\frac{1}{2}\Vert z\Vert ^2_2-\frac{1}{2}\sum _{i=1}^{k} (z+y)_i^{\downarrow 2}. \end{aligned}$$

We add and subtract \(\frac{1}{2}\Vert x\Vert ^2\) and \(<x,z>\) in order to obtain an expression that is easier to work with.

$$\begin{aligned} G_k^{**}(x)&=\sup _y<x,y>+\frac{1}{2}\left\| d-b\right\| _2^2+\frac{1}{2}\Vert z\Vert ^2_2\\&\quad +\frac{1}{2}\Vert x\Vert ^2-\frac{1}{2}\Vert x\Vert ^2\\&\quad +<x,z> -<x,z>-\frac{1}{2}\sum _{i=1}^{k} (z+y)_i^{\downarrow 2}\\ G_k^{**}(x)&=\sup _y<x,z+y>+\frac{1}{2}\left\| d-b\right\| _2^2\\&\quad +\frac{1}{2}\Vert x-z\Vert ^2_2-\frac{1}{2}\Vert x\Vert ^2-\frac{1}{2}\sum _{i=1}^{k} (z+y)_i^{\downarrow 2}. \end{aligned}$$

Noticing that \(\frac{1}{2}\left\| d-b\right\| _2^2+\frac{1}{2}\Vert x-z\Vert ^2_2=\frac{1}{2}\Vert Ax-d\Vert _2^2\), using the notation \(w=z+y\), and given the definition of \(w^\downarrow \), this is equivalent to

$$\begin{aligned} G_k^{**}(x)= & {} \frac{1}{2}\Vert Ax-d\Vert _2^2-\frac{1}{2}\Vert x\Vert ^2\nonumber \\&+\sup _{w\in {\mathbb {R}}^N} <x,w> - \frac{1}{2} \sum _{i=1}^{k} w^{\downarrow 2}_i. \end{aligned}$$
(8)

The above supremum problem can be solved by using Lemma 1, which is presented after this proof. This yields

$$\begin{aligned} G_k^{**}(x)= & {} \frac{1}{2}\Vert Ax-d\Vert _2^2-\frac{1}{2} \sum _{i=k-T_k(x)+1}^{N} x_i^{\downarrow 2} \nonumber \\&+\frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^ N |x_i^\downarrow | \right) ^2 \end{aligned}$$
(9)

\(\square \)

The following lemma is necessary in the proof of the convex envelope.

Lemma 1

Let \(x\in {\mathbb {R}}^N\). Consider the following supremum problem

$$\begin{aligned} \sup _{y\in {\mathbb {R}}^N} -\frac{1}{2}\sum _{i=1}^k y^{\downarrow 2}_i+<y,x> . \end{aligned}$$
(10)

This problem is concave, and the value of the supremum problem (10) is

$$\begin{aligned} \frac{1}{2}\sum _{i=1}^{k-T_k(x)} x^{\downarrow 2}_i + \frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^N|x^\downarrow _i| \right) ^2. \end{aligned}$$

\(T_k(x)\) is defined in Proposition 2. The supremum argument is given by

$$\begin{aligned} y=P^{(x)^{-1}} {\hat{y}} \end{aligned}$$

where \({{\hat{y}}}\) is

$$\begin{aligned} {\hat{y}}_j(x)={\left\{ \begin{array}{ll}{{\,\mathrm{sign}\,}}(x^{\downarrow }_j)\frac{1}{T_k(x)}\sum _{i=k-T_k(x)+1}^N |x^{\downarrow }_i| &{}\text { if } k\ge j\ge k-T_k(x)+1 \\ &{}\text { or if } j>k \text { and } x^{\downarrow }_j\ne 0\\ \left[ -1,1\right] \frac{1}{T_k(x)}\sum _{i=k-T_k(x)+1}^N |x^{\downarrow }_i| &{}\text { if } j>k \text { and } x^{\downarrow }_j= 0\\ x^{\downarrow }_j &{}\text { if } j< k-T_k(x)+1. \end{array}\right. } \end{aligned}$$
(11)

The proof can be found in “Appendix A.2,” and it depends on multiple preliminary results in “Appendix A.1.”

Remark 1

\({\hat{y}}\) is such that \({\hat{y}}={\hat{y}}^\downarrow \).

This expression of the convex envelope may be hard to grasp since the expression is on a non-closed form. To understand better Q(x), we have the following properties:

Property 1

\(Q(x):\mathbb {R}^n\rightarrow [0,\infty [\).

Proof

Let us show that \(Q(x)\ge 0, \, \forall x\). We use Eq. (6) as starting point.

$$\begin{aligned} Q(x)&=-\frac{1}{2} \sum _{i=k-T_k(x)+1}^{N} x^{\downarrow 2}_i \\&\quad + \frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^ N |x_i^\downarrow | \right) ^2 \\&\ge -\frac{1}{2} |x_{k-T_k(x)+1}^\downarrow |\sum _{i=k-T_k(x)+1}^{N} |x^{\downarrow }_i| \\&\quad + \frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^ N |x_i^\downarrow | \right) ^2 \\&\ge -\frac{1}{2} |x^{\downarrow }_{k-T_k(x)+1}|\sum _{i=k-T_k(x)+1}^{N} |x^{\downarrow }_i| \\&\quad + \frac{1}{2}|x^{\downarrow }_{k-T_k(x)+1}|\sum _{i=k-T_k(x)+1}^ N |x^\downarrow _i| = 0. \end{aligned}$$

We used the fact that \(|x_{k-T_k(x)+1}^\downarrow |\ge |x^\downarrow _{i}|,\,\forall i \ge k-T_k(x)+1\) for the first inequality. For the second inequality, we used the inequality in the definition of \(T_k(x)\) (see Proposition 2) to go from the second to third line. Note that for \(T_k(x)>1\) the last inequality is strict. \(\square \)

Property 2

The function Q(x) is continuous on \({\mathbb {R}}^N\).

Proof

By definition we have that \(G_k^{**}(x)=\frac{1}{2}\Vert Ax-d\Vert ^2+Q(x)\) when A is orthogonal, and \(G_k^{**}\) is lower semi-continuous, and continuous in the interior of its domain. From [29, Corollary 3.47] for coercive functions, \(dom(co (f))=co (dom (f))\), where co is the convex envelope of a function and dom is the domain of the function. First, \(G_k\) is coercive when A is orthogonal since we have \(\Vert Ax\Vert ^2=(Ax)^TAx=x^TA^TAx=\Vert x\Vert ^2\). \(G_k^{**}\) is continuous on \({\mathbb {R}}^N\). Since \(dom (G_k)\) is made up of all different supports where \(\Vert x\Vert _0\le k\), its convex envelope is \({\mathbb {R}}^N\). Thus, \(dom(G_k^{**})={\mathbb {R}}^N\), and \(G_k^{**}\) is continuous on \({\mathbb {R}}^N\). Moreover, \(Q(x) = G_k^{**}(x)-\frac{1}{2}\Vert Ax-d\Vert ^2\), so Q(x) is the difference between a continuous function and a continuous function, and is independent of A, and thus continuous. \(\square \)

Property 3

Let \(\Vert x\Vert _0\le k\). Then, \(T_k(x)\) as defined in Proposition 2 is such that \(T_k(x)= 1\). The inverse is not necessarily true.

Proof

From Proposition 2, we know that \(T_k(x)\) satisfies

$$\begin{aligned} |x^\downarrow _{k-T_k(x)+1}|\le \frac{1}{T_k(x)}\sum _{i=k-T_k(x)+1}^N| x^\downarrow _i|\le |x^\downarrow _{k-T_k(x)}|. \end{aligned}$$

First, note that for all x such that \(\Vert x\Vert _0\le k\), we have \(\forall j>k, \,\,x^\downarrow _j=0\), and in this case the inequalities are clearly satisfied for \(T_k(x)=1\). Furthermore, \(T_k(x)\) is defined as the smallest possible integer, and thus \(T_k(x)=1\).

An example to prove the inverse is not true: Let \(x=(6,3,2,1)^T\). Let \(k=2\), then

$$\begin{aligned}\sum _{i=k}^N| x^\downarrow _i|=6\le |x^\downarrow _{k-1}|=6.\end{aligned}$$

\(T_k(x)=1\), but the constraint \(\Vert x\Vert _0\le 2\) is clearly not satisfied. \(\square \)

Property 4

\(Q(x)=0 \mathbf{if} and only if \Vert x\Vert _0\le k\).

Proof

From Property 1, \(Q(x)\ge 0\) and the inequality is strict if \(T_k(x)>1\). Thus, it suffices to investigate \(T_k(x)=1\). The expression is thus reduced to:

$$\begin{aligned} Q(x) = \sum _{j=k+1}^N\sum _{i=k}^{j-1} |x^\downarrow _i||x^\downarrow _j| \end{aligned}$$

which is equal to 0 only if at least \(\forall j, \, j>k,\, x^\downarrow _j=0\). \(\square \)

In the next section, we will investigate the use of Q(x) when A is not orthogonal.

3 A New Relaxation

From now on, we suppose \(A\in {\mathbb {R}}^{M\times N}\) with A not necessarily orthogonal.

We are interested in a continuous relaxation of \(G_k\) defined as

$$\begin{aligned} G_k(x)=\frac{1}{2}\Vert Ax-d\Vert ^2+\chi _{_{\Vert \cdot \Vert _0\le k}}(x). \end{aligned}$$

Following the CEL0 approach, we propose the following relaxation of \(G_k\):

$$\begin{aligned} G_{Q}(x)=\frac{1}{2}\Vert Ax-d\Vert ^2+Q(x) \end{aligned}$$
(12)

with

$$\begin{aligned} Q(x)=-\frac{1}{2} \sum _{i=k-T_k(x)+1}^{N} x_i^{\downarrow 2} + \frac{1}{2T_k(x)}\left( \sum _{i=k-T_k(x)+1}^ N |x_i^\downarrow | \right) ^2 \end{aligned}$$
(13)

where \(T_k(x)\) is the function defined in Proposition 2 as the smallest integer that verifies the inequality:

$$\begin{aligned} |x^\downarrow _{k-T_k(x)+1}|\le \frac{1}{T_k(x)}\sum _{i=k-T_k(x)+1}^N| x^\downarrow _i|\le |x^\downarrow _{k-T_k(x)}| \end{aligned}$$
(14)

where, by definition, the inequality is strict if \(T_k(x)>1\).

Remark that, from its definition [see Eq. (8)], Q(x) can be written as:

$$\begin{aligned} Q(x)=-\frac{1}{2}\sum _{i=1}^N x_i^2+ \sup _{w\in {\mathbb {R}}^N}-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>. \end{aligned}$$
(15)

Note that the properties of Q(x) proved in Sect. 2 are valid for any A.

The exactness of a relaxation means that the relaxation has the same global minimizers as the initial function. Furthermore, it does not add any minimizers that are not minimizers of the initial function. The CEL0 relaxation [35] is an exact relaxation of the penalized functional (2). The proposed relaxation \(G_Q\) of the constraint functional \(G_k\) (3) is not exact as a counterexample later in the paper shows. We can prove, however, some partial results.

Remark 2

From Property 4, we have \(Q(x)=0\) \(\forall \, x\) such that \(\Vert x\Vert _0\le k\). Thus, \(G_Q(x)=G_k(x)\) \(\forall \, x\) such that \(\Vert x\Vert _0\le k\).

Theorem 2

Let \({\hat{x}}\) be a local (respectively global) minimizer of \(G_Q\). If \(\Vert {\hat{x}}\Vert _0\le k\), then \({\hat{x}}\) is a local (respectively, global) minimizer of \(G_k\).

Proof

Let \({\mathscr {S}} {:}{=} \{x:\Vert x\Vert _0\le k\}\). Let \({\hat{x}}\) be a local minimizer of \(G_Q\), such that \(\Vert {\hat{x}}\Vert _0\le k\) and let \( {\mathscr {N}}({\hat{x}},\gamma )\) denote the \(\gamma \)-neighborhood of \({\hat{x}}\). By contradiction assume that \(\exists {\bar{x}} \in {\mathscr {N}} ({\hat{x}},\gamma )\bigcup {\mathscr {S}}\) s.t. \(G_k({\bar{x}})< G_k({\hat{x}})\). From Remark 2, \(G_Q({\bar{x}})=G_k({\bar{x}})\) and \(G_Q({\hat{x}})=G_k({\hat{x}})\), which means \(\exists {\bar{x}} \in {\mathscr {N}}({\hat{x}},\gamma )\cup {\mathscr {S}} s.t. G_Q({\bar{x}})< G_Q({\hat{x}})\) which is a contradiction since \({\hat{x}}\) is a minimizer of \(G_Q\). The same reasoning can be applied in the case of global minimizers. \(\square \)

Thus, if a minimizer of the relaxed functional satisfies the sparsity constraint, then it is a minimizer of the initial problem. Furthermore, the relaxation is a mix of absolute values and squares and promotes therefore sparsity. The subgradient, as can be seen in the next section, promotes a k-sparse solution.

Further note that we could have applied the quadratic envelope [14] to obtain the relaxation Q. The quadratic envelope can be defined as applying twice the \(S_\gamma \) transformation on a function f. The \(S_\gamma \) transformation is defined as:

$$\begin{aligned} S_\gamma (f)(y){:}{=} \sup _x - f(x)-\frac{\gamma }{2}\Vert x-y\Vert ^2. \end{aligned}$$

If we apply the quadratic envelope to the constrained \(\ell _0\) indicator function, we obtain \(\gamma Q\). Further, the author proposes to either choose \(\gamma I \prec A^T A\), where I is the identity matrix, or \(\gamma I \succ A^TA\). It is important to note that if we have a \(\gamma \) such that \(\gamma I \not \succ A^TA \), does not mean that \(\gamma I \prec A^TA\). When \(\gamma \) is such that \(\gamma I \succ A^TA\), the relaxation is exact. However, numerically, we found this condition far too strong, and it did not perform better than minimizing the initial hard constraint function \(G_k\) (3). For a normalized matrix A, Q can be found by taking \(\gamma =1\) in \(S_\gamma (S_\gamma (\chi _{_{\Vert \cdot \Vert _0\le k}}))\). However, we do not have necessarily \(I \succ A^TA\). Nevertheless, we show in this paper, some exact relaxation properties for \(G_Q\).

Furthermore, what is hidden in our proposed method is the fact that each column of A is normalized. Without this assumption, each element \(x_i\) would be weighted by \(\Vert a_i\Vert ^2\), which is finer than multiplying a constant to the whole regularization term. Again, we can compare with the CEL0 relaxation. When applying the quadratic envelope to the \(\ell _0\) penalization term, we obtain CEL0, but instead of \(\Vert a_i\Vert ^2\) in the expression, there is a \(\gamma \).

However, we are obliged to normalize A to calculate the proximal operator of the regularization term.

3.1 The Subgradient

In this section, we calculate the subgradient of \(G_Q\). Since \(G_Q\) is neither smooth nor convex, we cannot calculate the gradient nor the subgradient in the sense of convex analysis. We calculate the generalized subgradient (or Clarke subgradient). The obtained expression shows the difficulties to give optimal necessary conditions for the relaxation.

To calculate the generalized subgradient, we must first prove that Q(x) is locally Lipschitz.

Definition 2

A function \(f:{\mathbb {R}}^N\rightarrow {\mathbb {R}}\) is locally Lipschitz at point x if

$$\begin{aligned} \exists (L, \epsilon ), \forall (y,y')\in {\mathscr {N}}(x,\epsilon )^2, |f(y)-f(y')|\le L \Vert y-y'\Vert \end{aligned}$$

where \(L\in {\mathbb {R}}_{\ge 0}\), and \({\mathscr {N}}(x,\epsilon )\) is a \(\epsilon \) neighborhood of x.

Lemma 2

Q(x) is locally Lipschitz, \(\forall x \in {\mathbb {R}}^N\).

Proof

First, it is well known that the supremum of locally Lipschitz functions is locally Lipschitz. Let us use the definition of Q(x) from (15). The function defined as \(x\rightarrow \sup _w-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>\) is locally Lipschitz since \(\forall i\) the functions \(x\rightarrow -\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>\) are locally Lipschitz. Furthermore, the sum of two locally Lipschitz functions is locally Lipschitz. \(\square \)

Since Q(x) is locally Lipschitz, we can search for the generalized subgradient, denoted \(\partial \).

Definition 3

The generalized subgradient [16] of a function \(f:{\mathbb {R}}^N\rightarrow {\mathbb {R}}\) (which is locally Lipschitz) is defined by

$$\begin{aligned} \partial f(x) {:}{=}\{\xi \in {\mathbb {R}}^N: f^0(x,v)\ge <v,\xi >, \forall v \in {\mathbb {R}}^N\} \end{aligned}$$

where \(f^0(x,v)\) is the generalized directional derivative in the direction v,

$$\begin{aligned} f^0(x,v)= \limsup _{\begin{array}{c} y\rightarrow x\\ \eta \downarrow 0 \end{array}} \frac{f(y+\eta v)-f(y)}{\eta }. \end{aligned}$$

Theorem 3

Let \(x\in {\mathbb {R}}^N\), and let \(T_k(x)\) be as defined in Proposition 2. The subgradient of \(G_Q(x)\) is

$$\begin{aligned} \partial G_Q (x)= A^*(Ax-d)-x+y(x) \end{aligned}$$
(16)

where y(x) is the argument where the supremum is reached in Lemma 1.

Proof

\(G_Q\) is sum of three functions, \(\sup _w-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>\), \(\frac{1}{2}\Vert Ax-d\Vert ^2\) and \(-\frac{1}{2}\Vert x\Vert ^2\). From [16, Proposition 2.3.3 and Corollary 1] and since the two last functions are differentiable, we can write the generalized subgradient of \(G_Q\) as the sum of the gradient of the two last functions and the generalized subgradient of the first, i.e.,

$$\begin{aligned} \partial G_Q= & {} \nabla \left[ \frac{1}{2}\Vert A\cdot -d\Vert ^2\right] (x) - \nabla \left[ \frac{1}{2}\Vert \cdot \Vert ^2\right] (x)\nonumber \\&+ \partial [\sup _{w\in {\mathbb {R}}^N}-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,\cdot >](x). \end{aligned}$$
(17)

Thus, the difficulty is to calculate \(\partial [\sup _w-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,\cdot >](x)\).

From [24, Theorem 2.93], the subgradient of the supremum is the convex envelop of the subgradients where the supremum is reached. We define \(g(w,x) =-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>\). The subgradient of g with respect to x is \(\partial (g(w,\cdot ))(x) = w\). Now, we need to find the supremum in \( \sup _w-\frac{1}{2}\sum _{i=1}^k{w_i^{\downarrow }}^2+<w,x>\). From Lemma 1, we know that the supremum is reached at y(x), given in (11). We insert y(x) into (17) and this concludes the proof. \(\square \)

3.2 A Numerical Example of the Relaxation in Two Dimensions

In order to obtain a clearer view of what is gained with the proposed relaxation, we study two numerical examples in two dimensions. We set \(k=1\) and the initial problem is

$$\begin{aligned} G_k(x)=\frac{1}{2}\Vert Ax-d\Vert ^2+\chi _{_{\Vert \cdot \Vert _0\le 1}}(x). \end{aligned}$$

In two dimensions, the problem \(G_{k=1}\) is a simple problem to minimize. The solution is either when the first component, \({\hat{x}}_1\) is 0, or when the second component \({\hat{x}}_2=0\), or both. For \(k=1\) we have that \(T_k(x)=1\), and the relaxed formulation is then

$$\begin{aligned} G_Q(x)=\frac{1}{2}\Vert Ax-d\Vert ^2+ |x_1||x_2|. \end{aligned}$$

We consider the case where \(A \in {\mathbb {R}}^{2\times 2}\), and the two following examples:

$$\begin{aligned} A&=\left( \begin{matrix} 3 &{} 2\\ 1&{} 3 \end{matrix}\right) \Lambda _{1/\Vert a_i\Vert }&\text { and } d=\left( \begin{matrix} 1 \\ 2\end{matrix}\right) \end{aligned}$$
(18)
$$\begin{aligned} A&=\left( \begin{matrix} -3 &{} -2\\ 1 &{} 3 \end{matrix}\right) \Lambda _{1/\Vert a_i\Vert }&\text { and } d= \left( \begin{matrix} 1 \\ 2 \end{matrix}\right) \end{aligned}$$
(19)

where \(\Lambda _{1/\Vert a_i\Vert }\) is a diagonal matrix with \(\frac{1}{\Vert a_i\Vert }\) on its diagonal, and \(\Vert a_i\Vert \) is the norm of the ith column of A. Figure 1 presents the contour lines of \(G_k\) and \(G_Q\). The red semi-transparency layer over the contour line of the \(G_k\) represents the infinite value, and the blue semi-transparency layer over the relaxation marks the axes. The figures show the advantages of using \(G_Q\) as relaxation. The relaxation is continuous, and in Example (18), the relaxation is exact. This can be observed in the upper row in Fig. 1. Example (19) gives an example when the relaxation is not exact. In the lower row of Fig. 1, we observe the effect of the relaxation, as it is a product of the absolute value of \(x_1\) and \(x_2\). The global minima for the relaxation in this case is situated in \((-0.086,1.0912)\) and the two minima for \(G_k\) are \((-0.3162, 0)\) and (0, 1.094).

Fig. 1
figure 1

Top: Level lines of the function \(G_k\) and \(G_Q\) for the example (18). Bottom: Level lines of the function \(G_k\) and \(G_Q\) for the example (19)

4 Algorithms to Deal with \(G_Q\)

The analysis of the relaxation shows that it promotes sparsity. The function \(G_Q\) is non-convex and non-smooth, but \(G_Q\) is continuous, which is not the case for \(G_k\). One could implement a subgradient method, either by using gradient bundle methods (see [10] for an overview) or classical subgradient methods. However, there are no convergence guarantees for the latter. Both methods are also known to be slow compared to the classical forward–backward splitting algorithm (FBS). The FBS algorithm is proven to converge when the objective function has the Kurdyka-Łojasiewicz (K-Ł) property. More recent algorithms propose accelerations of the FBS, such as the non-monotone accelerated proximal gradient algorithm (nmAPG) [21] which is used in the numerical experiences of this paper. The algorithm is presented in “Appendix A.4.” It is designed to work on problems of the form:

$$\begin{aligned} {\hat{x}}\in \mathop {{\mathrm{arg\, min}}}\limits _x F(x){:}{=}f(x)+g(x) \end{aligned}$$
(20)

where f is a differentiable function, \(\nabla f\) is L-Lipschitz, and the proximal operator of g can be calculated. It is possible to add a fail-safe to be sure that the algorithm always converges to a solution that satisfies the sparsity constraint. A simple projection to the constraint \(\Vert x\Vert _0\le k\) using the proximal of the constraint and then the calculation of the optimal intensity for the given support would suffice. To use the FBS and its variants, we need to calculate the proximal operator of Q(x). To do so, we present some preliminary results before presenting the proximal operator.

Lemma 3

\(G_Q\) satisfies the K-Ł  property.

Proof

\(\frac{1}{2}\Vert Ax-d\Vert ^2\) is semi-algebraic. Using the definition of Q(x) in (15), we can prove that Q(x) is semi-algebraic. First, note that \(\Vert x\Vert _2^2\) is semi-algebraic. Furthermore,

$$\begin{aligned} \sum _{i=1}^kx_i^{\downarrow 2}= \sup _y g(x,y){:}{=}-\chi _{_{\Vert \cdot \Vert _0\le k}}(y)-\frac{1}{2}\Vert x-y\Vert ^2 \end{aligned}$$

and g(xy) is semi-algebraic [7]; then, \(\sum _{i=1}^kx_i^{\downarrow 2}\) is semi-algebraic. Thus, \(f(x,y){:}{=}-\sum _{i=1}^k y_i^{\downarrow 2}+ <x,y>\) is semi-algebraic, and the supremum as well. We can conclude that Q(x) is semi-algebraic, and thus, \(G_Q\) satisfies the K-Ł  property. \(\square \)

The expression of Q(x) in (6) is not on a closed-form expression because of the function \(T_k(x)\) and calculating the proximal operator directly from this expression is difficult. The following proposition facilitates the calculation of \(\text {prox}_Q\). The proposition is inspired by [13, Proposition 3.3], and the proof is omitted in this article as it follows the same steps and arguments as in the referenced article.

Proposition 3

Let \(\rho >1\) and \(z=\text {prox}_{-(\frac{\rho -1}{\rho })\sum _{i=k+1}^N(\cdot )^{\downarrow 2}}(y)\). We have

$$\begin{aligned} \text {prox}_{\frac{Q}{\rho }}(y)=\frac{\rho y - z}{\rho -1}. \end{aligned}$$
(21)

Thus, it suffices to calculate the proximal operator of \(\zeta (x){:}{=}-(\frac{\rho -1}{\rho })\sum _{i=k+1}^Nx_i^{\downarrow 2}\). This is done in Lemma 8 in “Appendix A.3.” The following theorem presents the proximal operator of Q

Theorem 4

The proximal operator of Q for \(\rho >1\) is such that

$$\begin{aligned} \text {prox}_{\frac{Q}{\rho }}(y)^{\downarrow y}_i = {\left\{ \begin{array}{ll} \frac{\rho y^{\downarrow }_i -{{\,\mathrm{sign}\,}}(y^{\downarrow }_i)\max (|y^{\downarrow }_i|,\tau ) }{{\rho -1}}&{}\text { if } i\le k \\ \frac{\rho y^{\downarrow }_i -{{\,\mathrm{sign}\,}}(y^{\downarrow }_i)\min (\tau ,\rho |y^{\downarrow }_i|)}{\rho -1} &{}\text { if } i>k \end{array}\right. } \end{aligned}$$

or, equivalently

$$\begin{aligned} \text {prox}_{\frac{Q}{\rho }}(y)^{\downarrow y}_i = {\left\{ \begin{array}{ll} y^{\downarrow }_i &{}\text { if } i\le k^* \\ \frac{\rho y^{\downarrow }_i -{{\,\mathrm{sign}\,}}(y^{\downarrow }_i)\tau }{\rho -1} &{}\text { if } k^*<i<k^{**} \\ 0 &{}\text { if } k^{**}\le i. \end{array}\right. } \end{aligned}$$
Fig. 2
figure 2

Example of the simulated dataset. The number of fluorophores is 213. To the left: ground truth. To the right: one of the 100 observations

where \(k^*\) is the first index such that \(\tau >|y^{\downarrow }_i|\) and \(k^{**}\) is the first index such that \(\rho |y^{\downarrow }_i|<\tau \). \(\tau \) is a value in the interval \([|y^{\downarrow }_k|,\rho |y^{\downarrow }_{k+1}|]\), and is defined as

$$\begin{aligned} \tau =\frac{\rho \sum _{i\in n_1}|y^{\downarrow }_i|+\rho \sum _{i\in n_2}|y^{\downarrow }_i|}{\rho \#n_1+ \#n_2} \end{aligned}$$
(22)

where \(n_1\) and \(n_2\) are two groups of indices such that \(\forall \, i \in n_1, y^{\downarrow }_i<\tau \) and \(\forall \, i \in n_2,\, \tau \le \rho |y^{\downarrow }_i|\) for an \(\#n_1\) and \(\#n_2\) are the sizes of n1 and n2. To go from \(\text {prox}_{\frac{Q}{\rho }}(y)^{\downarrow y}\) to \(\text {prox}_{\frac{Q}{\rho }}(y)\), we apply the inverse permutation that sorts y to \(y^{\downarrow }\).

Proof

The result is direct by applying Proposition 3 and Lemma 8 which present the proximal operator of \(\text {prox}_{-(\frac{\rho -1}{\rho })\sum _{i=k+1}^N(\cdot )^{\downarrow 2}}(y)\); the latter is presented in “Appendix A.3.” \(\square \)

Note that the proximal operator of Q is only a relaxation of the proximal operator of \(\Vert x\Vert _0\le k\), which keeps the k largest values of x. Further note that the search for \(\tau \) can be done iteratively by sorting in descending order all values of \(y^{\downarrow }_i\) \(i\le k\) and \(\rho y^{\downarrow }_i\) \(i>k\) that are (with respect to their absolute value) in the interval \([|y^{\downarrow }_k|,\rho |y^{\downarrow }_{k+1}|]\). The elements in the interval are sorted, and denoted \(p_i\). \(n_1\),\(n_2\) must calculated for each interval \([p_{i+1},p_i]\). The search is over if \(\tau \) is \(\in [p_{i+1},p_i]\).

The codes to compute the proximal operator and the cost function are available online: https://github.com/abechens/SMLM-Constraint-Relaxation.

5 Application to 2D Single-Molecule Localization Microscopy

In this section, we compare the minimization of the relaxation with other 2D grid-based sparse algorithms. The algorithms are applied to the problem of 2D single-molecule localization microscopy (SMLM).

SMLM is a microscopy method that is used to obtain images with a higher resolution than what is possible with traditional optical microscopes. The method was first introduced in [5, 19, 30]. Fluorescent microscopy uses photoactivatable fluorophores that can emit light when they are excited with a laser. The fluorophores are observed with an optical microscope, and, since the fluorophores are smaller than the diffraction limit, what is observed is not each fluorophore, but rather a diffraction pattern (or equivalently the point spread function (PSF)) larger than the fluorophores. This limits the resolution of the image. SMLM exploits photoactivatable fluorophores, and, instead of activating all the fluorophores at once as done by other fluorescent microscopy methods, one activates a sparse set of fluorescent fluorophores. The probability that two fluorophores are in the same PSF is low when only a few fluorophores are activated (low-density images), and precise localization of each is therefore possible. The localization becomes harder if the density of emitting fluorophores is higher because of the possibility of overlapping PSF’s. Once each molecule has been precisely localized, they are switched off and the process is repeated until all the fluorophores have been activated. The total acquisition time may be long when activating few fluorophores at a time, which is unfortunate as SMLM may be used on living samples that can move during this time. We are, in this paper, interested in high-density acquisitions.

The localization problem of SMLM can be described as a \(\ell _2-\ell _0\) minimization problem such as (1) and (2) with an added positivity constraint since we reconstruct the intensity of the fluorophores. For \(G_Q\), this is done by using the distance function to the nonnegative space since the proximal operator of the sum of Q(x) and the positivity constraint is not known. A is the matrix operator that performs a convolution with the point spread function and a reduction of dimensions. The fluorophores are reconstructed on a finer grid \(\in {\mathbb {R}}^{ML\times ML}\) than the observed image \(\in {\mathbb {R}}^{M \times M}\), with \(L>1\). A detailed description of the mathematical model can be found in [2]. Note that an estimation of the number of excited fluorophores is possible to do beforehand as this is dependent on the intensity of the excitation laser. Thus, the constrained sparse formulation (1) may be more suitable to use compared to the penalized sparse formulation (2) as the sparsity parameter k is the maximum number of nonzero pixels to reconstruct, and one pixel can be roughly equivalent to one observed excited fluorophore.

We compare first \(G_Q\) with iterative hard thresholding (IHT) [17] which minimizes the constrained initial function (1). This gives a clear comparison between the initial function and the proposed relaxation. We construct an image artificially with 213 of fluorophores randomly scattered on a \(256\times 256\)-grid, where each square measures \(25\times 25\) nm. The observed image is \(64 \times 64\)-pixel image, where each pixel measures \(100\times 100\) nm, with a simulated Gaussian PSF with an FWHM of 258.21 nm. Note that we use these parameters as this is representative of the simulated 2D-ISBI data presented in the next section. We then construct 100 observations by applying different realizations of Poisson noise to the same image. The signal-to-noise ratio is around 20dB for each observation (Fig. 2).

Fig. 3
figure 3

Comparison of the constrained-based algorithms: \(G_Q\) and constrained IHT. The y-axis represents the value \(\frac{1}{2}\Vert Ax-d\Vert ^2\). The lower, the better

We compare the ability of \(G_Q\) and constrained IHT to minimize the \(\ell _2\) data fidelity term under the constraint that only 213 pixels are nonzero.

In Fig. 3, we compare the results of \(G_Q\) and constrained IHT using the data fidelity term. The results of the 100 image reconstructions are presented with boxplots. The red mark in the box is the median of the reconstruction result of the 100 noisy, blurred, and downsampled images. The upper (respectively, lower) part of the box indicates the 75th (25th) percentiles median. We can observe that \(G_Q\) always minimizes better than constrained IHT in terms of the data fidelity term. Thus, it manages more efficiently to solve the initial problem.

\(G_Q\) reconstructs the 100 images with a median data fidelity value of 1.55. To compare, constrained IHT has 2.74 as a median data fidelity value.

This small example shows clearly the advantage of using \(G_Q\) compared to constrained IHT. In the next section, we compare \(G_Q\) and constrained IHT with other \(\ell _2-\ell _0\)-based algorithms.

5.1 Comparison on 2013 ISBI Data

We compare \(G_Q\) and constrained IHT with CoBic [2], which is designed to minimize the constrained \(\ell _2-\ell _0\) problem. We further compare the algorithms with two algorithms: CEL0 [18] and the \(\ell _1\) relaxation, both relaxations of the penalized formulation (2). The \(\ell _1\) relaxation is minimized using FISTA [4], and \(G_Q\) is minimized with the non-monotone accelerated proximal gradient algorithm (nmAPG) [21]. The algorithms are applied to the problem of 2D single-molecule localization microscopy (SMLM).

The algorithms are tested on two datasets with high-density acquisitions, accessible from the ISBI 2013 challenge [31]. For a review of the SMLM and the different localization algorithms, see the ISBI-SMLM challenge [31]. A more recent challenge was launched in 2016 [32]. We decided to use the 2013 challenge as the data are denser in the 2013 challenge. Furthermore, the 2D data in the 2016 challenge contain observations where some elements are not in the focal plane. Thus, our image formation model is not optimized for this image acquisition method.

Figure 4 shows two of the 361 acquisitions of the simulated dataset as well as the sum of all the acquisitions. We apply the localization algorithm to each acquisition, and the sum of the results of the localization of the 361 acquisitions yields one super-resolution image.

Fig. 4
figure 4

Simulated images, from left to right: 1st acquisition, 361st acquisition, and the sum of all the acquisitions

Table 1 The Jaccard index obtained for an reconstruction of around 90, 100 and 142 nonzero pixels on average. In bold: best reconstruction for the tolerance and the number of pixel reconstructed

We use the Jaccard index to do a numerical evaluation of the reconstructions. The Jaccard index is known from probability and is used to evaluate similarities between sets. In this case, it evaluates the localization of the reconstructed fluorophores (see [31]), and is defined as the ratio between the correctly reconstructed (CR) fluorophores and the sum of CR, false negatives (FN), and false positives (FP) fluorophores. The index is 1 for a perfect reconstruction, and the lower the index, the poorer the reconstruction. The Jaccard index includes a tolerance of error in its calculations when identifying the CR, FN and FP.

$$\begin{aligned} Jac=\frac{CR}{CR+FP+FN}\times 100\%. \end{aligned}$$

5.2 Results of the ISBI Simulated Dataset

The simulated dataset represents 8 tubes of 30 nm diameter. The acquisition is captured on a \(64\times 64\) pixel grid with a pixel size of \(100 \times 100\,\text {nm}^2\). The acquisition used a simulated point spread function (PSF) modeled by a Gaussian function with a full width at half maximum (FWHM) of 258.21 nm. Among the 361 images, there are 81 049 fluorophores.

The algorithms localize the fluorophores with higher precision on a \(256\times 256\) grid, where each pixel measures \(25\times 25\,\text {nm}^2\). This can be written as a reconstruction of \(x\in {\mathbb {R}}^{ML\times ML}\) with an acquisition \(d\in {\mathbb {R}}^{M\times M}\), where \(L=4\) and \(M=64\). The position of the fluorophore is estimated using the center of the pixel.

We test the reconstruction ability of \(G_Q\) with the sparsity constraint k, set to three different values, and the Jaccard index is presented in Table 1. The \(\lambda \) parameters for the penalized functional (2) are set such that the same number of nonzero pixels is reconstructed as for the constrained problem. The reconstructions for 99 nonzero pixels from the different algorithms are presented in Fig. 5. The proposed relaxation performs slightly better than CELO. The relaxation performs better than any of the constrained formulation algorithms (CoBic and constrained IHT); moreover, CoBic does not reconstruct more than 99 nonzero pixels on average. The average reconstruction time for one acquisition is found in Table 2.

Fig. 5
figure 5

Reconstructed images from the simulated ISBI dataset, 99 nonzero pixels on average. Top: from left to right: \(G_Q\), CoBic and IHT. Bottom: from left to right: ground truth, CEL0, and \(\ell _1\)-relaxation

5.3 Results of the Real Dataset

The algorithms are applied to the real high-density dataset, provided from the 2013 ISBI SMLM challenge [31]. In total, there are 500 acquisitions and each acquisition is of size \(128\times 128\) pixels and each pixel measures \(100 \times 100\,\hbox {nm}^2\). The FWHM is evaluated to be 351.8 nm [15]. The localization is done on a fine \(512\times 512\) pixel grid, where each pixel measures \(25 \times 25\,\text {nm}^2\). Extensive testing of the sparsity parameters has been done to obtain the results, presented in Fig. 6, as we have no prior knowledge of the solution. The parameters were chosen such that the parts in red and green had distinctive tubes, as well as the overall tubulins, were reconstructed. The results of the real dataset confirm the results of the simulated data, where the constrained IHT performance is not good, and the \(\ell _1\) relaxation seems to tighten the holes which are observed in red.

Table 2 Average reconstruction time for one image acquisition for the different methods
Fig. 6
figure 6

Reconstructed images from the real ISBI dataset. Top: from left to right: \(G_Q\), CoBic and IHT. Bottom: from left to right: sum of all acquisitions, CEL0, and \(\ell _1\)-relaxation

An important note In the numerical experience, the proposed relaxed formulation converges always to a critical point that satisfies the sparsity constraint, and thus, the “fail-safe” strategy is never activated.

6 Conclusion

We have investigated in this paper a continuous relaxation of the constrained \(\ell _2-\ell _0\) problem. We compute the convex hull of \(G_k\) when A is orthogonal. We further propose to use the same relaxation for any A and name this relaxation \(G_Q\). This is the same procedure as the authors used to obtain CEL0 [35]. The question that has driven us has been answered; the proposed relaxation, \(G_Q\), is not exact for every observation matrix A. However, it promotes sparsity and is continuous. We propose an algorithm to minimize the relaxed function. We further add a “fail-safe” strategy which ensures convergence to a critical point of the initial functional. In the case of SMLM, the relaxation performs as good as the other grid-based methods, and it converges toward a critical point of the initial problem each time without the “fail-safe” strategy activated. Furthermore, the constraint parameter of \(G_Q\) is usually easier to fix than the regularizing parameter \(\lambda \) in CEL0 in many sparse optimization problems.