Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing redundant note for doctest. #651

Merged
merged 12 commits into from
Jul 10, 2024
8 changes: 0 additions & 8 deletions docs/intro_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,6 @@ fidelity function between quantum states that happen to be identical.
>>> '%.2f' % fidelity(rho, sigma)
'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.

There are a number of other metrics one can compute on two density matrices
including the trace norm, trace distance. These and others are also available
in :code:`toqito`. For a full list of distance metrics one can compute on
Expand Down
77 changes: 0 additions & 77 deletions docs/tutorials.extended_nonlocal_games.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,6 @@ This can be verified in :code:`toqito` as follows.
>>> '%.2f' % bb84.unentangled_value()
'0.85'


.. 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.

The BB84 game also exhibits strong parallel repetition. We can specify how many
parallel repetitions for :code:`toqito` to run. The example below provides an
example of two parallel repetitions for the BB84 game.
Expand All @@ -348,14 +340,6 @@ example of two parallel repetitions for the BB84 game.
>>> '%.2f' % bb84_2_reps.unentangled_value()
'0.73'


.. 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.

It was shown in :cite:`Johnston_2016_Extended` that the BB84 game possesses the property of strong
parallel repetition. That is,

Expand All @@ -382,14 +366,6 @@ using :code:`toqito` as well.
>>> '%.2f' % bb84_lb.quantum_value_lower_bound()
'0.85'


.. 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.

From :cite:`Johnston_2016_Extended`, it is known that :math:`\omega(G_{BB84}) =
\omega^*(G_{BB84})`, however, if we did not know this beforehand, we could
attempt to calculate upper bounds on the standard quantum value.
Expand Down Expand Up @@ -417,13 +393,6 @@ Using :code:`toqito`, we can see that :math:`\omega_{ns}(G) = \cos^2(\pi/8)`.
>>> '%.2f' % bb84.nonsignaling_value()
'0.85'

.. 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.

So we have the relationship that

.. math::
Expand All @@ -445,13 +414,6 @@ can observe this by the following snippet.
>>> '%.2f' % bb84_2_reps.nonsignaling_value()
'0.74'

.. 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.

Note that :math:`0.73825 \geq \cos(\pi/8)^4 \approx 0.72855` and therefore we
have that

Expand Down Expand Up @@ -562,13 +524,6 @@ the unentangled value of :math:`G_{CHSH}`.
>>> '%.2f' % chsh.unentangled_value()
'0.75'

.. 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 run multiple repetitions of :math:`G_{CHSH}`.

.. code-block:: python
Expand All @@ -583,14 +538,6 @@ We can also run multiple repetitions of :math:`G_{CHSH}`.
>>> '%.2f' % chsh_2_reps.unentangled_value()
'0.56'


.. 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.

Note that strong parallel repetition holds as

.. math::
Expand All @@ -614,14 +561,6 @@ non-signaling value.
>>> '%.2f' % chsh.nonsignaling_value()
'0.75'

.. 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.


As we know that :math:`\omega(G_{CHSH}) = \omega_{ns}(G_{CHSH}) = 3/4` and that

.. math::
Expand Down Expand Up @@ -744,14 +683,6 @@ Now that we have encoded :math:`G_{MUB}`, we can calculate the unentangled value
>>> '%.2f' % unent_val
'0.65'


.. 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.

That is, we have that

.. math::
Expand All @@ -768,14 +699,6 @@ obtain.
>>> '%.2f' % q_val
'0.66'


.. 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.

Note that as we are calculating a lower bound, it is possible that a value this
high will not be obtained, or in other words, the algorithm can get stuck in a
local maximum that prevents it from finding the global maximum.
Expand Down
14 changes: 0 additions & 14 deletions docs/tutorials.nonlocal_games.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,6 @@ use :code:`toqito` to determine the lower bound on the quantum value.
>>> '%.2f' % chsh.quantum_value_lower_bound()
'0.85'

.. 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.

In this case, we can see that the quantum value of the CHSH game is in fact
attained as :math:`\cos^2(\pi/8) \approx 0.85355`.

Expand Down Expand Up @@ -424,13 +417,6 @@ value and calculate lower bounds on the quantum value of the FFL game.
>>> '%.2f' % ffl.quantum_value_lower_bound()
'0.22'

.. 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.

In this case, we obtained the correct quantum value of :math:`2/3`, however,
the lower bound technique is not guaranteed to converge to the true quantum
value in general.
Expand Down
14 changes: 0 additions & 14 deletions docs/tutorials.state_distinguishability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,6 @@ Using :code:`toqito`, we can calculate this probability directly as follows:
>>> '%.2f' % state_distinguishability(states, probs)[0]
'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.

Specifying similar state distinguishability problems can be done so using this
general pattern.

Expand Down Expand Up @@ -238,13 +231,6 @@ via PPT measurements in the following manner.
>>> '%.2f' % ppt_distinguishability(vectors=states, probs=probs, dimensions=[2, 2, 2, 2], subsystems=[0, 2])[0]
'0.87'

.. 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.

Probability of distinguishing a state via separable measurements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
22 changes: 0 additions & 22 deletions docs/tutorials.xor_quantum_value.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,6 @@ follows:
>>> '%.2f' % chsh.quantum_value()
'0.85'

.. 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.

For reference, the complete code to calculate both the classical and quantum
values of the CHSH game is provided below.

Expand All @@ -315,14 +308,6 @@ values of the CHSH game is provided below.
>>> '%.2f' % chsh.quantum_value()
'0.85'


.. 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.

The odd cycle game
------------------

Expand Down Expand Up @@ -368,13 +353,6 @@ the classical and quantum values of this game.
>>> '%.2f' % odd_cycle.quantum_value()
'0.98'

.. 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.

Note that the odd cycle game is another example of an XOR game where the
players are able to win with a strictly higher probability if they adopt a
quantum strategy. For a general XOR game, Alice and Bob may perform equally
Expand Down
17 changes: 0 additions & 17 deletions toqito/channel_metrics/channel_fidelity.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ def channel_fidelity(choi_1: np.ndarray, choi_2: np.ndarray) -> float:
>>> '%.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.

Expand All @@ -68,15 +60,6 @@ def channel_fidelity(choi_1: np.ndarray, choi_2: np.ndarray) -> float:
>>> '%.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.


References
==========
.. bibliography::
Expand Down
17 changes: 0 additions & 17 deletions toqito/channel_metrics/diamond_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ def diamond_norm(choi_1: np.ndarray, choi_2: np.ndarray) -> float:
>>> print("Diamond norm between depolarizing and identity channels: ", '%.2f' % dn)
Diamond norm between depolarizing and identity channels: -0.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.


Similarly, we can compute the diamond norm between the dephasing channel (with parameter 0.3) and the identity
channel:

Expand All @@ -51,14 +42,6 @@ def diamond_norm(choi_1: np.ndarray, choi_2: np.ndarray) -> float:
>>> print("Diamond norm between dephasing and identity channels: ", '%.2f' % dn)
Diamond norm between dephasing and identity channels: -0.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.

References
==========
.. bibliography::
Expand Down
9 changes: 0 additions & 9 deletions toqito/channel_metrics/fidelity_of_separability.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ def fidelity_of_separability(
>>> '%.2f' % expected_value
'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.


References
==========
.. bibliography::
Expand Down
7 changes: 0 additions & 7 deletions toqito/matrix_props/kp_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ def kp_norm(mat: np.ndarray, k: int, p: int) -> float:
>>> '%.2f' % kp_norm(random_unitary(5), 5, 2)
'2.24'

.. 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.

:param mat: 2D numpy ndarray
:param k: The number of singular values to take.
:param p: The order of the norm.
Expand Down
8 changes: 0 additions & 8 deletions toqito/nonlocal_games/quantum_hedging.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ class QuantumHedging:
>>> '%.2f' % molina_watrous.max_prob_outcome_a_primal()
'0.85'

.. 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.

References
==========
.. bibliography::
Expand Down
16 changes: 0 additions & 16 deletions toqito/nonlocal_games/xor_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ class XORGame:
>>> chsh.classical_value()
0.75

.. 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.

The odd cycle game

The odd cycle game is another XOR game :cite:`Cleve_2010_Consequences`. For this game, we can
Expand Down Expand Up @@ -120,14 +112,6 @@ class XORGame:
>>> '%.1f' % odd_cycle.classical_value()
'0.9'

.. note::
You do not need to use `'%.2f' %` or `'%.1f' %` 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.

References
==========
.. bibliography::
Expand Down
Loading
Loading