⚛️
QuTIpy : Quantum Theory of Information for Python
  • QuTIpy
  • Getting Started
    • Overview
    • Installation
      • Install with pip
      • Install with git
  • Modules
    • Pauli
    • General Functions
    • States
Powered by GitBook
On this page
  • Requirements
  • Installation
  • Examples
  • Creating basis vectors
  • Taking the partial trace
  • Quantum states
  • Quantum channels
  • Summary of other features
  • Acknowledgements

QuTIpy

QuTIpy (Quantum Theory of Information for Python; pronounced /cutiɛ paɪ/)

NextGetting Started

Last updated 3 years ago

Quantum Theory of Information for Python; pronounced "cutie pie". A package for performing calculations with quantum states, channels and protocols. It is comparable to the for MATLAB/Octave.

Requirements

The code requires Python 3, and apart from the standard numpy and scipy packages, it requires cvxpy if you want to run (e.g., for the ). It requires sympy for symbolic computations.

Installation

A simple pip install from the github repository will install the package in your system.

$ pip install git+https://github.com/sumeetkhatri/QuTIpy

Examples

Here are some simple examples.

We start by importing the package:

>>> from qutipy import *
>>> from qutipy.general_functions import *

Creating basis vectors

To create the qubit ∣0⟩{\displaystyle |0\rangle }∣0⟩, we execute the following line.

>>> ket(2,0)
matrix([[1.],
        [0.]])

Similarly,

>>> ket(2,1)

gives the following output:

matrix([[0.],
        [1.]])

In general, ket(d,j), for j between 0 and d-1, generates a d-dimensional column vector (as a numpy matrix) in which the jth entry contains a one.

We can take tensor products of d-dimensional basis vectors using ket(). For example, the two-qubit state ∣0⟩∣0⟩{\displaystyle |0\rangle|0\rangle }∣0⟩∣0⟩ can be created as follows:

>>> ket( 2, [0, 0] )

In general, ket(d, [j1, j2, ... , jn]) creates the n-fold tensor product ∣j1⟩∣j2⟩...∣jn⟩{\displaystyle |j_1\rangle|j_2\rangle...|j_n\rangle }∣j1​⟩∣j2​⟩...∣jn​⟩ of d-dimensional basis vectors.

Taking the partial trace

>>> partial_trace(R_AB, [2], [dimA, dimB])

Here, dimA is the dimension of system A and dimB is the dimension of system B. Similarly,

>>> partial_trace(R_AB, [1], [dimA, dimB])

takes the partial trace of R_AB over system A. In general, partial_trace(R,sys,dim) traces over the systems in the list sys, and dim is a list of the dimensions of all of the subsystems on which the operator R acts.

Quantum states

>>> RandomDensityMatrix(d)
>>> RandomPureState(d)

To generate an isotropic state in d dimensions:

>>> isotropic_state(p,d)

where p is the fidelity to the maximally entangled state.

Another special class of states is the Werner states:

>>> Werner_state(p,d)

for ρAB=ρABW;p\rho_{AB}=\rho^{W;p}_{AB}ρAB​=ρABW;p​ ,

such that ρABW;p:=pζAB+(1−p)ζAB⊥\rho^{W;p}_{AB} := p\zeta_{AB} + (1 − p)\zeta^\bot_{AB}ρABW;p​:=pζAB​+(1−p)ζAB⊥​

where ζAB\zeta_{AB}ζAB​ and ζAB⊥\zeta^\bot_{AB}ζAB⊥​ are quantum states and are proportional to the projections onto the anti-symmetric and symmetric subspaces respectively.

Quantum channels

>>> Pauli_channel(px, py, pz)
>>> K = amplitude_damping_channel(0.2)
>>> rho_out = apply_channel(K, rho)

gives the state at the output of the channel when the input state is rho.

Other functions include:

  • Getting the Choi and natural representation of a channel from its Kraus representation

  • Converting between the Choi, natural, and Kraus representations of a channel

Summary of other features

The package also contains functions for:

  • Trace norm

  • Fidelity and entanglement fidelity

  • Random unitaries

  • Clifford unitaries

  • Generators of the su(d) Lie algebra (for d=2, this is the set of Pauli matrices)

  • Discrete Weyl operators

  • von Neumann entropy and relative entropy

  • Renyi entropies

  • Coherent information and Holevo information for states and channels

Acknowledgements

The first argument specifies the dimension, in this case two, and the second argument is the index for the that we want. The output of the above line is the following numpy matrix object:

Given an operator RABR_{AB}RAB​ acting on a tensor product of the quantum systems A and B, the over B can be calculated as follows:

We can generate a random (i.e., ) in d dimensions as follows:

To generate a random (i.e., state vector) in d dimensions:

The Isotropic State can be viewed as a probabilistic mixture of the Bell states, such that the state ∣ϕ⟩⟨ϕ∣{\displaystyle |\phi\rangle\langle\phi| }∣ϕ⟩⟨ϕ∣ is prepared with probability ppp, and the states ∣ϕz,x⟩⟨ϕz,x∣{\displaystyle |\phi_{z,x}\rangle\langle\phi_{z,x}| }∣ϕz,x​⟩⟨ϕz,x​∣, with (z,x)≠(0,0)(z, x) \neq (0, 0)(z,x)=(0,0), are prepared with probability 1−pd2−1\frac{1−p} {d^2−1}d2−11−p​. This implies that every isotropic state is a Bell-diagonal state, that it has full rank, and that its eigenvalues are ppp and 1−pd2−1\frac{1−p} {d^2−1}d2−11−p​ (the latter with multiplicity d2−1d^2 − 1d2−1).

The Werner state WAB(p,d){\displaystyle W_{AB}^{(p,d)}}WAB(p,d)​, for 2 quantum systems AAA and BBB, with dA=dB=d≥2d_A = d_B = d ≥ 2dA​=dB​=d≥2, is a mixture of onto the symmetric and antisymmetric subspaces, with the relative weight p∈[0,1]{\displaystyle p\in [0,1]}p∈[0,1] being the main parameter that defines the state,

The package comes with functions for commonly-used channels such as the depolarizing channel and the amplitude damping channel. One can also create an arbitrary Pauli channel as follows:

where px, py, pz are the probabilities of the individual . The output of this function contains the of the as well as an isometric extension of the channel.

In order to apply a to a rho, we can use the function apply_channel. First, let us define the following :

The variable K contains the of the channel. Then,

Thanks to for suggesting the name for the package.

QETLAB package
SDPs
diamond norm
state
basis vector
Hilbert space
partial trace
quantum state
density matrix
pure state
Qudit
projectors
Qubit
Pauli Matrices
Kraus operators
channel
quantum channel
quantum state
amplitude damping channel
Kraus operators
Mark Wilde