mrpro.operators.ElementaryProximableFunctional

class mrpro.operators.ElementaryProximableFunctional(target: Tensor | None | complex = None, weight: Tensor | complex = 1.0, dim: int | Sequence[int] | None = None, divide_by_n: bool = False, keepdim: bool = False)[source]

Bases: ElementaryFunctional, ProximableFunctional

Elementary proximable functional base class.

Here, an elementary functional is a functional that can be written as \(f(x) = \phi ( weight ( x - target))\), returning a real value. It does not require another functional for initialization.

A proximable functional is a functional \(f(x)\) that has a prox implementation, i.e. a function that yields \(argmin_x \sigma f(x) + 1/2 \|x - y\|^2\).

__init__(target: Tensor | None | complex = None, weight: Tensor | complex = 1.0, dim: int | Sequence[int] | None = None, divide_by_n: bool = False, keepdim: bool = False) None

Initialize a Functional.

We assume that functionals are given in the form \(f(x) = \phi ( weight ( x - target))\) for some functional \(\phi\).

Parameters:
  • target – target element - often data tensor (see above)

  • weight – weight parameter (see above)

  • dim – dimension(s) over which functional is reduced. All other dimensions of weight ( x - target) will be treated as batch dimensions.

  • divide_by_n – if true, the result is scaled by the number of elements of the dimensions index by dim in the tensor weight ( x - target). If true, the functional is thus calculated as the mean, else the sum.

  • keepdim – if true, the dimension(s) of the input indexed by dim are maintained and collapsed to singeltons, else they are removed from the result.

abstract forward(*args: Unpack) Tout

Apply forward operator.

abstract prox(x: Tensor, sigma: Tensor | float = 1.0) tuple[Tensor]

Apply proximal operator.

Yields \(prox_{\sigma f}(x) = argmin_{p} (\sigma f(p) + 1/2 \|x-p\|^{2}\) given \(x\) and \(\sigma\)

Parameters:
  • x – input tensor

  • sigma – scaling factor, must be positive

Return type:

Proximal operator applied to the input tensor

prox_convex_conj(x: Tensor, sigma: Tensor | float = 1.0) tuple[Tensor]

Apply proximal operator of convex conjugate of functional.

Yields \(prox_{\sigma f^*}(x) = argmin_{p} (\sigma f^*(p) + 1/2 \|x-p\|^{2}\), where \(f^*\) denotes the convex conjugate of \(f\), given \(x\) and \(\sigma\).

Parameters:
  • x – input tensor

  • sigma – scaling factor, must be positive

Return type:

Proximal operator of the convex conjugate applied to the input tensor