qugrad.pulses.compose

qugrad.pulses.compose(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 h given by the composition of f and g:

h(...)=f(g(...))

That is the output of g is piped into the first argument of f.

Additionally, additionaly arguments and keyword arguments can be passed to f using args and kwargs:

h(...)=f(g(...), *args, **kwargs)

Explicitly h is 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

compose_unpack()