time_reverse_pwc

Graph.time_reverse_pwc(pwc, *, name=None)

Reverse in time a piecewise-constant function.

Parameters:
  • pwc (Pwc) – The piecewise-constant function \(v(t)\) to reverse.

  • name (str or None, optional) – The name of the node.

Returns:

The piecewise-constant function \(w(t)\) defined by \(w(t)=v(\tau-t)\) for \(0\leq t\leq \tau\), where \(\tau\) is the duration of \(v(t)\).

Return type:

Pwc

See also

symmetrize_pwc

Symmetrize Pwcs.

time_concatenate_pwc

Concatenate Pwcs in time.

Notes

For more information on Pwc nodes see the Working with time-dependent functions in Boulder Opal topic.

Examples

Reverse a piecewise constant function.

>>> x = graph.pwc(durations=np.array([0.1, 0.5, 0.3]), values=np.array([1, 2, 3]))
>>> graph.time_reverse_pwc(x, name="reverse")
<Pwc: name="reverse", operation_name="time_reverse_pwc", value_shape=(), batch_shape=()>
>>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["reverse"])
>>> result.output["reverse"]
[{'duration': 0.3, 'value': 3.0},
{'duration': 0.5, 'value': 2.0},
{'duration': 0.1, 'value': 1.0}]