:py:mod:`channel_metrics.channel_fidelity` ========================================== .. py:module:: channel_metrics.channel_fidelity .. autoapi-nested-parse:: Compute the channel fidelity between two quantum channels. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: channel_metrics.channel_fidelity.channel_fidelity .. py:function:: channel_fidelity(choi_1, choi_2) Compute the channel fidelity between two quantum channels :cite:`Katariya_2021_Geometric`. Let :math:`\Phi : \text{L}(\mathcal{Y}) \rightarrow \text{L}(\mathcal{X})` and :math:`\Psi: \text{L}(\mathcal{Y}) \rightarrow \text{L}(\mathcal{X})` be quantum channels. Then the root channel fidelity defined as .. math:: \sqrt{F}(\Phi, \Psi) := \text{inf}_{\rho} \sqrt{F}(\Phi(\rho), \Psi(\rho)) where :math:`\rho \in \text{D}(\mathcal{Z} \otimes \mathcal{X})` can be calculated by means of the following semidefinite program (Proposition 50) in :cite:`Katariya_2021_Geometric`, .. math:: \begin{align*} \text{maximize:} \quad & \lambda \\ \text{subject to:} \quad & \lambda \mathbb{I}_{\mathcal{Z}} \leq \text{Re}\left( \text{Tr}_{\mathcal{Y}} \left( Q \right) \right),\\ & \begin{pmatrix} J(\Phi) & Q^* \\ Q & J(\Psi) \end{pmatrix} \geq 0 \end{align*} where :math:`Q \in \text{L}(\mathcal{Z} \otimes \mathcal{X})`. .. rubric:: Examples For two identical channels, we should expect that the channel fidelity should yield a value of :math:`1`. >>> from toqito.channels import dephasing >>> from toqito.channel_metrics import channel_fidelity >>> >>> # The Choi matrices of dimension-4 for the dephasing channel >>> choi_1 = dephasing(4) >>> choi_2 = dephasing(4) >>> '%.2f' % channel_fidelity(choi_1, choi_2) '1.00' .. note:: You do not need to use `'%.2f' %` when you use this function. We use this to format our output such that `doctest` compares the calculated output to the expected output upto two decimal points only. The accuracy of the solvers can calculate the `float` output to a certain amount of precision such that the value deviates after a few digits of accuracy. We can also compute the channel fidelity between two different channels. For example, we can compute the channel fidelity between the dephasing and depolarizing channels. >>> from toqito.channels import dephasing, depolarizing >>> from toqito.channel_metrics import channel_fidelity >>> >>> # The Choi matrices of dimension-4 for the dephasing and depolarizing channels >>> choi_1 = dephasing(4) >>> choi_2 = depolarizing(4) >>> '%.2f' % channel_fidelity(choi_1, choi_2) '0.50' .. note:: You do not need to use `'%.2f' %` when you use this function. We use this to format our output such that `doctest` compares the calculated output to the expected output upto two decimal points only. The accuracy of the solvers can calculate the `float` output to a certain amount of precision such that the value deviates after a few digits of accuracy. .. rubric:: References .. bibliography:: :filter: docname in docnames :raises ValueError: If matrices are not of equal dimension. :raises ValueError: If matrices are not square. :param choi_1: The Choi matrix of the first quantum channel. :param choi_2: The Choi matrix of the second quantum channel. :return: The channel fidelity between the channels specified by the quantum channels corresponding to the Choi matrices :code:`choi_1` and :code:`choi_2`.