# US 2022/0284336 A1 · Processing method for quantum circuit, electronic device, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0284336 A1
- Document ID: US20220284336A1
- Status: Published application
- Kind: A1
- Application number: 17/752,036
- Filed: 2022-05-24
- Published: 2022-09-08
- Earliest claimed: 2021-07-14
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science Technology Co., Ltd.
- Inventors: Shusen Liu; Runyao Duan; Danxiang Wu; Shenjin Lv
- Web page: https://patentgrep.com/patent/US20220284336A1

## CPC

- G06N 10/20: Models of quantum computing, e.g. quantum circuits or universal quantum computers
- G06N 10/40: Physical realisations or architectures of quantum processors or components for manipulating qubits, e.g. qubit coupling or qubit control
- G06N 5/01: Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A processing method for a quantum circuit, an electronic device, and a storage medium are provided, and relates to the field of quantum computing, and in particular to the field of quantum circuit compilation. The method includes: acquiring a first measurement order of respective logical qubits in the quantum circuit; determining a physical qubit order corresponding to the first measurement order based on a target mapping relationship between the respective logical qubits and respective physical qubits in a chip coupling diagram, wherein the target mapping relationship is obtained by updating based on an initial mapping relationship between the respective logical qubits and the respective physical qubits; determining a second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship; and measuring the quantum circuit based on the second measurement order, to obtain a measurement result.

## Claims

### Claim 1

A processing method for a quantum circuit, comprising:
acquiring a first measurement order of respective logical qubits in the quantum circuit;
determining a physical qubit order corresponding to the first measurement order based on a target mapping relationship between the respective logical qubits and respective physical qubits in a chip coupling diagram, wherein the target mapping relationship is obtained by updating based on an initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship; and
measuring the quantum circuit based on the second measurement order, to obtain a measurement result.

### Claim 2 (depends on 1)

The method of claim 1, wherein the determining the second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship, comprises:
determining an inverse mapping relationship of the initial mapping relationship, wherein the inverse mapping relationship is a mapping relationship between the respective physical qubits and the respective logical qubits; and
mapping the physical qubit order based on the inverse mapping relationship, to obtain the second measurement order of the respective logical qubits.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
determining the initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a non-executable target quantum gate in the quantum circuit based on the initial mapping relationship and the chip coupling diagram;
inserting a swap gate into the quantum circuit based on the non-executable target quantum gate; and
updating the initial mapping relationship based on the swap gate, to obtain the target mapping relationship.

### Claim 4 (depends on 3)

The method of claim 3, wherein the determining the initial mapping relationship between the respective logical qubits and the respective physical qubits, comprises:
obtaining a simplified quantum circuit and a reverse circuit of the simplified quantum circuit, based on the target quantum gate in the quantum circuit;
performing N iteration processes based on the simplified quantum circuit and the reverse circuit, to obtain N mapping relationships, wherein N is an integer greater than or equal to 2; and
determining the initial mapping relationship in the N mapping relationships.

### Claim 5 (depends on 4)

The method of claim 4, wherein an i-th iteration process in the N iteration processes comprises:
in a case where i is a first type of numerical value, updating an (i−1)-th mapping relationship in the N mapping relationships based on the simplified quantum circuit and a preset search algorithm, to obtain an i-th mapping relationship in the N mapping relationships;
and/or
in a case where i is a second type of numerical value, updating the (i−1)-th mapping relationship based on the reverse circuit and the search algorithm, to obtain the i-th mapping relationship.

### Claim 6 (depends on 4)

The method of claim 4, wherein the determining the initial mapping relationship in the N mapping relationships, comprises:
determining a mapping relationship with a least cost in the N mapping relationships as the initial mapping relationship.

### Claim 7 (depends on 3)

The method of claim 3, wherein the determining the non-executable target quantum gate in the quantum circuit based on the initial mapping relationship and the chip coupling diagram, comprises:
determining M logical qubit pairs based on M target quantum gates in the quantum circuit, wherein M is a positive integer;
determining M physical qubit pairs, respectively corresponding to the M logical qubit pairs, in the chip coupling diagram based on the initial mapping relationship;
determining a non-adjacent physical qubit pair in the M physical qubit pairs, based on connectivity relationships between the respective physical qubits in the chip coupling diagram; and
determining the non-executable target quantum gate in the M target quantum gates, based on the non-adjacent physical qubit pair.

### Claim 8 (depends on 3)

The method of claim 3, wherein the inserting the swap gate into the quantum circuit based on the non-executable target quantum gate, comprises:
determining a first physical qubit, corresponding to a first logical qubit acted on by the non-executable target quantum gate, in the chip coupling diagram based on the initial mapping relationship;
determining K second physical qubits adjacent to the first physical qubit in the chip coupling diagram, wherein K is a positive integer;
determining K second logical qubits corresponding to the K second physical qubits based on the inverse mapping relationship of the initial mapping relationship;
obtaining K swap gates based on the K second logical qubits; and
inserting a swap gate with a least cost in the K swap gates into the quantum circuit.

### Claim 9

An electronic device, comprising:
at least one processor; and
a memory connected communicatively to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions, when executed by the at least one processor, enable the at least one processor to perform operations of:
acquiring a first measurement order of respective logical qubits in the quantum circuit;
determining a physical qubit order corresponding to the first measurement order based on a target mapping relationship between the respective logical qubits and respective physical qubits in a chip coupling diagram, wherein the target mapping relationship is obtained by updating based on an initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship; and
measuring the quantum circuit based on the second measurement order, to obtain a measurement result.

### Claim 10 (depends on 9)

The electronic device of claim 9, wherein the determining the second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship, comprises:
determining an inverse mapping relationship of the initial mapping relationship, wherein the inverse mapping relationship is a mapping relationship between the respective physical qubits and the respective logical qubits; and
mapping the physical qubit order based on the inverse mapping relationship, to obtain the second measurement order of the respective logical qubits.

### Claim 11 (depends on 9)

The electronic device of claim 9, wherein the instructions, when executed by the at least one processor, enable the at least one processor to further perform operations of:
determining the initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a non-executable target quantum gate in the quantum circuit based on the initial mapping relationship and the chip coupling diagram;
inserting a swap gate into the quantum circuit based on the non-executable target quantum gate; and
updating the initial mapping relationship based on the swap gate, to obtain the target mapping relationship.

### Claim 12 (depends on 11)

The electronic device of claim 11, wherein the determining the initial mapping relationship between the respective logical qubits and the respective physical qubits, comprises:
obtaining a simplified quantum circuit and a reverse circuit of the simplified quantum circuit, based on the target quantum gate in the quantum circuit;
performing N iteration processes based on the simplified quantum circuit and the reverse circuit, to obtain N mapping relationships, wherein N is an integer greater than or equal to 2; and
determining the initial mapping relationship in the N mapping relationships.

### Claim 13 (depends on 12)

The electronic device of claim 12, wherein an i-th iteration process in the N iteration processes comprises:
in a case where i is a first type of numerical value, updating an (i−1)-th mapping relationship in the N mapping relationships based on the simplified quantum circuit and a preset search algorithm, to obtain an i-th mapping relationship in the N mapping relationships;
and/or
in a case where i is a second type of numerical value, updating the (i−1)-th mapping relationship based on the reverse circuit and the search algorithm, to obtain the i-th mapping relationship.

### Claim 14 (depends on 12)

The electronic device of claim 12, wherein the determining the initial mapping relationship in the N mapping relationships, comprises:
determining a mapping relationship with a least cost in the N mapping relationships as the initial mapping relationship.

### Claim 15 (depends on 11)

The electronic device of claim 11, wherein the determining the non-executable target quantum gate in the quantum circuit based on the initial mapping relationship and the chip coupling diagram, comprises:
determining M logical qubit pairs based on M target quantum gates in the quantum circuit, wherein M is a positive integer;
determining M physical qubit pairs, respectively corresponding to the M logical qubit pairs, in the chip coupling diagram based on the initial mapping relationship;
determining a non-adjacent physical qubit pair in the M physical qubit pairs, based on connectivity relationships between the respective physical qubits in the chip coupling diagram; and
determining the non-executable target quantum gate in the M target quantum gates, based on the non-adjacent physical qubit pair.

### Claim 16 (depends on 11)

The electronic device of claim 11, wherein the inserting the swap gate into the quantum circuit based on the non-executable target quantum gate, comprises:
determining a first physical qubit, corresponding to a first logical qubit acted on by the non-executable target quantum gate, in the chip coupling diagram based on the initial mapping relationship;
determining K second physical qubits adjacent to the first physical qubit in the chip coupling diagram, wherein K is a positive integer;
determining K second logical qubits corresponding to the K second physical qubits based on the inverse mapping relationship of the initial mapping relationship;
obtaining K swap gates based on the K second logical qubits; and
inserting a swap gate with a least cost in the K swap gates into the quantum circuit.

### Claim 17

A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions, when executed by a computer, cause the computer to perform operations of:
acquiring a first measurement order of respective logical qubits in the quantum circuit;
determining a physical qubit order corresponding to the first measurement order based on a target mapping relationship between the respective logical qubits and respective physical qubits in a chip coupling diagram, wherein the target mapping relationship is obtained by updating based on an initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship; and
measuring the quantum circuit based on the second measurement order, to obtain a measurement result.

### Claim 18 (depends on 17)

The non-transitory computer-readable storage medium of claim 17, wherein the determining the second measurement order of the respective logical qubits of the quantum circuit based on the physical qubit order and the initial mapping relationship, comprises:
determining an inverse mapping relationship of the initial mapping relationship, wherein the inverse mapping relationship is a mapping relationship between the respective physical qubits and the respective logical qubits; and
mapping the physical qubit order based on the inverse mapping relationship, to obtain the second measurement order of the respective logical qubits.

### Claim 19 (depends on 17)

The non-transitory computer-readable storage medium of claim 17, wherein the computer instructions, when executed by the computer, cause the computer to further perform operations of:
determining the initial mapping relationship between the respective logical qubits and the respective physical qubits;
determining a non-executable target quantum gate in the quantum circuit based on the initial mapping relationship and the chip coupling diagram;
inserting a swap gate into the quantum circuit based on the non-executable target quantum gate; and
updating the initial mapping relationship based on the swap gate, to obtain the target mapping relationship.

### Claim 20 (depends on 19)

The non-transitory computer-readable storage medium of claim 19, wherein the determining the initial mapping relationship between the respective logical qubits and the respective physical qubits, comprises:
obtaining a simplified quantum circuit and a reverse circuit of the simplified quantum circuit, based on the target quantum gate in the quantum circuit;
performing N iteration processes based on the simplified quantum circuit and the reverse circuit, to obtain N mapping relationships, wherein N is an integer greater than or equal to 2; and
determining the initial mapping relationship in the N mapping relationships.
