QuTIpy
QuTIpy (Quantum Theory of Information for Python; pronounced /cutiɛ paɪ/)
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 QETLAB package 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 SDPs (e.g., for the diamond norm). It requires sympy
for symbolic computations.
Installation
A simple pip install from the github repository will install the package in your system.
Examples
Here are some simple examples.
We start by importing the package:
Creating basis vectors
To create the qubit state , we execute the following line.
The first argument specifies the dimension, in this case two, and the second argument is the index for the basis vector that we want. The output of the above line is the following numpy matrix object:
Similarly,
gives the following output:
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 can be created as follows:
In general, ket(d, [j1, j2, ... , jn])
creates the n-fold tensor product of d-dimensional basis vectors.
Taking the partial trace
Given an operator acting on a tensor product Hilbert space of the quantum systems A
and B
, the partial trace over B
can be calculated as follows:
Here, dimA
is the dimension of system A
and dimB
is the dimension of system B
. Similarly,
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
We can generate a random quantum state (i.e., density matrix) in d
dimensions as follows:
To generate a random pure state (i.e., state vector) in d
dimensions:
To generate an isotropic state in d
dimensions:
where p
is the fidelity to the maximally entangled state.
Another special class of states is the Werner states:
The Isotropic State can be viewed as a probabilistic mixture of the Qudit Bell states, such that the state is prepared with probability , and the states , with , are prepared with probability . This implies that every isotropic state is a Bell-diagonal state, that it has full rank, and that its eigenvalues are and (the latter with multiplicity ).
The Werner state , for 2 quantum systems and , with , is a mixture of projectors onto the symmetric and antisymmetric subspaces, with the relative weight being the main parameter that defines the state,
for ,
such that
where and are quantum states and are proportional to the projections onto the anti-symmetric and symmetric subspaces respectively.
Quantum channels
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 Qubit Pauli channel as follows:
where px, py, pz
are the probabilities of the individual Pauli Matrices. The output of this function contains the Kraus operators of the channel as well as an isometric extension of the channel.
In order to apply a quantum channel to a quantum state rho
, we can use the function apply_channel
. First, let us define the following amplitude damping channel :
The variable K
contains the Kraus operators of the channel. Then,
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
Thanks to Mark Wilde for suggesting the name for the package.
Last updated