common.title

A quick tutorial on the new blueqat

Yuichiro Minato 21 days ago

If you like new things, you are invited to experience a new world with the new blueqat. Many qubits can now be calculated. In return, there is a limit in the depth. It's a bit like the actual device. First of all, we need to update and add the necessary libraries.

pip install --no-deps -U git+https://github.com/jcmgray/quimb.git@develop autoray blueqat
Collecting git+https://github.com/jcmgray/quimb.git@develop

  Cloning https://github.com/jcmgray/quimb.git (to revision develop) to /tmp/pip-req-build-y58jowxa

  Running command git clone -q https://github.com/jcmgray/quimb.git /tmp/pip-req-build-y58jowxa

Requirement already satisfied: autoray in /opt/conda/lib/python3.8/site-packages (0.3.1)

Requirement already satisfied: blueqat in /opt/conda/lib/python3.8/site-packages (0.6.0)

Collecting blueqat

  Downloading blueqat-1.0.0-py3-none-any.whl (79 kB)

     |████████████████████████████████| 79 kB 678 kB/s eta 0:00:010:01

[?25hInstalling collected packages: blueqat

  Attempting uninstall: blueqat

First, let's look at the basic usage. There are no major differences from before, but the usage is a little different. Now we specify the backend, but it will be the standard simulator in the future. Let's make a superposition of 80 qubits. if it doesn't work with jupyternotebook or others, try restarting the kernel after the installation is finished.

from blueqat import Circuit N=80 Circuit(N).h[:].run(backend="quimb")
Counter({'10001011100101111000011111111101010100001011111010111000001001001001111011110010': 1})

What do you think? 80 qubits were computed only once. Since it is a superposition, the qubits are scattered. Next, let's try to create entanglement.

circ = Circuit(80).h[0] for i in range(N-1): circ.cx[i, i+1] circ.run(backend="quimb")
Counter({'00000000000000000000000000000000000000000000000000000000000000000000000000000000': 1})

In the case of entanglement, it is difficult to understand if it is calculated only once, so let's repeat the calculation.

circ = Circuit(80).h[0] for i in range(N-1): circ.cx[i, i+1] circ.run(backend="quimb", shots=100)
Counter({'11111111111111111111111111111111111111111111111111111111111111111111111111111111': 52,

         '00000000000000000000000000000000000000000000000000000000000000000000000000000000': 48})

The sample was taken in this way. This is much closer to the actual machine. Since the current computer cannot store a large quantum state, instead of getting a full state vector, we can get a single state amplitude.

import numpy as np amplitude = ''.join([str(np.random.choice([0,1])) for _ in range(N)]) print(amplitude) Circuit(N).h[:].run(backend="quimb", amplitude = amplitude)
01101000110100001111010000101001101101001010010010110100101100110100110111100110
(9.094947017729225e-13+0j)

Taking samples with many qubits also shows the difficulty of the superposition process.

Circuit(100).h[:].run(backend="quimb",shots=100)
Counter({'1110000100001000101010010000101001000010000110110011000111000010111001111000100100111100111010000001': 1,

         '1100000001001000001010001101101110110001110010111100110001111011100110000011011011001100000110111111': 1,

         '1010000110101110001011100010000000010011010010011011001111111101010101111110110101011000100000110100': 1,

         '1110011000110011000100100001011101000100100010100001011001110011010010111100101110011001111001001101': 1,

         '0000100101001101100000100010010110100000100111011110101111110100011000001000010001100110111111000111': 1,

         '1010111010000010000100100110111000110111001011010101110100000011010110000010001001100011101100100011': 1,

         '1001111000010110011011011100001000011000010011100011111001111001100101101010010000010011100101100111': 1,

         '0000000100100011111000011111110011000000010001111100100111101011111010100101011100000000001011000000': 1,

         '1000110101001001100110000010100000000000001010111011010100111000000001010010000010110001100110001011': 1,

         '0111100111101100101100111011011001000001100010000000111001110111111100001111111100111011001100010000': 1,

         '1000001110010011111011100010010100001111111011001100110001110101001000110010100100000001001110001110': 1,

         '1011001100010101101110101111011110001010111100100110111011001101011111010100100001001011100000010110': 1,

         '0001100001110001011011111100111101010000110001110011010001010000000000011010011010011111000001111101': 1,

         '1010001110010001000000011101000000001100000011000101010001001101001010100111110101000110111010100010': 1,

         '1110000110011000111100000010101000101000101000001010111110000001000000100010001010000011010000001011': 1,

         '1011100100100000001010101010010111101110111110101000101010001000000110110010101011010000000100101101': 1,

         '1110100111101000101001010001000111000100010110100111100101010111000110001011111000111100001001110010': 1,

         '0110010110000001010000010101010101011011011101010101101101101001101111100101000001000010101001101110': 1,

         '0100110111011011010100011010111111110110100010001111110011010101010000110101100000101000111001111011': 1,

         '0100000000001010101101110110011110100111100001101000001000010111001010101011100100100000000010011111': 1,

         '1000010001111011001101100110111100011110011000101110011100100010111110011011001011111111100110101111': 1,

         '0110010101100000001100110111101100110100010110101000011010011000101010111011000010011100011011111101': 1,

         '0100101011110001011110001110011101111001010000011100010011101001000110010110011101010010001001001101': 1,

         '0011011000100011100011001100111011100100101000010100110000100111101101010110110000010000100011111111': 1,

         '1100000011100111110000101101001111100100101011101101110110001111110001101101111111100101001001110111': 1,

         '0111010010101000100111101010101100110100110110101100101101011101111000101010011000100010110010111110': 1,

         '1100011100110011111111111000111010110100000110101100100101011110001101110011001111000001111000010111': 1,

         '1010000110001001000101101000000111011001101111010010010001101010100101000000110001110011111101101111': 1,

         '0101100101100011001001101010001010111110110010001010100111110011001000101110100011100100001101100010': 1,

         '1101100110111100010001000111011110010110110000100010111110001011100100110010000010111111101111010001': 1,

         '0010111011101110001110011010000101011010101101110011111001100111011111001111111111100101100001001100': 1,

         '0010010001110101110000000101001010101100010010111011100001000100100110001010011000110000100011000010': 1,

         '0011011111000101110000101110101100000110001000101110001101110001110110010011001111001000100000100101': 1,

         '1001101001000010100110001010101100001100001001010111111001011100101100010110100000111110110010111001': 1,

         '0100110101010101111010010000000111001101011110000011000101100101111100010001100000101010110110101010': 1,

         '0111100111010110001010111101011011101110111111101101010111101100010011110100111100110011101110111001': 1,

         '1000101100000010001100001100100111000110011110000101000001011100100110010101000100000001100110011000': 1,

         '1001000110100010001001010001010111010100010100010101100011000111111011110011101010111000111010101001': 1,

         '0001100010011010110010101101100001011111010000001011100111011100010010011010111001001011101110011001': 1,

         '1001100000001000000000001101100111101111111101000011011011110011000110010101101101110001111011110010': 1,

         '1111100110100011011010000001001001000101011011111110001110001011110100101101101100101010111010010110': 1,

         '0010100000101100011110111101111111111000110000101110110100111101111001100000110011000111100010100010': 1,

         '0000110101101010010101001001000001000111011111010110000010101001011111111000011001110011101100100010': 1,

         '0110100010010101010100000011010111100001000001001111101111001000011010101000110111100100010111111000': 1,

         '1001000100000100000001111101111010010000111100110010111100001010100000000111110011110100011101101100': 1,

         '0011111010010011110011011110110110011100110001101100001001111011001100010111010010001100010100101011': 1,

         '0110101101011111010000111111010110110101110011011101101011001010001000010010010011011001111111101110': 1,

         '1001111100100100000111101111000110000011010100111010010100010110011110011011100000001000001011010010': 1,

         '0100011110010101101000111100101010011010111101100010111101001000000111110010101010011010010110010101': 1,

         '0100010011111010101110101101000101110111100111100111000110011100101011010100010010000000000100110011': 1,

         '1101111100100001000100001011111100110111111000001110000000000101011100110001001100000100110010000101': 1,

         '0000010110001000111001000011010000111111111101010000101011101000011011000010011100100110110011000101': 1,

         '1001111001000001111100110110001110010101000000000100000101011110001011000001010010001001100000010101': 1,

         '0001001001111010011001100111110111111101101001000100010110010000000100110110100110101101101100110010': 1,

         '0101101011000101111001111111011001011100111100000001101111110110100100110010110000010011111010111010': 1,

         '1000110011101110000001100001001001100111110101001100000011011110010111001110011010000101111100111111': 1,

         '1111001110000011100101110011101000110110100001100101101110010110001000101000110101110110011010000110': 1,

         '1010000011010110011000111110100011000000000010101101011101010110100010100100110101110010011111110100': 1,

         '1000001100000101111010010101110000101011110001100101010110011100011011010000010110001010110100011010': 1,

         '0000010010110111011001110010001100111011111100001001011001110011111001010101111010010010010001110101': 1,

         '0110100010001111110011110101000101011101111111001010010000010001011110001101001011101100001110100110': 1,

         '0101111011001001000110001010001011111000110111110101010001000010001110001110101111010110111111110001': 1,

         '0101111001110111000010101011001101100011000011001000110111110001011111111110011101110001010000111101': 1,

         '0111101101111000110100001100100101111001110010100010011100101000010001001111011000001011001000101011': 1,

         '1110101100100010000110010101101010101000000111100001110101101111001110101101001100011110110100100000': 1,

         '0010100000011101010000111101010101110111011101001100111110010010100100011101011111111000101110001100': 1,

         '0111011101101110111011011011110100111001101111100110001010111110000010000110001010000101101110000100': 1,

         '0001111011011100100001000001110011111011111111100110101111111100011011100101010001011101001001111111': 1,

         '0010010110110110011100100110111111010010000101010001011011010011100111101001110000000100111101100010': 1,

         '1000101111110101100011110000111010111000101001011111001111001001010010010010001010010011011001001101': 1,

         '0011010000010011011101111100010110100000100110111000010101111001110101010001000011100000100001010011': 1,

         '1000011100110010010000000100111010100000011000101101011101010011101111000011001010000111011110010110': 1,

         '1101110101001011010001010001111011011001100100001001100010101111101110000111110010010011011100111001': 1,

         '1000011010010001011111100100000110000011000101101000010111001100011010001110101000111011110011100101': 1,

         '0101101100110011010010110001010100111010111010010011111011100101010010000000010000100101000011010000': 1,

         '0110111101000110000101110001001100011101101100100111111001111001001000101001101110111011011100110111': 1,

         '0001001100011010101110111011000011011100100001110010000111001100110111100110111011011000111111001010': 1,

         '0100101111000111011000110000110011110110100000101110011000010111001110111100101110100111001111100010': 1,

         '1001110011000001111100001101101111010101001010010001011100100000101000110111010010011011110000011111': 1,

         '1000100100001000000011101001110111101001111011010001011100111110111110111001110101110000011100011010': 1,

         '0111010001101011101111010011110100111011110101110011011101000110111111010010100111100011110000010001': 1,

         '0000000111000100000000100101010100110000011010011110100101011011101111001000100110001000101110001000': 1,

         '1000110100101111101100100110101111001000101110011111010111111101111111111011011000100011110011010001': 1,

         '0010100101010011111101000001010001001100111000100100100101010101011011001111001111011101000101010101': 1,

         '1111111100000010001101111110010001100110010111110001010101110001101101101011110100101000100011011000': 1,

         '0001011100110111110000011110101000111110110001111110100111010100001101100000010110100010001110111000': 1,

         '0101111001111001111100001010000011101101111111101010000110010111010010111100000101000001010110001101': 1,

         '1101011110010100011111111011001101110001100100010010001100110111001010000110010001001010110000000011': 1,

         '1111110001100100011101001011101110111100101010100100010110011110101101101011101011000001000001111000': 1,

         '1110001111110011110001111101111110011110000100011111000110110111011111010001000111110100100110011011': 1,

         '1100001100111001110110111100101101011100100000111101110101011000111101111111001010011011100111100110': 1,

         '0001010101010001010101110000100101100001001110100011100101111110111011101110000011001000010011110110': 1,

         '1110001011010000011001001111101100010011001101011010100101001111011110001100111010011111111011011100': 1,

         '0111010011001011100000001111100111100011111000101011100100110000110011100100110000010100000110000010': 1,

         '1110110110000110100110111001100011111100010110110111110011011111001010111110000000000010100010111110': 1,

         '0000000010010011010101001011110010110000100100001010011010100011101111001011111101001111011101000000': 1,

         '0001110100101110110000101101011111100011001001111011010010101001100001010011110011110001001101100011': 1,

         '1111101000011100111111000111100010100101001100100110111111010111011010011001000110011110011101100001': 1,

         '1101100100011111101100101110011000111101011000011111111010001100000010101110101110111001010100100010': 1,

         '0001000011100100010110001000010010001010000100000010110000000101101010100001000010100000100111100100': 1})

We still need to add and modify the code in various ways. Please try it out. That's all.

Yuichiro Minato

@yuichiro_minato2

blueqat CEO/CTO

About us ©2022 Copyright © 2022 blueqat Inc. All rights reserved