An open source Python library for quantum information research

Created by Vincent Russo. Supported by the Unitary Fund.

Theory of quantum information toolkit

  • Open source library for studying common objects in quantum information.

  • Tools for entanglement theory, nonlocal games, quantum state distinguishability, etc.

  • More "computer science" less "physics" focused.

Building blocks

Quantum information consists of:

States
Channels
Measurements

Building blocks

States
Channels
Measurements
  • States: Data to be processed.

  • Channels: Operations to perform.

  • Measurements: Result of operations on data.

Semidefinite programming

  • Generalization of linear programming.
  • Powerful tool with many applications in quantum information..
  • SDPs are efficiently solvable (polynomial time).
  • Software packages for solving SDPs exist (cvxpy).

Example: Bell states


                        from toqito.states import bell

                        bell(0) 
                        [[0.70710678],
                         [0.        ],
                         [0.        ],
                         [0.70710678]]
					

$$\texttt{bell(0)} = \frac{1}{\sqrt{2}} \left( |00 \rangle + |11 \rangle \right)$$

Examples of Basic Usage


                        from toqito.states import bell

                        # Density matrices corresponding to Bell states.
                        rho_0 = bell(0) * bell(0).conj().T
                        rho_1 = bell(1) * bell(1).conj().T
					

$$\rho_0 = \frac{1}{2} \left( |0\rangle \langle 0| + |0 \rangle \langle 1 | + |1 \rangle \langle 0| + |1 \rangle \langle 1|\right)$$
$$\rho_1 = \frac{1}{2} \left( |0\rangle \langle 0| - |0 \rangle \langle 1 | - |1 \rangle \langle 0| + |1 \rangle \langle 1|\right)$$

Examples of Basic Usage


                        from toqito.states import bell
                        from toqito.channels import partial_trace, partial_transpose
                        from toqito.matrix_ops import tensor
                        from toqito.state_props import is_pure
                        from toqito.state_metrics import fidelity

                        # Density matrices corresponding to Bell states.
                        rho_0 = bell(0) * bell(0).conj().T
                        rho_1 = bell(1) * bell(1).conj().T

                        # Compute tensor product of density matrices.
                        sigma = tensor(rho_0, rho_1)

                        # Trace out Alice's subsystem of the state.
                        partial_trace(sigma, sys=[1, 3], dim=[2, 2, 2, 2])
                        [[0.25 0.   0.   0.  ]
                         [0.   0.25 0.   0.  ]
                         [0.   0.   0.25 0.  ]
                         [0.   0.   0.   0.25]]

                        # Compute partial transpose of rho_0.
                        partial_transpose(rho_0)
                        [[0.5 0.  0.  0. ]
                         [0.  0.  0.5 0. ]
                         [0.  0.5 0.  0. ]
                         [0.  0.  0.  0.5]]

                        # Check if rho_0 is a pure state.
                        is_pure(rho_0)
                        True

                        # Fidelity between states rho_0 and rho_1.
                        fidelity(rho_0, rho_1)
                        0

                        # Fidelity between identical states.
                        fidelity(rho_0, rho_0)
                        1
					

Nonlocal games

The players: Alice and Bob.

Play cooperatively. Cannot communicate once game begins.

The referee.

Gives questions. Takes answers. Decides fate.

Nonlocal game.

  1. Referee gives "x" to Alice and "y" to Bob.
  2. Alice responds with "a" and Bob responds with "b".
  3. Referee decides fate based on questions (x,y) and answers (a,b).

CHSH game

$$ a \oplus b = x \land y$$

CHSH game


                        import numpy as np
                        from toqito.nonlocal_games.xor_game import XORGame

                        # The probability matrix.
                        prob_mat = np.array([[1/4, 1/4], [1/4, 1/4]])

                        # The predicate matrix.
                        pred_mat = np.array([[0, 0], [0, 1]])

					

Classical and quantum value of the CHSH game.

CHSH game


                        import numpy as np
                        from toqito.nonlocal_games.xor_game import XORGame

                        # The probability matrix.
                        prob_mat = np.array([[1/4, 1/4], [1/4, 1/4]])

                        # The predicate matrix.
                        pred_mat = np.array([[0, 0], [0, 1]])

                        # Define CHSH game from matrices.
                        chsh = XORGame(prob_mat, pred_mat)

                        # Classical value of the CHSH game.
                        # Value of 0.75 which is 3/4.
                        chsh.classical_value()
                        0.75

                        # Quantum value of the CHSH game. 
                        # Value is 0.8536 \approx cos^2(pi/8).
                        chsh.quantum_value()
                        0.8535533
					

XOR games vs. Nonlocal games

  • The CHSH game is an XOR game.
  • XOR games are a subset of nonlocal games.
  • Calculating the quantum value of general nonlocal games is hard.

Quantum state distinguishability

Quantum state distinguishability

State randomly selected from set. What state was given?

Classes of Measurements

  • LOCC: difficult to handle mathematically: difficult to design protocols/prove bounds.
  • SEP: nicer structure than LOCC; optimizing over this set is NP-hard.
  • PPT: nice structure; efficient optimization via SDP.

Distinguishing states


                        from toqito.states import bell
                        from toqito.state_opt import state_distinguishability
                        from toqito.state_opt import ppt_distinguishability
                        from toqito.state_opt import symmetric_extension_hierarchy

                        # Define the list of states.
                        states = [bell(0), bell(1), bell(2), bell(3)]

                        # Probability with which the state is selected.
                        probs = [1 / 4, 1 / 4, 1 / 4, 1 / 4]

                        # Distinguishing via global measurements.
                        state_distinguishability(states, probs)
                        1

                        # Distinguishing via PPT measurements.
                        ppt_distinguishability(states, probs)
                        0.5

                        # Hierarchy of SDPs converge to separable value (for some level).
                        symmetric_extension_hierarchy(states, probs, level=2)
                        0.5
					

Distinguishing Bell states via global, PPT, and separable measurements.

Distinguishing states


                        from toqito.states import bell
                        from toqito.state_opt import state_distinguishability
                        from toqito.state_opt import ppt_distinguishability
                        from toqito.state_opt import symmetric_extension_hierarchy

                        # Define the list of states.
                        states = [bell(0), bell(1), bell(2), bell(3)]

                        # Probability with which the state is selected.
                        probs = [1 / 4, 1 / 4, 1 / 4, 1 / 4]

                        # Distinguishing via global measurements.
                        state_distinguishability(states, probs)
                        1

                        # Distinguishing via PPT measurements.
                        ppt_distinguishability(states, probs)
                        0.5

                        # Hierarchy of SDPs converge to separable value (for some level).
                        symmetric_extension_hierarchy(states, probs, level=2)
                        0.5
					

It is known that distinguishing the Bell states via PPT, SEP, and LOCC yields 1/2.

pip install toqito

- GitHub: vprusso/toqito
- Website: vprusso.github.io/toqito
- Documentation toqito.readthedocs.io