Utilities¶
- lightworks.tomography.utils.choi_from_unitary(unitary: ndarray[Any, dtype[complex128]]) ndarray[Any, dtype[complex128]] ¶
Calculates the expected choi matrix from a given unitary representation of a process.
- Parameters:
unitary (np.ndarray) – The unitary representation of the gate.
- Returns:
The calculated choi matrix.
- Return type:
np.ndarray
- lightworks.tomography.utils.density_from_state(state: list[complex] | ndarray[Any, dtype[complex128]]) ndarray[Any, dtype[complex128]] ¶
Calculates the expected density matrix from a given state.
- Parameters:
state (list | np.ndarray) – The vector representation of the state for which the density matrix should be calculated.
- Returns:
The calculated density matrix.
- Return type:
np.ndarray
- lightworks.tomography.utils.process_fidelity(choi: ndarray[Any, dtype[complex128]], choi_exp: ndarray[Any, dtype[complex128]]) float ¶
Calculates the fidelity of a process compared to an expected choi matrix.
- Parameters:
choi (np.ndarray) – The calculated choi matrix for the process.
choi_exp (np.ndarray) – The expected choi matrix.
- Returns:
The calculated fidelity value.
- Return type:
float
- lightworks.tomography.utils.state_fidelity(rho: ndarray[Any, dtype[complex128]], rho_exp: ndarray[Any, dtype[complex128]]) float ¶
Calculates the fidelity of the density matrix for a quantum state against the expected density matrix.
- Parameters:
rho (np.ndarray) – The calculated density matrix of the quantum state.
rho_exp (np.ndarray) – The expected density matrix.
- Returns:
The calculated fidelity value.
- Return type:
float