linear_rescaling¶
- qugradlab.pulses.invertible_functions.scaling.linear_rescaling(x: ndarray[complex], min: complex, max: complex) ndarray[complex][source]¶
Rescales an input x in the range [-1, 1] to the range [min, max] with -1 being mapped to min and 1 being mapped to max.
- Parameters:
- Returns:
The rescaled input
- Return type:
NDArray[Shape[s], complex]
Note
linear_rescaling()is an instance ofInvertibleFunction.- linear_rescaling.inverse()¶
The inverse linear rescaling
- PARAMETERS:
x (NDArray[Shape[s := Any_Shape], complex]) — The rescaled value to be unscaled
min (complex) — The minimum value of the rescaled range
max (complex) — The maximum value of the rescaled range
- RETURNS:
The unscaled value
- RETURN TYPE:
NDArray[Shape[s], complex]
- linear_rescaling.specify_parameters()¶
Allows the maximum and minimum values to be pre-specified. This removes them from the call signature. If only one of
maxorminis passed, then only the value speficied is removed from the call signature.- PARAMETERS:
min (complex, optional) — The minimum value of the rescaled range
max (complex, optional) — The maximum value of the rescaled range
- RETURNS:
A new
InvertibleFunctionwith the specified parameters pre-specified.- RETURN TYPE:
InvertibleFunction
- linear_rescaling.compose()¶
Composes the
linear_rescaling()with anotherInvertibleFunctionto create a newInvertibleFunctionalong with the composed inverse. That is the following assertions should hold:assert linear_rescaling.compose(g, *args, **kwargs)(x, *g_args, **g_kwargs) == linear_rescaling(g(x, *g_args, **g_kwargs), *args, **kwargs)
for all inputs
x.- PARAMETERS:
inner_invertible_function (InvertibleFunction) — The
InvertibleFunctionbe be called first. The output of thisInvertibleFunctionwill be passed tolinear_rescaling().min (complex) — The minimum value of the rescaled range
max (complex) — The maximum value of the rescaled range
- RETURNS:
A new
InvertibleFunctionthat is the composition of the two functions.- RETURN TYPE:
InvertibleFunction