# Overview

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!

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.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

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.We can start with a

**Complex Conjugate Transpose**as an example for our demonstration.Let's define an arbitrary matrix. Say

`X`

: $X=\begin{bmatrix}
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
9 & 10 & 11 & 12 \\
13 & 14 & 15 & 16
\end{bmatrix}$

# 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]

])

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.A

**Ket**is of the form$|v\rangle$

. Mathematically it denotes a vector, ${\boldsymbol {v}}$

, in an complex vector space $V$

, and physically it represents a state of some quantum system. An example of a **Ket**can be$|r\rangle } = \begin{bmatrix} x \\ y\\ z\end{bmatrix$

can represent a vector $\vec{r} = \begin{bmatrix} x \\ y\\ z \end{bmatrix}$

.A

**bra**is of the form$\langle f|$

. Mathematically it denotes a linear form $f:V\to \mathbb {C}$

, i.e. a linear map that maps each vector in $V$

to a number in the complex plane $\mathbb {C}$

. Letting the linear functional $\langle f|$

act on a vector $|v\rangle$

is written as $\langle f|v\rangle \in \mathbb {C}$

.Lets define a

**ket**v for$|v\rangle } = \begin{bmatrix} 1 \\ 0 \end{bmatrix$

,To define

$|v\rangle$

using numpy, one need to define the vector space as *matrices*.import numpy as np

# Define a Ket using numpy

v = np.array([

[1.],

[0.]

])

But one can directly define

$|v\rangle$

with QuTIpy.Example:

`ket( 2, 0 )=`

$|0\rangle$

and `ket( 2, 1 )=`

$|1\rangle$

from qutipy.general_functions import ket

# Define a Ket using QuTIpy

v = ket(2, 0)

The

`ket`

function takes the *, and the***vector space as the first argument***.***ket value as the second argument**Different states of different sizes can be generated based on the arguments.

`ket( 2, 1 )=`

$|01\rangle$

`= `

$\begin{bmatrix} 0 \\ 1 \end{bmatrix}$

`ket( 3, 1 )=`

$|010\rangle$

`=`

$\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}$

Last modified 8mo ago