mrpro.operators.ScaledFunctional
- class mrpro.operators.ScaledFunctional[source]
Bases:
Functional
Functional scaled by a scalar.
- __init__(functional: Functional, scale: Tensor | float) None [source]
Initialize a scaled functional.
A scaled functional is a functional that is scaled by a scalar factor \(\alpha\), i.e. \(f(x) = \alpha g(x)\).
- Parameters:
functional (
Functional
) – functional to be scaledscale (
Tensor
|float
) – scaling factor, must be real and positive
- __call__(*args: Unpack) Tout [source]
Apply the forward operator.
For more information, see
forward
.
- forward(x: Tensor) tuple[Tensor] [source]
Forward method.
- Parameters:
x (
Tensor
) – input tensor- Returns:
scaled output of the functional
- __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)
- __radd__(other: Tensor) Operator[Unpack, tuple[Unpack]] [source]
Operator right addition.
Returns
lambda x: other*x + self(x)
- __rmul__(scalar: Tensor | complex) Functional [source]
Multiply functional with scalar.