Skip to content

yangguohao/quantum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Studio-Quantum Circuit Synthesis

Project Description

This challenge is adapted from the final-round problem of the "2020 Baidu Star Programming Contest" to provide more developers with opportunities to learn and exchange ideas in quantum computing. Since 2017, Baidu has hosted the Baidu Star Developer Contest, a global deep-learning competition for AI enthusiasts. The contest aims to provide top developer teams—creative, highly professional, geek-minded, and collaborative—with a stage to communicate, compete, and showcase their skills. It also provides contestants with real datasets, the PaddlePaddle deep-learning platform, complete technical solutions, and the one-stop AI development platform AI Studio, lowering the barrier to AI learning for developers. Join the 2021 Baidu Star Developer Contest!

A highly advanced Planet A is about to lose its civilization due to a sudden anomaly. The people of Planet A encrypted critical information and sent it to the less developed Planet C, which faces the same anomaly, hoping to help Planet C survive. Planet A has already achieved quantum computing and therefore used a quantum circuit to encrypt the information. After receiving it, Planet C felt powerless because their civilization can only implement small basic quantum gates, which are insufficient to decrypt this critical information. They then remembered us on the friendly Planet B, who might offer a chance of survival. Can we help Planet C overcome this crisis?

Scientists have determined that the mysterious information is an image encrypted by a quantum circuit. We may decrypt it using the given 2-qubit and 3-qubit circuits. To avoid leaving Planet C defenseless, we must decompose the quantum circuits into basic quantum gates that Planet C can implement, thereby helping Planet C decrypt the message and complete this epic rescue mission. Detailed challenge information is available here.

Qubit Notation

Qubits are usually represented using Dirac notation (also called bra-ket notation). A bra is a row vector, denoted by <|, and a ket is a column vector, denoted by |>, as shown below.

image

In quantum mechanics, qubits are expressed through quantum states, which require two continuous variables to encode all information. These two quantities satisfy a constraint:

$|φ&gt; = a|0&gt;+b|1&gt;$, where $a$ and $b$ are complex numbers and satisfy $|a|^2+|b|^2=1$.

The above expression can also be written as $|φ&gt; = cos\frac{θ}2|0&gt;+e^{iθ}sin\frac{φ}2|1&gt;$ (related to density matrices and their decomposition). Here, $θ∈[0,Π]$ and $φ∈[0,2Π]$, so a state can be represented as a point in three-dimensional space. This is the Bloch sphere shown below: unlike classical bits, which only take values 0 and 1 at two endpoints, a qubit can take any point on the sphere surface.

image

Quantum Gates

A quantum gate must be a unitary matrix. Quantum gates must be physically realizable, so they must obey the laws of quantum physics. These laws imply that information is not lost when transforming between points in time, which is called unitarity. Since quantum gates define state transformations, they must satisfy unitarity.

The $Ry(θ)$ gate in this problem is one such quantum gate. It changes the qubit state by rotating by angle $θ$ around the y-axis.

The CNOT gate works similarly. It acts on two qubits, with one control qubit and one target qubit, changing the qubit state as shown below.

image

image

In |00> and |01>, the former qubit is the target state and the latter is the control state. As shown, CNOT does not modify the value of "00" because the control state is 0. When the control state equals 1, it flips the target state from |01> to |11>, so it is also called a controlled-NOT gate, analogous to the computer "NOT" operation.

The following tasks use these two gates to transform qubit states into the required states.

References: https://zhuanlan.zhihu.com/p/94015026

https://zhuanlan.zhihu.com/p/80455104

Project Structure

-|data
-|work
-README.MD
-xxx.ipynb

Usage

A: Run this project on AI Studio B: The project author can add additional usage instructions here.

About

No description, website, or topics provided.

Resources

License

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors