# pwc_operator

Graph.pwc_operator(signal, operator, *, name=None)

Create a constant operator multiplied by a piecewise-constant signal.

Parameters:
• signal (Pwc) – The piecewise-constant signal $$a(t)$$, or a batch of piecewise-constant signals.

• operator (np.ndarray or Tensor) – The operator $$A$$. It must have two equal dimensions.

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

Returns:

The piecewise-constant operator $$a(t)A$$ (or a batch of piecewise-constant operators, if you provide a batch of piecewise-constant signals).

Return type:

Pwc

Graph.complex_pwc_signal

Create complex Pwc signals from their moduli and phases.

Graph.constant_pwc_operator

Create constant Pwcs.

Graph.hermitian_part

Hermitian part of an operator.

Graph.pwc

Create piecewise-constant functions.

Graph.pwc_signal

Create Pwc signals from (possibly complex) values.

Graph.pwc_sum

Sum multiple Pwcs.

Graph.stf_operator

Corresponding operation for Stfs.

Notes

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

Examples

Create a piecewise-constant operator with non-uniform segment durations.

>>> sigma_z = np.array([[1.0, 0.0],[0.0, -1.0]])
>>> graph.pwc_operator(
...     signal=graph.pwc(durations=np.array([0.1, 0.2]), values=np.array([1, 2])),
...     operator=sigma_z,
...     name="operator",
... )
<Pwc: name="operator", operation_name="pwc_operator", value_shape=(2, 2), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="operator")
>>> result["output"]["operator"]
{
'durations': array([0.1, 0.2]),
'values': array([
[[ 1.,  0.], [ 0., -1.]],
[[ 2.,  0.], [ 0., -2.]]
]),
'time_dimension': 0
}


See more examples in the How to represent quantum systems using graphs user guide.