GroupL2SoftThresholding#

class mrinufft.trajectories.GroupL2SoftThresholding(shape: tuple[int, ...], alphas: ndarray[tuple[int, ...], dtype[_ScalarType_co]])[source]#

Bases: ProxOperator

Group L2 Soft Thresholding (Shrinkage) Operator.

This operator applies a soft-thresholding on the L2 norm of vectors grouped along the last dimension. It is effectively the proximal operator of the Group Lasso (L2,1) penalty.

The logic follows: \(y = x * max(0, ||x|| - alpha) / ||x||\)

Parameters:
  • shape (tuple[int, ...]) – The shape of the input vector, expected to be (Nc, Ns, D).

  • alphas (NDArray or float) – The threshold parameter(s). Can be a scalar or a vector of shape (D,). If a vector is provided, the thresholding is applied per-channel broadcasting against the joint L2 norm.

Methods

__init__

affine_addition

Affine addition

chain

Chain

grad

Gradient of the Moreau envelope of the function.

postcomposition

Postcomposition

precomposition

Precomposition

prox

Apply the Group L2 Soft Thresholding.

proxdual

Attributes

H

Adjoint operator - swaps prox and proxdual

__call__(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]]) bool[source]#

Evaluate the regularization function value (L2,1 norm weighted by alphas).

Note: This returns the penalty value, not a boolean check.

Note

This function uses numpy for all CPU arrays, and cupy for all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.

Return type:

bool

prox(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]], tau: float, eps: float = 1e-10) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]#

Apply the Group L2 Soft Thresholding.

y = x * ( ||x||_2 - (alphas * tau) )_+ / ||x||_2

Note

This function uses numpy for all CPU arrays, and cupy for all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.

Return type:

ndarray[tuple[int, …], dtype[_ScalarType_co]]

property H: _AdjointOperator[source]#

Adjoint operator - swaps prox and proxdual

__add__(v: ndarray[tuple[int, ...], dtype[number]]) ProxOperator[source]#
Return type:

ProxOperator

_adjoint() _AdjointOperator[source]#

Adjoint operator - swaps prox and proxdual

Return type:

_AdjointOperator

_prox_moreau(**kwargs: Any) Any[source]#
Return type:

Any

_proxdual_moreau(**kwargs: Any) Any[source]#
Return type:

Any

affine_addition(v: ndarray[tuple[int, ...], dtype[number]]) ProxOperator[source]#

Affine addition

Adds the dot-product of vector v and vector x (which is passed to dual or proxdual) to the current function.

This method can also be accessed via the + operator.

Parameters:

v (numpy.ndarray) – Vector

Return type:

ProxOperator

Notes

The proximal operator of a function \(g=f(\mathbf{x}) + \mathbf{v}^T \mathbf{x}\) is defined as:

\[prox_{\tau g} (\mathbf{x}) = prox_{\tau f} (\mathbf{x} - \tau \mathbf{v})\]
chain(g: ProxOperator) ProxOperator[source]#

Chain

Chains two proximal operators. This must be used with care only when aware that the combination of two proximal operators can be simply obtained by chaining them

Parameters:

g (pyproximal.proximal.ProxOperator) – Rigth operator

Return type:

ProxOperator

Notes

The proximal operator of the chain of two operators is defined as:

\[prox_{\tau f g} (\mathbf{x}) = prox_{\tau g}(prox_{\tau f g}(x))\]
grad(x: ndarray[tuple[int, ...], dtype[number]]) ndarray[tuple[int, ...], dtype[number]][source]#

Gradient of the Moreau envelope of the function.

This method is only called if the user does not provide a gradient because the function is not differentiable. In this case, the gradient of the Moreau envelope of the function is computed instead:

\[\nabla_\mathbf{x} M_{\sigma f) = \frac{1}{sigma} (\mathbf{x} - \prox_{\sigma f}(\mathbf{x}))\]
Parameters:

x (numpy.ndarray) – Vector

Returns:

g – Gradient vector

Return type:

numpy.ndarray

postcomposition(sigma: float) ProxOperator[source]#

Postcomposition

Multiplies a scalar sigma to the current function.

This method can also be accessed via the * operator.

Parameters:

sigma (float) – Scalar

Return type:

ProxOperator

Notes

The proximal operator of a function \(g= \sigma f(\mathbf{x})\) is defined as:

\[prox_{\tau g} (\mathbf{x}) = prox_{\sigma \tau f} (\mathbf{x})\]
precomposition(a: float, b: float | ndarray[tuple[int, ...], dtype[number]]) ProxOperator[source]#

Precomposition

Multiplies and add scalars a and b to x when evaluating the proximal function

Parameters:
  • a (float) – Multiplicative scalar

  • b (float or obj:numpy.ndarray or obj:cupy.ndarray) – Additive scalar (or vector)

Return type:

ProxOperator

Notes

The proximal operator of a function \(g= f(a \mathbf{x} + b)\) is defined as:

\[prox_{\tau g} (\mathbf{x}) = \frac{1}{a} ( prox_{a^2 \tau f} (a \mathbf{x} + b) - b)\]
proxdual(**kwargs: Any) Any[source]#
Return type:

Any