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

Folded QCNN state on Quantum Machine Learning using the state vector specification feature of blueqat 0.4.1

Yuichiro Minato

2021/03/15 00:25

#quantum computer #quantum machine learning

1

Hello everyone, I know you all want to do quantum machine learning and be on the cutting edge of quantum computing. In this article, we'll check how to make quantum machine learning more efficient using a technique called mid-circuit measurement and qubit reuse & we'll try to reduce qubits using a new feature of blueqat.

Mid-circuit measurement and qubit reuse (MCMR)?

MCMR, for short, is a technique that involves taking a measurement of only a specific qubit in the middle of a circuit, and then resetting the circuit after the measurement of that qubit. By taking a measurement on a particular qubit and initializing it to 0\lvert 0\rangle, you can sample a more complex quantum state than the state vector alone for a number of qubits.

In this example, we will try to reduce a three-qubit circuit to two qubits. Let's look at the following structure.

|0> --*-----
      |
|0> --U--*--
         |
|0> -----U--

Let's look at the top qubit and the bottom qubit. The circuit will be the same only if the bottom qubit is initialized after the top qubit is measured. If we turn the bottom circuit upside down and rewrite it using MCMR, we can do the following

|0> --*--  U--
      |    |
|0> --U----*--

In mid-circuit measurement and qubit reuse (MCMR), the order of measurement and initialization of qubits is devised in such a way that complex calculations can be performed with fewer qubits. Currently, MCMR is implemented on Honeywell machines and on IBM machines.

Let's look at the state vector

To understand how it works, let's look at the transition of the state vector, and check out the circuit of two qubits.

|0> --H--*--
         |
|0> -----X--

This is a quantum entanglement circuit. The state vector is

from blueqat import Circuit Circuit().h[0].cx[0,1].run()
array([0.70710678+0.j, 0.        +0.j, 0.        +0.j, 0.70710678+0.j])

You can use rxx to write it in one step.

|0> ---*----
       |
|0> ---RXX--
from blueqat import Circuit import math Circuit().rxx(-math.pi/2)[0,1].run()
array([0.70710678+0.j        , 0.        +0.j        ,

       0.        +0.j        , 0.        +0.70710678j])

Thus, we have an entangled state of 00+112\frac{\lvert 00\rangle +\lvert 11\rangle}{\sqrt{2}}. If we measure only the 0th qubit in this state, we get

|0> ---*----測定
       |
|0> ---RXX---------

If q0=0q_0 = 0 is measured, then 00\lvert 00\rangle is determined and ψ=00\lvert \psi \rangle = \lvert 00\rangle. The state vector in that case is

import numpy as np vec00 = np.array([1, 0, 0, 0])

If q0=1q_0 = 1 is measured, then 11\lvert 11\rangle is confirmed and ψ=11\lvert \psi \rangle = \lvert 11\rangle.

vec11 = np.array([0, 0, 0, 1])

The result is 11\lvert 11 \rangle. Now, if we initialize the 0th qubit to 0\lvert 0\rangle, then 11\lvert 11\rangle becomes 01\lvert 01\rangle.

vec01 = np.array([0, 1, 0, 0])

In other words, the state vectors are initialized to different quantum states, with the state vectors diverging depending on the measured qubit.

|0> ---*---- |0>--
       |
|0> ---RXX--------

Finally, when we measure the above circuit again, the first time we get q0=0q_0 = 0, the second time we get 0000, so we get a sample of 000000.

Circuit(2).m[:].run(shots=100, initial=vec00)
Counter({'00': 100})

Also, the first time q0=1q_0 = 1, the second and subsequent measurements will give 0101, giving a sample of 101101. In blueqat, the value of the 0th qubit is on the right.

Circuit(2).m[:].run(shots=100, initial=vec01)
Counter({'10': 100})

The result of the first measurement changes the result for subsequent sampling, and by using entanglement many times, the state vector of the quantum state will diverge with each intermediate measurement and reset.

Applications to Quantum Machine Learning

To apply these to quantum machine learning, we can reuse these for convolution and other applications of quantum machine learning. For example, suppose we have a convolutional circuit such as QCNN for image recognition.

|0> --*--
      |
|0> --U--*--
         |
|0> --U--U----
      |  
|0> --*--

This means that the q0q_0 circuit is collapsed into q1q_1, q3q_3 is collapsed into q2q_2, and q1q_1 is collapsed into q2q_2 again. It is a four-qubit circuit, but using MCMR

|0>--U------------*--
     |            |
|0>--*--  |0>--U--U----
               |
|0>------------*--

Using the MPS circuit, the number o qubits can be further reduced. In this way, quantum machine learning can be efficiently used on Honeywell and IBM machines by efficiently using MCMR in quantum circuits that approximate quantum states, such as MPS and TTN/MERA.

© 2024, blueqat Inc. All rights reserved