Graph.infidelity_stf(sample_times, hamiltonian, target, noise_operators=None, *, name=None)

Create the total infidelity of a given system with a sampleable Hamiltonian.

See infidelity_pwc for information about the total infidelity created by this function.

  • sample_times (np.ndarray(1D, real)) – The times at which the Hamiltonian and noise operators (if present) should be sampled for the integration. Must start with 0, be ordered, and contain at least one element.

  • hamiltonian (Stf) – The control Hamiltonian \(H_{\mathrm c}(t)\). You can provide either a single Hamiltonian or a batch of them.

  • target (Target) – The object describing the target gate \(U_\mathrm{target}\) and (optionally) the filter function projector \(P\). If you provide a batch of Hamiltonians, the function uses the same target for all the elements in the batch.

  • noise_operators (list[np.ndarray or Tensor or Stf] or None, optional) – The perturbative noise operators \(\{N_j(t)\}\). The operators in the list can either be single operators or batches of them. If any of the noise operators or the Hamiltonian are batches, the batch shapes must all be broadcastable. You can omit this list if there are no noises.

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


The total infidelity (operational infidelity plus filter function values) of the given system, with respect to the given target gate, at the last time in sample_times. If you provide a batch of Hamiltonians or noise operators, the function returns a batch of infidelities containing one infidelity for each Hamiltonian and list of noise operators in the input batches.

Return type:


See also


Corresponding operation for Pwc Hamiltonians.

Define the target operation of the time evolution.


Unitary time evolution operators for quantum systems with Stf Hamiltonians.


Calculate the infidelity of the Pauli \(X\) gate for a noiseless qubit.

>>> sigma_x = np.array([[0, 1], [1, 0]])
>>> hamiltonian = graph.constant_stf_operator(np.pi * sigma_x / 2)
>>> target =
>>> infidelity = graph.infidelity_stf(
...     sample_times=np.linspace(0, 0.5, 100),
...     hamiltonian=hamiltonian,
...     target=target,
...     name="infidelity",
... )
>>> result = bo.execute_graph(graph=graph, output_node_names="infidelity")
>>> result["output"]["infidelity"]["value"]