Create the total infidelity of the given piecewise-constant system.
Use this function to compute the sum of the operational infidelity (which
measures how effectively the system achieves a target gate) and filter
function values (which measure how robust the system evolution is to
various perturbative noise processes). This total infidelity value
provides a cost that measures how effectively and robustly a set of
controls achieves a target operation.
Note that the total infidelity returned by this function is at least zero,
but might be larger than one (for example if the system is highly
sensitive to one of the noise processes).
- Parameters
hamiltonian (Pwc) – 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 Pwc], 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, optional) – The name of the node.
- Returns
The total infidelity (operational infidelity plus filter function
values) of the given system, with respect to the given target gate.
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
Tensor
Warning
The Hessian matrix cannot currently be calculated for a graph which includes
an infidelity_pwc node if the hamiltonian has degenerate eigenvalues at
any segment.
Notes
The total system Hamiltonian is
\[H_{\mathrm c}(t) + \sum_j \beta_j(t) N_j(t),\]
where \(\{\beta_j(t)\}\) are small, dimensionless, stochastic
variables.
The total infidelity, as represented by this node, is the sum of the
operational infidelity \(\mathcal{I}\) and the filter functions
\(\{F_j(0)\}\) of each noise operator evaluated at zero frequency.
The operational infidelity is
\[\mathcal{I} = 1-\left|
\frac{\mathrm{Tr} \left(U_\mathrm{target}^\dagger U(t)\right)}
{\mathrm{Tr} \left(U_\mathrm{target}^\dagger U_\mathrm{target}\right)}
\right|^2,\]
where \(U(t)\) is the unitary time evolution operator due to
\(H_{\mathrm c}(t)\).
The filter function for the noise operator \(N_j(t)\) is a measure of
robustness, defined at frequency \(f\) as
\[F_j(f) = \frac{1}{\mathrm{Tr}(P)} \mathrm{Tr} \left( P
\mathcal{F} \left\{ \tilde N_j^\prime(t) \right\} \left[ \mathcal{F}
\left\{ \tilde N^\prime (t) \right\} \right]^\dagger P \right),\]
where \(\mathcal{F}\) is the Fourier transform,
\(\tilde N_j(t) \equiv U_c^\dagger(t) N_j(t) U_c(t)\) is the
toggling-frame noise operator, and
\(\tilde N_j^\prime(t)\equiv
\tilde N_j(t)-
\frac{\mathrm{Tr}(P\tilde N_j(t)P)}{\mathrm{Tr}(P)} \mathbb{I}\)
differs from \(\tilde N_j(t)\) only by a multiple of the identity but
is trace-free on the subspace of interest. The filter function value at
zero frequency quantifies the sensitivity of the controls to quasi-static
noise applied via the corresponding noise operator.
Examples
Calculate infidelity of the identity gate for a noiseless single qubit.
>>> sigma_z = np.array([[1, 0], [0, -1]])
>>> hamiltonian = graph.pwc(
... durations=np.array([0.1, 0.1]), values=np.array([sigma_z, -sigma_z])
... )
>>> target = graph.target(np.eye(2))
>>> infidelity = graph.infidelity_pwc(
... hamiltonian=hamiltonian, target=target, name="infidelity"
... )
>>> result = qctrl.functions.calculate_graph(graph=graph, output_node_names=["infidelity"])
>>> result.output["infidelity"]["value"]
0.0
See more examples in the How to optimize controls with non-linear dependencies user guide.