Skip to content

Commit

Permalink
Upgrade numpy (#754)
Browse files Browse the repository at this point in the history
* Bump numpy from 1.26.4 to 2.1.0

Bumps [numpy](https://github.com/numpy/numpy) from 1.26.4 to 2.1.0.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.26.4...v2.1.0)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* tutorials

* docstring failures

* correct some failures

* disable cvxpy related failures

* temporary disable rst checks

* try downgrading to 2.0.0

* add back line to test tutorials

* uncomment 2.1.0 failin examples

* update lock file

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
purva-thakre and dependabot[bot] committed Aug 25, 2024
1 parent 04e4919 commit 1878510
Show file tree
Hide file tree
Showing 50 changed files with 143 additions and 134 deletions.
2 changes: 1 addition & 1 deletion docs/intro_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fidelity function between quantum states that happen to be identical.
>>>
>>> # Calculate the fidelity between `rho` and `sigma`
>>> np.around(fidelity(rho, sigma), decimals=2)
1.0
np.float64(1.0)
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
Expand Down
20 changes: 10 additions & 10 deletions docs/tutorials.extended_nonlocal_games.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ This can be verified in :code:`toqito` as follows.
>>>
>>> # The unentangled value is cos(pi/8)**2 \approx 0.85356
>>> np.around(bb84.unentangled_value(), decimals=2)
0.85
np.float64(0.85)
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
Expand All @@ -340,7 +340,7 @@ example of two parallel repetitions for the BB84 game.
>>>
>>> # The unentangled value for two parallel repetitions is cos(pi/8)**4 \approx 0.72855
>>> np.around(bb84_2_reps.unentangled_value(), decimals=2)
0.73
np.float64(0.73)
It was shown in :cite:`Johnston_2016_Extended` that the BB84 game possesses the property of strong
parallel repetition. That is,
Expand All @@ -367,7 +367,7 @@ using :code:`toqito` as well.
>>>
>>> # The standard quantum value is cos(pi/8)**2 \approx 0.85356
>>> np.around(bb84_lb.quantum_value_lower_bound(), decimals=2)
0.85
np.float64(0.85)
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
Expand Down Expand Up @@ -395,7 +395,7 @@ Using :code:`toqito`, we can see that :math:`\omega_{ns}(G) = \cos^2(\pi/8)`.
>>>
>>> # The non-signaling value is cos(pi/8)**2 \approx 0.85356
>>> np.around(bb84.nonsignaling_value(), decimals=2)
0.85
np.float64(0.85)
So we have the relationship that

Expand All @@ -417,7 +417,7 @@ can observe this by the following snippet.
>>>
>>> # The non-signaling value for two parallel repetitions is cos(pi/8)**4 \approx 0.73825
>>> np.around(bb84_2_reps.nonsignaling_value(), decimals=2)
0.74
np.float64(0.74)
Note that :math:`0.73825 \geq \cos(\pi/8)^4 \approx 0.72855` and therefore we
have that
Expand Down Expand Up @@ -528,7 +528,7 @@ the unentangled value of :math:`G_{CHSH}`.
>>>
>>> # The unentangled value is 3/4 = 0.75
>>> np.around(chsh.unentangled_value(), decimals=2)
0.75
np.float64(0.75)
We can also run multiple repetitions of :math:`G_{CHSH}`.

Expand All @@ -543,7 +543,7 @@ We can also run multiple repetitions of :math:`G_{CHSH}`.
>>>
>>> # The unentangled value for two parallel repetitions is (3/4)**2 \approx 0.5625
>>> np.around(chsh_2_reps.unentangled_value(), decimals=2)
0.56
np.float64(0.56)
Note that strong parallel repetition holds as

Expand All @@ -567,7 +567,7 @@ non-signaling value.
>>>
>>> # The non-signaling value is 3/4 = 0.75
>>> np.around(chsh.nonsignaling_value(), decimals=2)
0.75
np.float64(0.75)
As we know that :math:`\omega(G_{CHSH}) = \omega_{ns}(G_{CHSH}) = 3/4` and that

Expand Down Expand Up @@ -690,7 +690,7 @@ Now that we have encoded :math:`G_{MUB}`, we can calculate the unentangled value
>>> g_mub = ExtendedNonlocalGame(prob_mat, pred_mat)
>>> unent_val = g_mub.unentangled_value()
>>> np.around(unent_val, decimals=2)
0.65
np.float64(0.65)
That is, we have that

Expand All @@ -707,7 +707,7 @@ obtain.
>>> g_mub = ExtendedNonlocalGame(prob_mat, pred_mat)
>>> q_val = g_mub.quantum_value_lower_bound()
>>> np.around(q_val, decimals=2)
0.66
np.float64(0.66)
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
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials.nonlocal_games.rst
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ use :code:`toqito` to determine the lower bound on the quantum value.
>>> from toqito.nonlocal_games.nonlocal_game import NonlocalGame
>>> chsh = NonlocalGame(prob_mat, pred_mat)
>>> np.around(chsh.quantum_value_lower_bound(), decimals=2)
0.85
np.float64(0.85)
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 @@ -414,9 +414,9 @@ value and calculate lower bounds on the quantum value of the FFL game.
>>> # Define the FFL game object.
>>> ffl = NonlocalGame(prob_mat, pred_mat)
>>> np.around(ffl.classical_value(), decimals=2)
0.67
np.float64(0.67)
>>> np.around(ffl.quantum_value_lower_bound(), decimals=2)
0.22
np.float64(0.22)
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
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials.state_distinguishability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Using :code:`toqito`, we can calculate this probability directly as follows:
>>> # Calculate the probability with which Bob can
>>> # distinguish the state he is provided.
>>> np.around(state_distinguishability(states, probs)[0], decimals=2)
1.0
np.float64(1.0)
Specifying similar state distinguishability problems can be done so using this
general pattern.
Expand Down Expand Up @@ -230,7 +230,7 @@ via PPT measurements in the following manner.
>>> states = [rho_1, rho_2, rho_3, rho_4]
>>> probs = [1 / 4, 1 / 4, 1 / 4, 1 / 4]
>>> np.around(ppt_distinguishability(vectors=states, probs=probs, dimensions=[2, 2, 2, 2], subsystems=[0, 2])[0], decimals=2)
0.87
np.float64(0.87)
Probability of distinguishing a state via separable measurements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials.xor_quantum_value.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ value of the CHSH game.
>>> from toqito.nonlocal_games.xor_game import XORGame
>>> chsh = XORGame(prob_mat, pred_mat)
>>> chsh.classical_value()
0.75
np.float64(0.75)
A quantum strategy for the CHSH game
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -290,7 +290,7 @@ follows:
>>> import numpy as np
>>> np.around(chsh.quantum_value(), decimals=2)
0.85
np.float64(0.85)
For reference, the complete code to calculate both the classical and quantum
values of the CHSH game is provided below.
Expand All @@ -305,9 +305,9 @@ values of the CHSH game is provided below.
... [0, 1]])
>>> chsh = XORGame(prob_mat, pred_mat)
>>> chsh.classical_value()
0.75
np.float64(0.75)
>>> np.around(chsh.quantum_value(), decimals=2)
0.85
np.float64(0.85)
The odd cycle game
------------------
Expand Down Expand Up @@ -350,9 +350,9 @@ the classical and quantum values of this game.
>>> # Compute the classical and quantum values.
>>> odd_cycle = XORGame(prob_mat, pred_mat)
>>> np.around(odd_cycle.classical_value(), decimals=2)
0.9
np.float64(0.9)
>>> np.around(odd_cycle.quantum_value(), decimals=2)
0.98
np.float64(0.98)
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
Expand Down
93 changes: 51 additions & 42 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1878510

Please sign in to comment.