common.title

Docs
Quantum Circuit
TYTAN CLOUD

QUANTUM GAMING


Overview
Terms of service

Privacy policy

Contact
Research

Sign in
Sign up
common.title

blueqat Spring 2023 Internship (1/5): Internship Overview and Fundamentals of Quantum Circuits.

Yuichiro Minato

2023/03/30 15:05

Many quantum technology engineers are struggling with the fact that quantum computers, which are referred to as NISQ and have errors, are not very practical to use, and it may take another 20 years for the error-correcting model called FTQC to be developed. blueqat is coping with this situation by not hiring too many people, but recently, engineers who excel in various scenes have emerged by leveraging the high compatibility with machine learning.

We are focusing on successful cases like these and developing quantum computing technologies with high affinity for machine learning, integrating them with rapidly developing GPU technologies to make quantum computers more accessible. In this opportunity, we will conduct an internship on quantum computing and machine learning for business applications.

Lecture Contents

  1. "Overview of the internship and fundamentals of quantum circuits" (This lecture)
  2. "Tensor networks, quantum computing, and deep learning"
  3. "Parameterized quantum circuits, quantum machine learning, SGD, and classical optimization"
  4. "QR decomposition, singular value decomposition, and low-rank approximation"
  5. "Quantum reinforcement learning using quantum machine learning in OpenAI Gym"

Environment:

We will use Google Colab.

First Lecture: Fundamentals of Quantum Circuits

Quantum computers use dedicated computing elements called quantum bits (qubits) which are different from conventional computers. In conventional computers, calculations are performed using bits, which are either 0 or 1, but in quantum computers, qubits have a special way of holding data.

Quantum Data of a Single Qubit

The Bloch sphere is often used to represent the state of a single qubit's quantum data. Basically, the data starts at the 0 state located at the North Pole and moves along the surface of a sphere with a radius of 1 through rotation operations centered around the sphere's center.

https://ja.wikipedia.org/wiki/ブロッホ球

Quantum Gates

In quantum computing, the quantum data state is referred to as the quantum state, and quantum gates are used to manipulate the quantum data and state. A quantum circuit is like a musical score that describes these quantum operations. In quantum computer programming, we write these quantum circuits.

pip install blueqat

If you install the tool and write as follows:

from blueqat import Circuit
Circuit().h[0].cx[0,1].x[2].run(backend="draw")

This is a quantum circuit. The leftmost represents a quantum bit (qubit), which starts in the state of 0. The symbols H and X represent quantum operations, which correspond to rotations on the sphere. The gate with a line extending upwards from X is called a two-qubit gate. When the quantum bit q0 is in the state of 1, it performs an X operation on the q1 quantum bit.

Operations such as X, Y, and Z are called fixed rotation gates, and each represents a 180-degree rotation around the x, y, or z-axis.

H is a special gate that performs a 180-degree rotation around an axis that is 45 degrees between the X and Z axes. This is a useful gate that can move data on the Z-axis to the XY plane. When it is operated again, data on the XY plane can be returned to the Z-axis.

Although not yet mentioned, RX, RY, RZ, etc. can be rotated around the x, y, or z-axis at any angle specified.

If the symbol has a C at the beginning, such as CX, it is generally called a two-qubit gate. When the value of the qubit on the control gate side is 0, it does not do anything, but when it is 1, it performs the specified operation. For example, CX performs an X gate operation, and CZ performs a Z gate operation.

In this way, arranging quantum gates is equivalent to programming a quantum computer.

Quantum State

By utilizing the operations of a quantum computer, we can perform calculations that differ from those of conventional computers. A quantum state represents the current state of the data that has been manipulated. The quantum state is also called a wave function and is usually represented in the form of a vector in programming. This vector has 2^N elements for N quantum bits, and the maximum size that can be computed while storing these quantum states on the current computer is said to be around 50 quantum bits. In a quantum computer, a different answer is obtained probabilistically every time a calculation is performed, and the data underlying this probability is stored in the quantum state.

|psi> = [|000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>]

Quantum states are represented in vector form, and they contain values called probability amplitudes that correspond to the bit sequence of the quantum bit's computation result. These probability amplitudes are complex numbers, and their absolute values squared correspond to the probabilities of their occurrence. In the case of three quantum bits, the vector form represents the probability amplitudes for all possible bit sequences. For example, in the case of two quantum bits, the state vector contains probability amplitudes for bit sequences from 00 to 11.

(例)|psi> = [|00>, |01>, |10>, |11>] = [0.5, 0.5, 0.5, 0.5]

For example, if all probability amplitudes are 0.5, then the probability of each bit array corresponds to the square of its absolute value, |0.5|*|0.5| = 0.25.

c = Circuit().h[0,1]
c.run(backend="numpy")

array([0.5+0.j, 0.5+0.j, 0.5+0.j, 0.5+0.j])

If we perform a calculation to extract an array of 01 by sampling in this state,

c.m[:].run(backend="numpy", shots=100)

Counter({'11': 24, '01': 23, '00': 23, '10': 30})

When measured, the results are distributed approximately equally between 00 and 11.

Quantum Superposition and Entanglement

Quantum superposition and entanglement are characteristic features of quantum computers.

Circuit().h[0,1].m[:].run(backend="numpy",shots=100)

Counter({'00': 23, '01': 26, '11': 25, '10': 26})

Thus, in superposition, since two states are superimposed, multiple calculation results are obtained. If we prepare a quantum circuit like the following:

Circuit().h[0].cx[0,1].m[:].run(backend="numpy",shots=100)

Counter({'11': 53, '00': 47})

Thus, solutions can be obtained in a form limited to a specific quantum state. This is called quantum entanglement. Quantum entangled states can no longer be represented by quantum data on the Bloch sphere.

Quantum Gates and Rotation Operations

Quantum gates correspond to rotation operations, and the position of data is limited to the surface of a sphere with a radius of 1. Quantum gates can be mathematically represented by matrices, and they are unitary matrices."

https://en.wikipedia.org/wiki/Quantum_logic

Quantum Computing and Tensors

Up to this point, we have been discussing things in general, but from here on, we will use tensors to consider quantum computing for the future. Tensors refer to a collection of scalar quantities, vectors, matrices, and tensors. In quantum computing, quantum gates are limited to unitary matrices, but using tensors, we can break down quantum circuits into even finer components. Additionally, since quantum states may contain a lot of unnecessary information, we can efficiently perform calculations by approximating state vectors or wave functions.

In this internship course, all quantum computing will be treated as tensors from now on, and we will work to unify them with existing tensors used in deep learning, etc. This will continue in the second lecture.

© 2025, blueqat Inc. All rights reserved