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, 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

See also

complex_pwc_signal()

Create complex Pwc signals from their moduli and phases.

constant_pwc_operator()

Create constant Pwcs.

hermitian_part()

Hermitian part of an operator.

pwc()

Create piecewise-constant functions.

pwc_signal()

Create Pwc signals from (possibly complex) values.

pwc_sum()

Sum multiple Pwcs.

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 = qctrl.functions.calculate_graph(graph=graph, output_node_names=["operator"])
>>> result.operator["operator"]
[
    {"value": array([[1.0, 0.0], [0.0, -1.0]]), "duration": 0.1},
    {"value": array([[2.0, 0.0], [0.0, -2.0]]), "duration": 0.2},
]

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