published on in Quantum computing

量子电路设计入门・示例四

本示例是介绍量子电路的基本形式和操作规则的第四个示例,在这个示例中我们将看到一个由三个量子位构成的量子电路。

This is the fourth example which introduces the basic form and operation rules of quantum circuits. In this example, we will see a quantum circuit consisting of three qubits.

示例四、操作由三个量子位元组成的电路

Example 4. Manipulating a Three-Qubit Circuit

在这个量子电路中,我们一共创建了三个量子位元,它们分别是 q0 q1 和 q2。随后,我们将它们分别进行初始化,将 q0 初始化为 0,将 q1 初始化为 1,将 q2 初始化为 0。

In this quantum circuit, we created three qubits, which are q0, q1, and q2. Then, we initialized them to 0, 1, and 0, respectively.

接下来我们使用泡利 X 门对 q0 和 q2 分别进行反转。最后我们再测量这三个量子位元并将测量结果保存到经典位元 C 中。

Next, we applied Pauli-X gates to q0 and q2 to flip them. Finally, we measured these three qubits and stored the measurement results in classical bits C.

需要注意的是:我们 q0 的测量结果保存到了经典位元 c0 中;q1 的测量结果保存到了经典位元 c1 中;q2 的测量结果保存到了经典位元的 c2 中。

It is important to note that: the measurement result of q0 is stored in the classical bit c0; the measurement result of q1 is stored in the classical bit c1; the measurement result of q2 is stored in the classical bit c2.

经过对该量子电路的采样测量,我们将以 100% 的机率得到二进制数值 1 1 1。这是因为我们使用了泡利 X 门将该量子电路中所有的 0 量子位进行了反转。

By sampling the measurement of the quantum circuit, we will get the binary value 1 1 1 with 100% probability. This is because we use the Pauli X gate to flip all the 0 qubits in the quantum circuit.