Code
from qutip import Qobj
print(str(
1], [2], [3]])
Qobj([[ ))
Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket
Qobj data =
[[1.]
[2.]
[3.]]
December 28, 2021
In the last post I reviewed the Qiskit quantum computing framework. I mentioned that another framework I found is QuTiP and we will now review that (Johansson, Nation, and Nori 2012).
The QuTiP documentation starts with a description of the primitve Qobj which is > a data structure that is capable of encapsulating the properties of a quantum operator and ket/bra vectors.
Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket
Qobj data =
[[1.]
[2.]
[3.]]
Quantum object: dims = [[1], [3]], shape = (1, 3), type = bra
Qobj data =
[[1. 2. 3.]]
Quantum object: dims = [[4], [4]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[0.73741067 0.38012055 0.18891659 0.5947496 ]
[0.73478544 0.50153262 0.97199214 0.17788035]
[0.89417473 0.79639117 0.93951824 0.8901991 ]
[0.83072986 0.06070965 0.76528419 0.41292235]]
This start reminds me of tensors which should be easier to work with than using the different x
, y
and z
operations. The basic operations finishes with exactly that:
Quantum object: dims = [[3], [3]], shape = (3, 3), type = oper, isherm = True
Qobj data =
[[ 2. 2. 3.]
[ 2. 5. 6.]
[ 3. 6. 10.]]
I should be able to use my existing experience with tensors to work with this. Based on this start I’m quite hopeful.
Implementing a program using pure matrix operations is fine. It’s not really what I am looking for in Quantum Computing as I could just as easily do that with tensor arithmetic.
QuTiP also has a quantum circuit mode which requires another dependency - qutip-qip
(quantum information processing) (Li et al. 2021). I want to explore this to see how easy it is to use compared to the qiskit version. This is a separate package to reduce the overall maintenance burden of the qutip package, and so the documentation is separate. There is also a notebook showing some use of it.
To get this to work I had to install pdfcrop which, on ubuntu, requires sudo apt-get install texlive-extra-utils
.
RuntimeError: pdflatex failed. Perhaps you do not have it installed, or you are missing the LaTeX package 'qcircuit'.The latex code is printed below. Please try to compile locally using pdflatex:
\documentclass{standalone}
\usepackage[braket]{qcircuit}
\renewcommand{\qswap}{*=<0em>{\times}}
\begin{document}
\Qcircuit @C=1cm @R=1cm {
& & \gate{R_x(\frac{\pi}{2})} & \meter & \qw \\
& & \qw & \qw \cwx[1] & \qw \\
}
\end{document}
I’m fed up with this. I’ve spent about an hour trying to resolve this error and I am not interested in continuing.
Since I cannot usefully visualize the structure of the quantum circuit I cannot use this framework.