# Convert Hamiltonian QUBO matrix of quantum annealing to Hamiltonian of quantum gate

## Convert Hamiltonian QUBO matrix of quantum annealing to Hamiltonian of quantum gate

Hi let's convert a Hamiltonian QUBO matrix from quantum annealing to quantum gate Hamiltonian. When you enter quantum gate model business from quantum annealing, you want to convert your previous software assets. blueqat has that conversion tool since 2018, which allows you to leverage your quantum annealing assets in quantum gates. Let's take a look at exactly how.

## Call pauli in the old wildqat module and convert QUBO to Pauli operations.

Basically, we revert to the Ising formulation, convert it to a form that can be read by quantum gate operators. First, let's load the tool.

import blueqat.wq as wq

And then make QUBO matrix

QUBO = [[1,1],[0,1]]

And put it into wq.pauli. It's quite easy.

hamiltonian = wq.pauli(QUBO)

Let's see how it converted.

print(hamiltonian)

It is done let's do calculation on gate model.

## Put the transformed Pauli matrix into QAOA.

Quantum gates have a small number of qubits, so we can't solve large problems yet. Since the above matrix is small, let's run it by determining the number of steps, a parameter to divide analog into digital. In this case, let's set step p=2.

step = 2

blueqat has a function to automatically calculate QAOA from time evolution and variational formulation. Let's just put step and hamiltonian into the function

from blueqat import vqe
result = vqe.Vqe(vqe.QaoaAnsatz(hamiltonian, step)).run()
print(result.most_common(12))

It's done. You can easily get the cirucit from,

result.circuit

blueqat cloud can put this circuit directly to IonQ machine and etc. Let's enjoy QAOA! ##### Yuichiro Minatoblueqat CEO/CTO 2015年総務省異能vation最終採択 2017年内閣府ImPACTプロジェクトPM補佐 2019年文科省さきがけ量子情報処理領域アドバイザー 