Gate Fidelity

class lightworks.tomography.GateFidelity(n_qubits: int, base_circuit: PhotonicCircuit, experiment: Callable[[list[PhotonicCircuit], list[State]], list[dict[State, int]]], experiment_args: list[Any] | None = None)

Computes the average gate fidelity using equation 19 from https://arxiv.org/pdf/quant-ph/0205035, which involves performing state tomography for a set of inputs.

Parameters:
  • n_qubits (int) – The number of qubits that will be used as part of the tomography.

  • base_circuit (PhotonicCircuit) – An initial circuit which produces the required output state and can be modified for performing tomography. It is required that the number of circuit input modes equals 2 * the number of qubits.

  • experiment (Callable) – A function for performing the required tomography experiments. This should accept a list of circuits and a list of inputs and then return a list of results to process.

  • experiment_args (list | None) – Optionally provide additional arguments which will be passed directly to the experiment function.

property fidelity: float

Returns the calculated fidelity of a process.

process(target_process: ndarray[Any, dtype[complex128]]) float

Calculates gate fidelity for an expected target process

Parameters:

target_process (np.ndarray) – The unitary matrix corresponding to the target process. The dimension of this should be 2^n_qubits.

Returns:

The calculated fidelity.

Return type:

float