mrpro.operators.functionals.ZeroFunctional
- class mrpro.operators.functionals.ZeroFunctional[source]
Bases:
ElementaryProximableFunctional
The constant zero functional.
- __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 [source]
Initialize a Functional.
We assume that functionals are given in the form \(f(x) = \phi ( weight ( x - target))\) for some functional \(\phi\).
- Parameters:
target (
Tensor
|None
|complex
, default:None
) – target element - often data tensor (see above)weight (
Tensor
|complex
, default:1.0
) – weight parameter (see above)dim (
int
|Sequence
[int
] |None
, default:None
) – dimension(s) over which functional is reduced. All other dimensions ofweight ( x - target)
will be treated as batch dimensions.divide_by_n (
bool
, default:False
) – if true, the result is scaled by the number of elements of the dimensions index bydim
in the tensorweight ( x - target)
. If true, the functional is thus calculated as the mean, else the sum.keepdim (
bool
, default:False
) – if true, the dimension(s) of the input indexed bydim
are maintained and collapsed to singeltons, else they are removed from the result.
- __call__(*args: Unpack) Tout [source]
Apply the forward operator.
For more information, see
forward
.
- forward(x: Tensor) tuple[Tensor] [source]
Apply the functional to the tensor.
Always returns 0.
- Parameters:
x (
Tensor
) – input tensor- Returns:
Result of the functional applied to x.
- prox(x: Tensor, sigma: float | Tensor = 1.0) tuple[Tensor] [source]
Apply the proximal operator to a tensor.
Always returns x, as the proximal operator of a constant functional is the identity.
- prox_convex_conj(x: Tensor, sigma: float | Tensor = 1.0) tuple[Tensor] [source]
Apply the proximal operator of the convex conjugate of the functional to a tensor.
The convex conjugate of the zero functional is the indicator function over \(C^N \setminus {0}\), which evaluates to infinity for all values of
x
except zero. Ifsigma > 0
, the proximal operator of the scaled convex conjugate is constant zero, otherwise it is the identity.
- __add__(other: Operator[Unpack, Tout]) Operator[Unpack, Tout] [source]
- __add__(other: Tensor) Operator[Unpack, tuple[Unpack]]
Operator addition.
Returns
lambda x: self(x) + other(x)
if other is a operator,lambda x: self(x) + other*x
if other is a tensor
- __matmul__(other: Operator[Unpack, tuple[Unpack]]) Operator[Unpack, Tout] [source]
Operator composition.
Returns
lambda x: self(other(x))
- __mul__(other: Tensor | complex) Operator[Unpack, Tout] [source]
Operator multiplication with tensor.
Returns
lambda x: self(x*other)
- __or__(other: ProximableFunctional) ProximableFunctionalSeparableSum [source]
Create a ProximableFunctionalSeparableSum object from two proximable functionals.
- Parameters:
other (
ProximableFunctional
) – second functional to be summed- Returns:
ProximableFunctionalSeparableSum object
- __radd__(other: Tensor) Operator[Unpack, tuple[Unpack]] [source]
Operator right addition.
Returns
lambda x: other*x + self(x)
- __rmul__(scalar: Tensor | complex) ProximableFunctional [source]
Multiply functional with scalar.