[PYTHON] Get started with blueqat cloud, a ready-to-use quantum computer simulator online

: partly_sunny: Introduction

As the development of quantum computers, which are the dreams of humankind, is accelerating all over the world, ** quantum computer simulators ** occupy an important position alongside actual quantum computers, such as performing preliminary calculations. ** blueqat ** is one of the world's most popular quantum computer simulators as open source software that uses the Python language. Developed and released by blueqat Co., Ltd. (Tokyo) in Japan.

■ blueqat --Open source quantum computing platform  https://blueqat.com/?hl=ja

Originally provided as PYPI (Python language library), blueqat was installed and used in the local PC environment using the pip install command, but in August 2020 ** blueqat cloud ** (Bluecat cloud) Cloud) has been released as a cloud service and is now available online.

Of course, you can also install and use it in your local environment with pip install from the PYPI library.

** blueqat cloud is all free and anyone can use it immediately! **

: partly_sunny: Purpose of this article

To use blueqat cloud, you need to register for an account on the blueqat cloud system. In this article, I would like to introduce the procedure from registering an account to the blueqat cloud system, building a simple gate circuit, and actually running the simulator.

Also, I would like to briefly describe the difference from the service provided by the paid contract as blueqat pro.

: partly_sunny: Account registration procedure

① First, access the following with a browser. https://blueqat.com/?hl=ja

② Click the registration button. image.png

③ Enter your e-mail address and password, check the "Terms of Service", and click the account registration button. image.png

④ Enter the confirmation code sent to the registered email address. image.png

This completes account registration.

: partly_sunny: Log in to the cloud service

For the second and subsequent logins, please log in with your registered email address and password. image.png

The first screen after login is as follows. image.png

To start programming, click on the menu "blue qat" below the notebook list. image.png

You can also change your password by clicking ** Settings ** in the upper right corner.

: partly_sunny: How to use blueqat cloud

** ① Create a notebook **

Click the menu "blue qat" below the notebook list. image.png

A project named "blueqat" has been created as shown below. Click the button "Open Notebook" in the upper right corner. image.png

The status will be displayed as shown below, so wait for a while. image.png

When the notebook screen is displayed, you are ready to go. The notebook screen is provided by Jupyter Lab. (Container starts for each notebook) image.png

: point_up: ** Supplementary information ** -You can only create one notebook. -The notebook name cannot be changed.

** ② Create a program **

Click below to create a Jupyter Notebook page. image.png

The Jupyter Notebook page will be created as shown below. Rename the file if necessary. image.png

After that, it is the same as how to use Jupyter Notebook normally.

As a test, I tried to display the Python version. The current Python version is 3.8.4. image.png

** ③ Exit the notebook **

Click "Log Out" from the menu "File" of Jupyter Notebook. image.png

: partly_sunny: Gate circuit creation and simulator operation check

Now that we are ready for quantum programming, let's create and execute a simple gate circuit.

** ① Write a program (gate circuit) with blueqat **

Here, I write a program that prepares one qubit initialized with ** | 0> ** (Ket vector 0), applies the Hadamard transform (H gate), and then measures it. I will try.

Please refer to the official document for the grammar of the program.

■ blueqat official document  https://blueqat.readthedocs.io/ja/latest/

myFirstApp.ipynb


#=====================================
#A program that calculates the gate circuit with blueqat
#=====================================
from blueqat import Circuit

shots_num = 100                    #Set the number of calculations(100 times)

c = Circuit(1)                     #Create 1qbits
c.h[0]                             #Acting Hadamard Gate
res = c.m[0].run(shots=shots_num)  #Perform circuit measurements

print(res)                         #Display calculation result

The schematic I want to execute is below. image.png

Also, add the following program to display the execution result as a graph.

myFirstApp.ipynb


#Display the result calculated above as a graph
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
x = ['0','1']
y = [res['0'] / shots_num, res['1'] / shots_num]  #Store calculation results

ax.bar(x, y)                                      #Display as a bar graph
plt.show()                                        #Draw graph

** ② Execute with Jupyter Notebook (operation check) **

Enter the above program in a cell of Jupyter Notebook and execute it. In the figure below, the execution result is displayed with a red frame. image.png image.png It was obtained from the simulator calculation results that the qubit becomes a superposition of 0 and 1 by applying the H gate, and the probability is about 50%: 50%.

This is the end of the operation check.

: partly_sunny: About paid version blueqat cloud

So far, we have introduced the functions that can be used for free with blueqat cloud, but as a higher-level service, a paid blueqat cloud version is available. This service was previously provided under the name ** blueq at pro **. The following additional services are available here, and the system is such that more effective quantum computing solutions can be utilized in business.

For the latest service content, please obtain the latest information from the company's website.

: partly_sunny: Related information

■ Free quantum computing cloud environment, blueqat cloud https://qiita.com/YuichiroMinato/items/3e82c3d44526e0d462f4

■ blueqat official document https://blueqat.readthedocs.io/ja/latest/

■ Simulate a quantum computer with Raspberry PI (blueqat environment construction) https://qiita.com/ttlabo/items/ac098d3ea7cb36013c86

■ Simulate a quantum computer with Raspberry PI (IBM Qiskit environment construction) https://qiita.com/ttlabo/items/64f06b7cdf3a44971c77

: partly_sunny: Opinions etc.

If you have any opinions or corrections, please let us know.

Recommended Posts

Get started with blueqat cloud, a ready-to-use quantum computer simulator online
A layman wants to get started with Python
[Cloud102] # 1 Get Started with Python (Part 1 Python First Steps)
Get started with MicroPython
Get started with Mezzanine
I want to run a quantum computer with Python
I tried to get started with Hy ・ Define a class
Get started with influxDB + Grafana
Get started with Django! ~ Tutorial ④ ~
Get started with Django! ~ Tutorial ⑥ ~
Get started with Python! ~ ② Grammar ~
[Python] A memo that I tried to get started with asyncio
I wrote a script to get you started with AtCoder fast!
Here's a brief summary of how to get started with Django
Get started with Python! ~ ① Environment construction ~
Link to get started with python
Get started with MicroPython (on macOS)
How to get started with Scrapy
How to get started with Python
How to get started with Django
Get started with machine learning with SageMaker
Get started with Python in Blender
[Cloud102] # 1 Let's get started with Python (Part 2 Jupyter Notebook Construction AWS Edition)