Overview

The absolute basics for beginners

QuTIpy: the absolute basics for beginners

Welcome to the absolute beginner’s guide to QuTIpy! If you have comments or suggestions, please don’t hesitate to reach out!

Welcome to QuTIpy!

QuTIpy (Quantum Theory of Information for Python; pronounced /cutiɛ paɪ/) is an open source Python library that’s used for performing calculations with quantum states, channels and protocols. While there are many quantum information theory toolboxes that allow the user to perform basic operations such as the partial transposition, new tests are constantly discovered.

Installing QuTIpy

To install QuTIpy, we strongly recommend using a scientific Python distribution. If you’re looking for the full instructions for installing QuTIpy on your operating system, see Installing QuTIpy.

If you already have Python, you can install QuTIpy with:

$ python -m pip install https://github.com/sumeetkhatri/QuTIpy.git

How to import

To access QuTIpy and its functions import it in your Python code like this:

# Importing necessary dependencies
import cvxpy
import numpy as np
# Importing QuTIpy
from qutipy.general_functions import dag, eye, ...

We suggest numpy and cvxpy to be imported as complimentary packages.

Starting with an example code

We can start with a Complex Conjugate Transpose as an example for our demonstration.

Let's define an arbitrary matrix. Say X:

# Creating an arbitrary matrix
X = np.array(
    [
        [ 1,  2,  3,  4],
        [ 5,  6,  7,  8],
        [ 9, 10, 11, 12],
        [13, 14, 15, 16]
    ]
)

Now that we have our matrix X defined, we can import the dag function from our QuTIpy library and use it to find the complex conjugate transpose of our defined matrix.

from qutipy.general_functions import dag

# getting the complex conjugate transpose of `X`
dag(X)

The output will be the Complex Conjugate Transpose of the array X :

# Output
np.array([
    [1, 5,  9, 13],
    [2, 6, 10, 14],
    [3, 7, 11, 15],
    [4, 8, 12, 16]
])

Bra-Ket Notation

Let's jump into another common example, Driac Notation or Bra-Ket Notation as an example for our next demonstration.

The Bra-Ket notation is a concise and convenient way to describe quantum states.

import numpy as np

# Define a Ket using numpy
v = np.array([
    [1.],
    [0.]
])
from qutipy.general_functions import ket

# Define a Ket using QuTIpy
v = ket(2, 0)

The ket function takes the vector space as the first argument, and the ket value as the second argument.

Different states of different sizes can be generated based on the arguments.

Last updated