Gate Fidelity

class lightworks.tomography.GateFidelity(n_qubits: int, base_circuit: PhotonicCircuit)

Bases: _ProcessTomography

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 realises the required operation and can be modified for performing tomography. It is required that the number of circuit input modes equals 2 * the number of qubits.

property fidelity: float

Returns the calculated fidelity of a process.

process(data: list[dict[State, int]] | dict[tuple[str, str], dict[State, int]], target_process: ndarray[tuple[int, ...], dtype[complex128]]) float

Calculates gate fidelity for an expected target process

Parameters:
  • data (list | dict) – The collected measurement data. If a list then this should match the order the experiments were provided, and if a dictionary, then each key should be tuple of the input and measurement basis.

  • 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