Matrices everywhere

Oh, human bias. It is amazing how language conditions our understanding and how different domains refer to the same concept differently. Be it due to subtleties or simply field lingo inertia, often can make it hard when switching fields or when new hybrid fields emerge. In my case, Quantum Computing has that contamination between computer science and physics that often makes it hard to understand each other.

I am always amazed when I see someone using x, y and z indices on a loop instead of i, j and k. Why? Who knows, force of habit. Funny enough, my background would lean towards the first option but instead, I side with Sir. W. R. Hamilton, known to be one of the first (if not the first) using that second notation while describing the quaternion.

Hamiltonian

Since I entered the domain of Quantum Computing this term has haunted me. Hamiltonians here and there. Hamiltonians everywhere. But it seems I am not the only one puzzled by this term, even the people from IBM had to do a video about it for people like me.

Knowing that it is related to the dynamics of a system and that in quantum mechanics a quantum state is represented by a vector, no matter the shape it takes I can only conceive it as a matrix in my head.

$$H|\psi\rangle = \begin{bmatrix} h_{11} & h_{12}\\ h_{21} & h_{22} \end{bmatrix}\begin{bmatrix} a \\ b \end{bmatrix}$$

My mind relaxed when I could do this translation inside my brain. It might be it is not so relaxing for people coming from physics and preferring other mental objects but for me, the matrix is the mental object I can deal with.

Hamiltonians are required to process their eigenvalues and eigenvectors so that the ground state of the system they describe can be found. This is also a term that was not natural to me. The ground state of a matrix? Well, the ground state of a quantum-mechanical system described by its dynamics, makes more sense. But, once again in my head, it is nothing more than the eigenstate associated with the minimum eigenvalue of the matrix. It reveals the lowest energy of the system, the stationary state.

It took me a while to automate this translation in my head, surrounded by physicists at some point I found the shortcut in my mental map. Thank good the human brain likes to simplify things.

Back to the Hamiltonian and its ground state, this is the task we want to achieve when presented with a "problem". Know its ground state, its lowest energy value; its "solution" somehow. And computing the spectrum of a matrix can be costly, computationally. This is one of the challenges Quantum Computers are meant to solve.

QUBO

Quadratic Unconstrained Binary Optimization problems or QUBO problems are also quite often seen in the domain of Quantum Computing. Given that these new devices can only work with specific shapes or sets of operations for a given problem, this is the one common mapping on optimization problems we will need to get familiar with.

$$x^TQx = \sum_{i=1}^n \sum_{j=i}^n Q_{i,j}x_ix_j$$

Any problem to be solved on a quantum computer needs to find its QUBO form by rearranging the constraints and finding a definition or mapping where a binary vector represents the potential solution to the problem. If x is a binary vector, then Q has to be... well, a matrix.

$$x^TQx = \begin{bmatrix} x_1 & x_2 \end{bmatrix} \begin{bmatrix} q_{11} & q_{12}\\ q_{21} & q_{22} \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}$$

I will not enter into details on how it is done as it is problem-specific and there is plenty of literature around it. But the good thing is that once the QUBO shape is found the translation to a Hamiltonian gets simplified. Then, it is a matter of finding the ground state of the Hamiltonian which is equivalent to finding the solution that minimizes the QUBO problem.

$$\min x^TQx \iff \langle \lambda_g|H|\lambda_g\rangle$$

Ising model

The Ising model is the key to this transition from an optimization problem to a Hamiltonian and solving its ground state. The Ising model is a mathematical model of ferromagnetism in statistical mechanics. Each magnetic dipole moment of atomic "spins" in the lattice is represented by a discrete variable that can be in one of two states (+1 or −1). Its Hamiltonian function is described as follows.

$$H(\sigma) = \sum_{i

For the particular case of a square lattice and by making the mapping between +1 and -1 to 0 and 1 values we can easily see that the representation between the QUBO problem and the Ising model is quite straightforward.

$$\begin{bmatrix} q_{11} & q_{12}\\ q_{21} & q_{22} \end{bmatrix} \iff \begin{bmatrix} \mu h_{1} & J_{12}\\ J_{21} & \mu h_{2} \end{bmatrix}$$

This is how we can convert an optimization problem into a QUBO formulation, then build its Ising representation by making the appropriate mapping between Q and h and J values; and finally solve the ground-state of the Ising Hamiltonian. Then it is just a matter of make the way back to the binary representation of the problem being solved and voilà.

From here

If you are interested enough in this process then you can probably try some of the examples using PyQUBO.

0
Subscribe to my newsletter

Read articles from Iraitz Montalban directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Iraitz Montalban
Iraitz Montalban

Interested mostly into non-mainstream computing paradigms.