- Graph.time_evolution_operators_stf(hamiltonian, sample_times, evolution_times=None, *, name=None)
Calculate the time-evolution operators for a system defined by an STF Hamiltonian by using a 4th order Runge–Kutta method.
hamiltonian (Stf) – The control Hamiltonian, or batch of control Hamiltonians.
sample_times (list or tuple or np.ndarray(1D, real)) – The N times at which you want to sample the unitaries. Must be ordered and contain at least one element. If you don’t provide evolution_times, sample_times must start with 0.
evolution_times (list or tuple or np.ndarray(1D, real) or None, optional) – The times at which the Hamiltonian should be sampled for the Runge–Kutta integration. If you provide it, must start with 0 and be ordered. If you don’t provide it, the sample_times are used for the integration.
name (str or None, optional) – The name of the node.
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
- Return type:
Corresponding operation for Pwc Hamiltonians.
For more information on Stf nodes see the Working with time-dependent functions in Boulder Opal topic.
Simulate the dynamics of a qubit, where a simple Gaussian drive rotate the qubit along the x-axis.
>>> duration = np.pi >>> initial_state = np.array([1, 0]) >>> sigma_x = np.array([[0, 1], [1, 0]]) >>> time = graph.identity_stf() >>> gaussian_drive = graph.exp(-(time ** 2)) >>> hamiltonian = gaussian_drive * sigma_x * np.sqrt(np.pi) / 2 >>> graph.time_evolution_operators_stf( ... hamiltonian=hamiltonian, ... sample_times=[duration], ... evolution_times=np.linspace(0, duration, 200), ... name="unitaries", ... ) <Tensor: name="unitaries", operation_name="time_evolution_operators_stf", shape=(1, 2, 2)> >>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["unitaries"]) >>> result.output["unitaries"]["value"].dot(initial_state) array([[0.70711169 + 0.0j, 0.0 - 0.70710187j]])