common.title
Cloud support

Nobisuke

Dekisugi

RAG


autoQAOA
RAG for dev
Fortune telling app
Annealing
DEEPSCORE
Translation

Overview
Service overview
Terms of service

Privacy policy

Contact
Research

Sign in
Sign up
common.title

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

Yuichiro Minato

2021/10/06 01:57

#QAOA

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)
1.25*I - 0.75*Z[0] - 0.75*Z[1] + 0.25*Z[0]*Z[1]

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))
(((0, 0), 0.8798531143252394), ((1, 0), 0.055608069152822334), ((0, 1), 0.05560806915282233), ((1, 1), 0.008930747369115135))

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

result.circuit
Circuit(2).h[:].cx[0, 1].rz(-11.210193556301645)[1].cx[0, 1].rz(33.63058066890493)[0].rz(33.63058066890493)[1].rx(9.311417774397983)[:].cx[0, 1].rz(-10.563031499027225)[1].cx[0, 1].rz(31.689094497081676)[0].rz(31.689094497081676)[1].rx(1.595426458189565)[:]

blueqat cloud can put this circuit directly to IonQ machine and etc. Let's enjoy QAOA!

© 2024, blueqat Inc. All rights reserved