mrpro.operators.functionals.L1Norm

class mrpro.operators.functionals.L1Norm(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: ElementaryProximableFunctional

Functional class for the L1 Norm.

This implements the functional given by \(f: C^N -> [0, \infty), x -> \| W (x-b)\|_1\), where W is a either a scalar or tensor that corresponds to a (block-) diagonal operator that is applied to the input.

In most cases, consider setting divide_by_n to true to be independent of input size.

The norm of the vector is computed along the dimensions given at initialization.

__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.

forward(x: Tensor) tuple[Tensor][source]

Forward method.

Compute the l1-norm of the input.

Parameters:

x – input tensor

Return type:

l1 norm of the input tensor

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

Proximal Mapping of the L1 Norm.

Compute the proximal mapping of the L1-norm.

Parameters:
  • x – input tensor

  • sigma – scaling factor

Return type:

Proximal mapping applied to the input tensor

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

Convex conjugate of the L1 Norm.

Compute the proximal mapping of the convex conjugate of the L1-norm.

Parameters:
  • x – input tensor

  • sigma – scaling factor

Return type:

Proximal of the convex conjugate applied to the input tensor