pyproximal.L2

class pyproximal.L2(Op: LinearOperator | None = None, b: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None, q: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None, sigma: float = 1.0, alpha: float = 1.0, qgrad: bool = True, niter: int | Callable[[int], int] = 10, x0: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None, warm: bool = True, solver: str | None = 'legacy', densesolver: str | None = None, kwargs_solver: dict[str, Any] | None = None)[source]

L2 Norm proximal operator.

The Proximal operator of the \(\ell_2\) norm is defined as: \(f(\mathbf{x}) = \frac{\sigma}{2} ||\mathbf{Op}\mathbf{x} - \mathbf{b}||_2^2\) and \(f_\alpha(\mathbf{x}) = f(\mathbf{x}) + \alpha \mathbf{q}^T\mathbf{x}\).

Parameters:
Oppylops.LinearOperator, optional

Linear operator

bnumpy.ndarray, optional

Data vector

qnumpy.ndarray, optional

Dot vector

sigmaint, optional

Multiplicative coefficient of L2 norm

alphafloat, optional

Multiplicative coefficient of dot product

qgradbool, optional

Add q term to gradient (True) or not (False)

niterint or func, optional

Number of iterations of iterative scheme used to compute the proximal. This can be a constant number or a function that is called passing a counter which keeps track of how many times the prox method has been invoked before and returns the niter to be used.

x0numpy.ndarray, optional

Initial vector

warmbool, optional

Warm start (True) or not (False). Uses estimate from previous call of prox method.

solverstr, optional

Added in version 0.11.0.

Name of solver to use with non-explicit operators:

densesolverstr, optional

Use numpy, scipy, or factorize when dealing with explicit operators. The former two rely on dense solvers from either library, whilst the last computes a factorization of the matrix to invert and avoids to do so unless the \(\tau\) or \(\sigma\) paramets have changed. Choose densesolver=None when using PyLops versions earlier than v1.18.1 or v2.0.0

**kwargs_solverdict, optional

Dictionary containing extra arguments for the solver selected via the solver parameter.

Notes

The L2 proximal operator is defined as:

\[prox_{\tau f_\alpha}(\mathbf{x}) = \left(\mathbf{I} + \tau \sigma \mathbf{Op}^T \mathbf{Op} \right)^{-1} \left( \mathbf{x} + \tau \sigma \mathbf{Op}^T \mathbf{b} - \tau \alpha \mathbf{q}\right)\]

when both Op and b are provided. This formula shows that the proximal operator requires the solution of an inverse problem. If the operator Op is of kind explicit=True, we can solve this problem directly. On the other hand if Op is of kind explicit=False, an iterative solver is employed. In this case it is possible to provide a warm start via the x0 input parameter.

Note that alternatively the proximal operator can be computed solving the following augumented system of equations (instead of its normal equations as shown above):

\[\begin{split}\begin{bmatrix} \sqrt{\tau \sigma} \mathbf{Op} \\ \mathbf{I} \end{bmatrix} prox_{\tau f_\alpha}(\mathbf{x}) = \begin{bmatrix} \sqrt{\tau \sigma} \mathbf{b} \\ \mathbf{x} - \tau \alpha \mathbf{q} \end{bmatrix}\end{split}\]

The choice of the parameter solver determines which of the two approaches is used.

Alternatively, when only b is provided, Op is assumed to be an Identity operator and the proximal operator reduces to:

\[\prox_{\tau f_\alpha}(\mathbf{x}) = \frac{\mathbf{x} + \tau \sigma \mathbf{b} - \tau \alpha \mathbf{q}} {1 + \tau \sigma}\]

If b is not provided, the proximal operator reduces to:

\[\prox_{\tau f_\alpha}(\mathbf{x}) = \frac{\mathbf{x} - \tau \alpha \mathbf{q}}{1 + \tau \sigma}\]

Finally, note that the second term in \(f_\alpha(\mathbf{x})\) is added because this combined expression appears in several problems where Bregman iterations are used alongside a proximal solver.

Methods

__init__([Op, b, q, sigma, alpha, qgrad, ...])

affine_addition(v)

Affine addition

chain(g)

Chain

grad(x)

Gradient of the Moreau envelope of the function.

postcomposition(sigma)

Postcomposition

precomposition(a, b)

Precomposition

prox(*args, **kwargs)

proxdual(**kwargs)

Examples using pyproximal.L2

Dykstra’s algorithms

Dykstra's algorithms

Norms

Norms

Adaptive Primal-Dual

Adaptive Primal-Dual

Denoising

Denoising

Group sparsity

Group sparsity

IHT, ISTA, FISTA, AA-ISTA, and TWIST for Compressive sensing

IHT, ISTA, FISTA, AA-ISTA, and TWIST for Compressive sensing

Low-Rank completion via SVD

Low-Rank completion via SVD

MRI Imaging and Segmentation of Brain

MRI Imaging and Segmentation of Brain

Plug and Play Priors

Plug and Play Priors

Quadratic program with box constraints

Quadratic program with box constraints

Relaxed Mumford-Shah regularization

Relaxed Mumford-Shah regularization