# US 2021/0286601 A1 · Systems and methods for unified computing on digital and quantum computers

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

- Number: US 2021/0286601 A1
- Document ID: US20210286601A1
- Status: Published application
- Kind: A1
- Application number: 17/337,873
- Filed: 2021-06-03
- Published: 2021-09-16
- Earliest claimed: 2019-12-09
- Assignees: Horizon Quantum Computing Pte. Ltd.
- Applicants: Horizon Quantum Computing PTE. LTD.
- Inventors: Joseph Francis Fitzsimons; Si-Hui Tan
- Web page: https://patentgrep.com/patent/US20210286601A1

## CPC

- G06F 8/44: {Encoding}
- G06F 8/41: Compilation
- G06F 8/4441: {Reducing the execution time required by the program code}
- G06F 8/447: {Target code generation}
- G06F 8/72: Code refactoring
- G06N 10/20: Models of quantum computing, e.g. quantum circuits or universal quantum computers
- G06N 10/80: Quantum programming, e.g. interfaces, languages or software-development kits for creating or handling programs capable of running on quantum computers; Platforms for simulating or accessing quantum computers, e.g. cloud-based quantum computing
- G06F 8/437: {Type checking}
- G06F 11/1666: {where the redundant component is memory or memory area}
- G06F 30/327: Logic synthesis; Behaviour synthesis, e.g. mapping logic, HDL to netlist, high-level language to RTL or netlist
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Computer systems and methods are provided for compiling a computer program to run on a quantum processor comprising a plurality of qubits, qudits or quantum continuous variables. A compiler obtains the program in a unified language, that is effectively a classical language, as opposed to a quantum language, and performs code refactoring on all or a portion of the program to form a refactored code and converts the refactored code into a first code. The compiler compiles the first code into a second code comprising a plurality of data elements in one or more quantum data structures. The compiler converts the second code to a third code expressed in a quantum gate-level language in accordance with an instruction set and gate locality constraints of the target quantum processor.

## Claims

### Claim 1

A digital computer system for compiling a computer program for a target quantum processor comprising a plurality of qubits, qudits, or quantum continuous variables, the computer system comprising:
one or more digital processors;
a memory; and
one or more programs in the form of a compiler, wherein the compiler comprises:
(A) instructions for obtaining a computer program written in a unified language and performing code refactoring on all or a portion of the computer program to form a refactored code and converting the refactored code into a first code;
(B) instructions for compiling the first code into a second code, wherein the second code comprises a plurality of data elements in one or more quantum data structures determined by the compiler from one or more digital datatypes determined by the compiler from one or more digital datatypes in the first code; and
(C) instructions for compiling the second code into a third code expressed in a quantum gate-level language in accordance with an instruction set and one or more gate locality constraints of the target quantum processor.

### Claim 2 (depends on 1)

The computer system of claim 1, wherein the compiler further comprises instructions for converting the second code to a fourth code comprising a series of quantum gate level operations, and wherein the instructions for compiling the second code into the third code further includes instructions for compiling the fourth code into the third code.

### Claim 3 (depends on 1, 2)

The computer system according to claim 1 or 2, wherein the compiler performs code refactoring at least in part by replacing a source loop in the computer program written in the unified language with a plurality of loops that collectively accomplish a result of the source loop, and wherein a complexity of each loop in the plurality of loops is less than that of the source loop.

### Claim 4 (depends on 3)

The computer system according to claim 3, wherein the compiler performs code refactoring at least in part by analytically solving a loop in the plurality of loops.

### Claim 5 (depends on 3)

The computer system of claim 3, wherein the compiler performs code refactoring at least in part by replacing a loop in the plurality of loops with an object constructor call.

### Claim 6 (depends on 1, 2, 3, 4, 5)

The computer system of any one of claims 1-5, wherein the compiler performs code refactoring by encoding a portion of the computer program written in the unified language to perform a quantum algorithm that performs a function of the portion of the computer program.

### Claim 7 (depends on 6)

The computer system of claim 6, wherein the quantum algorithm is an amplitude amplification-based quantum algorithm.

### Claim 8 (depends on 1, 2, 3, 4, 5, 6, 7)

The computer system of any one of claims 1-7, wherein the compiler:
provides access to quantum gate level commands specified in the first code, and
supports pointers that are encoded on qubits, qudits, or quantum continuous variables in the plurality of qubits qudits or quantum continuous variables, functions, loops that cannot be unrolled, recursion, pointers, data structure definitions, class object definitions located in the first code, or a combination thereof.

### Claim 9 (depends on 1, 2, 3, 4, 5, 6, 7, 8)

The computer system of any one of claims 1-8, wherein the first code defines a quantum data structure.

### Claim 10 (depends on 9)

The computer system of claim 9, wherein the quantum data structure is a graph data structure or a matrix.

### Claim 11 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

The computer system of any one of claims 1-10, wherein the unified language is limited to digital instructions.

### Claim 12 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)

The computer system of any one of claims 1-11, wherein the second code is written in a gate level language that is augmented with a conditional and wherein the second code includes a conditional.

### Claim 13 (depends on 12)

The computer system of claim 12, wherein the conditional is an if condition or repeat condition in which an action is repeated until a predetermined condition is achieved.

### Claim 14 (depends on 13)

The computer system of claim 13, wherein the predetermined condition is a digital measurement outcome for one or more qubits, qudits, or quantum continuous variables defined by the second code.

### Claim 15 (depends on 13)

The computer system of claim 13, wherein the gate level language is augmented with support for a subroutine, in which one portion of the second code is repeatedly called by another portion of the second code until a predetermined outcome is achieved.

### Claim 16 (depends on 15)

The computer system of claim 15, wherein the subroutine is a measurement subroutine.

### Claim 17 (depends on 16)

The computer system of claim 16, wherein the plurality of qubits, qudits, or quantum continuous variables is a plurality of qubits or qudits and the measurement subroutine makes use of ancilla qubits or qudits in the plurality of qubits or qudits to improve a measurement outcome.

### Claim 18 (depends on 15)

The computer system of claim 15, wherein the predetermined outcome is a measurement outcome for one or more qubits or qudits defined by the second code.

### Claim 19 (depends on 12)

The computer system of claim 12, wherein the conditional is a parameter of an increment loop.

### Claim 20 (depends on 12)

The computer system of claim 12, wherein the compiler converts the second code to the third code at least in part by:
optimizing code within the conditional to form an optimized conditional, wherein an iteration of a code sequence specified by the optimized conditional has fewer instructions than an iteration of a code sequence specified by the conditional,
unrolling the optimized conditional into a series of quantum gates, and
incorporating the series of quantum gates into the third code.

### Claim 21 (depends on 12)

The computer system of claim 12, wherein the compiler converts the second code to the third code at least in part by optimizing a quantum operation that serves to perform a portion of the second code, thereby reducing a number of gates, a number of qubits, a number of qudits, or a number of quantum continuous variables in the third code that are needed to perform the quantum operation.

### Claim 22 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)

The computer system of any one of claims 1-21, wherein the second code defines a qubit, qudit, or quantum continuous variable within the target quantum processor.

### Claim 23 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)

The computer system of any one of claims 1-21, wherein the second code defines a register of qubits or a register of qudits within the target quantum processor.

### Claim 24 (depends on 12)

The computer system of claim 12, wherein the gate level language supports qubit, qudit, or quantum continuous variable measurement.

### Claim 25 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)

The computer system of any one of claims 1-24, wherein the quantum gate-level language uses a plurality of different gates, wherein each respective gate in the plurality of different gates is defined in a different data structure that includes a name of the respective gate, a dimension of the respective gate in terms of number of qubits or qudits, and a corresponding plurality of Kraus operators for the respective gate.

### Claim 26 (depends on 25)

The computer system of claim 25, wherein a subset of Kraus operators in the corresponding plurality of Kraus operators for the respective gate is specified by a function handle.

### Claim 27 (depends on 2)

The computer system of claim 2, wherein the fourth code supports general positive operator-valued measures of one or more qubits, qudits, or quantum continuous variables in the plurality of qubits, qudits, or quantum continuous variables.

### Claim 28 (depends on 2)

The computer system of claim 2, wherein the compiler compiles the fourth code into the third code at least in part by performing gate synthesis in which a sequence of ideal gates, which implement at least a portion of the fourth code, are swapped with a sequence of gates that differ from the sequence of ideal gates but will perform the function, or substantially the same function, of the sequence of ideal gates on the target quantum processor.

### Claim 29 (depends on 28)

The computer system of claim 28, wherein the sequence of gates that differ from the sequence of ideal gates are identified by a stored hardware characterization of the target quantum processor.

### Claim 30 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29)

The computer system of any one of claims 1-29, wherein the compiler further comprises instructions for circuit embedding of the third code in accordance with one or more locality constraints of the target quantum processor.

### Claim 31 (depends on 30)

The computer system of claim 30, wherein the instructions for circuit embedding of the third code in accordance with the one or more locality constraints of the target quantum processor comprises taking into account a determined quality of the target quantum processor at performing 2-qubit gates or 2-qudit gates.

### Claim 32 (depends on 1)

The computer system of claim 1, wherein the compiler further comprises instructions for counting a number of gates, qubits, qudits, quantum continuous variables or wall clock time needed to implement the computer program on the target quantum processor.

### Claim 33 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)

The computer system of any one of claims 1-32, wherein the compiler further comprises instructions for implementing a first portion of the computer program on the target quantum processor and a second portion of the computer program on a digital central processing unit or a graphical processing unit of a digital computer system.

### Claim 34 (depends on 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33)

The computer system of any one of claims 1-33, wherein the compiler further comprises instructions for simulating quantum code generated by the compiler on a digital central processing unit or a graphical processing unit of a digital computer system.

### Claim 35

A method for compiling a computer program that can be run on a target quantum processor, the target quantum processor comprising a plurality of qubits, qudits, or quantum continuous variables, the method comprising:
at a digital computer system comprising one or more digital processors and a memory, the memory comprising non-transitory instructions configured to perform a procedure using the one or more digital processors, the procedure comprising:
(A) obtaining a computer program written in a unified language;
(B) performing code refactoring on all or a portion of the computer program to form a refactored code;
(C) converting the refactored code into a first code;
(D) compiling the first code into a second code, wherein the second code comprises a plurality of data elements in one or more quantum data structures determined by the compiler from one or more digital datatypes in the first code;
(E) compiling the second code into a third code expressed in a quantum gate-level language in accordance with an instruction set and one or more gate locality constraints of the target quantum processor.

### Claim 36

A non-transitory computer readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a digital computer system with one or more digital processors, cause the digital computer system to:
(A) obtain a computer program written in a unified language;
(B) perform code refactoring on all or a portion of the computer program to form a refactored code;
(C) convert the refactored code into a first code;
(D) compile the first code into a second code, wherein the second code comprises a plurality of data elements in one or more quantum data structures determined by the high level module from one or more digital datatypes in the first code; and
(E) compiling the second code into a third code expressed in a quantum gate-level language in accordance with an instruction set and one or more gate locality constraints of the target quantum processor.
