time_evolution_operators_pwc

Graph.time_evolution_operators_pwc(hamiltonian, sample_times, *, name=None)

Calculate the unitary time-evolution operators for a system defined by a piecewise-constant Hamiltonian.

Parameters
  • hamiltonian (Pwc) – The control Hamiltonian, or batch of control Hamiltonians.

  • sample_times (np.ndarray(1D, real)) – The N times at which you want to sample the unitaries. Must be ordered and contain at least one element.

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

Returns

Tensor of shape (..., N, D, D), representing the unitary time evolution. The n-th element (along the -3 dimension) represents the unitary (or batch of unitaries) from t = 0 to sample_times[n].

Return type

Tensor

See also

state_evolution_pwc()

Evolve a quantum state.

time_evolution_operators_stf()

Corresponding operation for Stf Hamiltonians.

Notes

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

Examples

Simulate the dynamics of a single qubit, where a constant drive rotates the qubit along the x-axis.

>>> initial_state = np.array([1, 0])
>>> sigma_x = np.array([[0, 1], [1, 0]])
>>> duration = np.pi
>>> hamiltonian = graph.constant_pwc_operator(duration=duration, operator=sigma_x / 2)
>>> graph.time_evolution_operators_pwc(
...     hamiltonian=hamiltonian, sample_times=np.array([duration]), name="unitaries"
... )
<Tensor: name="unitaries", operation_name="time_evolution_operators_pwc", shape=(1, 2, 2)>
>>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["unitaries"])
>>> result.output["unitaries"]["value"].dot(initial_state)
array([[5.0532155e-16+0.j, 0.0000000e+00-1.j]])

See more examples in the How to simulate quantum dynamics for noiseless systems using graphs user guide.