qugrad.pulses.compose_unpack¶
- qugrad.pulses.compose_unpack(f: Callable[[g_out, f_args, f_kwargs], f_out], g: Callable[[g_args, g_kwargs], g_out], *args: f_args, **kwargs: f_kwargs) Callable[[g_args, g_kwargs], f_out][source]¶
Creates a function
hgiven by the composition of f and*g:h(...) = f(*g(...))
That is the output of g is unpacked and piped into the arguments of f.
Additionally, additionaly arguments and keyword arguments can be passed to f using args and kwargs:
h(...) = f(*g(...), *args, **kwargs)
Explicitly
his defined as:h = lambda *a, **kw: f(*g(*a, **kw), *args, **kwargs)
- Parameters:
f (Callable[[g_out, f_args, f_kwargs], f_out]) – The second function to be called in the composition
g (Callable[[g_args, g_kwargs], g_out]) – The first function to be called in the composition
*args (f_args) – Additional arguments to pass to
f**kwargs (f_kwargs) – Additional keyword arguments to pass to
f
- Returns:
The composite function
h- Return type:
Callable[[g_args, g_kwargs], f_out]
See also