complex_pwc_signal

Graph.complex_pwc_signal(moduli, phases, duration, *, name=None)

Create a complex piecewise-constant signal from moduli and phases.

Use this function to create a complex piecewise-constant signal from moduli and phases defined for each segment, in which the constant segments all have the same duration.

Parameters

  • moduli (np.ndarray ( real ) or Tensor ( real )) – The moduli {Ωn}\{\Omega_n\} of the values of NN constant segments. These can represent either the moduli of a single sequence of segment values or of a batch of them. To provide a batch of sequences of segment values of shape B1××BnB_1 \times \ldots \times B_n, represent these moduli as a tensor of shape B1××Bn×NB_1 \times \ldots \times B_n \times N.
  • phases (np.ndarray ( real ) or Tensor ( real )) – The phases {ϕn}\{\phi_n\} of the complex segment values. Must have the same length as moduli (or same shape, if you’re providing a batch).
  • duration (float) – The total duration τ\tau of the signal.
  • name (str or None , optional) – The name of the node.

Returns

The piecewise-constant function of time v(t)v(t), satisfying v(t)=Ωneiϕnv(t)=\Omega_n e^{i\phi_n} for tn1ttnt_{n-1}\leq t\leq t_n, where tn=nτ/Nt_n=n\tau/N (where NN is the number of values in {Ωn}\{\Omega_n\} and {ϕn}\{\phi_n\}). If you provide a batch of moduli and phases, the returned Pwc represents a corresponding batch of B1××BnB_1 \times \ldots \times B_n functions v(t)v(t).

Return type

Pwc

SEE ALSO

Graph.pwc_signal : Create Pwc signals from (possibly complex) values.

Notes

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

Examples

Create a complex piecewise-constant signal with batched moduli and phases.

>>> moduli = np.array([[1, 2], [3, 4]])
>>> phases = np.array([[0.1, 0.2], [0.5, 0.7]])
>>> graph.complex_pwc_signal(moduli=moduli, phases=phases, duration=0.2, name="signal")
<Pwc: name="signal", operation_name="complex_pwc_signal", value_shape=(), batch_shape=(2,)>
>>> result = bo.execute_graph(graph=graph, output_node_names="signal")
>>> result["output"]["signal"]
{
    'durations': array([0.1, 0.1]),
    'values': array([
        [0.99500417+0.09983342j, 1.96013316+0.39733866j],
        [2.63274769+1.43827662j, 3.05936875+2.57687075j]
    ]),
    'time_dimension': 1
}

See more examples in the Design robust single-qubit gates using computational graphs tutorial.

Was this useful?