A quantum circuit compilation method, system, device and storage medium
Through the quantum line compilation method, the general quantum line is converted into the underlying signal waveform, solving the problem of low execution efficiency of quantum computers and achieving efficient and accurate quantum line conversion.
Patent Information
- Application Number
- CN202410830055.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-06-25
AI Technical Summary
In the field of quantum computing, how to efficiently and accurately convert quantum lines into underlying signal waveforms, thereby achieving efficient execution of quantum computers.
Through a quantum circuit compilation method, it includes obtaining a general quantum circuit, compiling a local quantum circuit, compiling a waveform sequence tensor, and converting it into waveform data executable by an arbitrary waveform generator.
It realizes efficient and accurate conversion of quantum circuits into underlying signal waveforms, improving the execution efficiency of quantum computers.
Smart Images

Figure CN118839782B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of ion trap quantum computing, and in particular to a quantum circuit compilation method, system, device and storage medium. Background Art
[0002] In the field of quantum computing, quantum circuits and quantum gates executed by local computers belong to different abstraction layers. Mapping each operation of the quantum circuit to the control signal of the local computer is a key issue and needs to be customized according to different systems.
[0003] Acousto-Optic Deflector (AOD) and Acousto-Optic Modulator (AOM) are the core devices for ion trap quantum computers to realize quantum gate operations. They can receive a radio frequency signal (which can come from a signal source device such as an arbitrary waveform generator) and modulate the corresponding parameters of the laser according to the signal's amplitude, frequency, phase, and duration information, thereby regulating the interaction between the laser and ions (or atoms). The bottom layer of any quantum operation corresponds to a signal waveform applied to the acousto-optic deflector and the acousto-optic modulator. If you want to realize a quantum circuit, its underlying signal is also a signal waveform, but it lasts longer. Efficiently and accurately converting quantum circuits into underlying signal waveforms is a very critical issue that determines the execution efficiency of quantum computers.
[0004] Therefore, there is an urgent need to develop a quantum circuit compilation method, system, device and storage medium to efficiently and accurately convert quantum circuits into underlying signal waveforms. Summary of the invention
[0005] The present application provides a quantum circuit compilation method, system, device and storage medium, which can efficiently and accurately convert quantum circuits into underlying signal waveforms.
[0006] In a first aspect, an embodiment of the present application provides a quantum circuit compilation method, comprising:
[0007] S1. Obtaining a universal quantum circuit: Obtaining a universal quantum circuit through a predefined quantum algorithm or quantum programming tool, where:
[0008] The universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates;
[0009] S2. Compiling a local quantum circuit: using a first compilation module to compile the universal quantum circuit into an equivalent local quantum circuit;
[0010] S3. Compile waveform sequence tensor: Through the second compilation module, compile each quantum gate in the local quantum circuit into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all the sub-waveform sequence tensors, where each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate;
[0011] S4. Compile into waveform data: Through the conversion module, the waveform sequence tensor is converted into waveform data executable by the arbitrary waveform generator to complete the compilation.
[0012] According to any of the aforementioned implementations of the first aspect of the present application, in step S2, compiling the universal quantum circuit into an equivalent local quantum circuit includes:
[0013] Obtaining a local quantum gate set: identifying and obtaining a local quantum gate set suitable for a target quantum computer, the set containing at least one set of general quantum gates or universal quantum gates;
[0014] Compile into an equivalent local quantum circuit: Input a local quantum gate set to compile a universal quantum circuit into the local quantum circuit, wherein any quantum gate in the universal quantum circuit can be approximated to a preset accuracy by cascading elements in the local quantum gate set.
[0015] According to any of the aforementioned implementations of the first aspect of the present application, between step S2 and step S3, the following steps are further included:
[0016] Formatting the local quantum circuit into a custom quantum circuit format to optimize data management and processing efficiency, wherein:
[0017] The customized quantum circuit format has a multi-layer data structure, including:
[0018] The base layer BL is an element containing multiple keyword parameters, which is used to describe the characteristics of a single quantum gate in the custom quantum circuit format, wherein the keywords include the quantum gate type and the target quantum bit, and the specific form is:
[0019] BL={“gate”:gate_type; “qubit”:qubit_index}
[0020] Indicates applying a gate_type quantum gate to the quantum bit indexed as qubit_index, where gate_type is a quantum gate in the local quantum gate set;
[0021] The parallel layer CL is a combination of one or more basic layers, where multiple quantum gates corresponding to multiple basic layers are executed in parallel. The specific form is:
[0022] CL=[BL1,BL2,....];
[0023] The serial layer SL is a combination of multiple parallel layers arranged in sequence, which is used to represent quantum circuits executed in sequence. The specific form is:
[0024] SL=[CL1,CL2,...], where SL can be used to represent a local quantum circuit.
[0025] According to any of the aforementioned implementations of the first aspect of the present application, in step S3, the waveform sequence tensor has a multi-layer data structure, including:
[0026] The basic waveform layer is used to represent the characteristics of a single basic waveform, including duration, amplitude, phase, and frequency;
[0027] A combined waveform layer is used to represent a parallel combination of multiple basic waveform layers;
[0028] The sequence waveform layer is used to represent a serial combination of multiple combination waveform layers.
[0029] According to any of the aforementioned implementations of the first aspect of the present application, the structure of the basic waveform layer is a 1×4 matrix [t, a, p, f], where t, a, p, and f represent the duration, amplitude, phase, and frequency of the basic waveform, respectively;
[0030] The waveform function f(t) of a single waveform is expressed by the following formula:
[0031] f(t) = a sin(2πft+p).
[0032] According to any of the foregoing implementations of the first aspect of the present application, the structure of the combined waveform layer is an N×4 matrix M, wherein M is represented as follows:
[0033]
[0034] The waveform function F(t) corresponding to the parallel combination of multiple basic waveform layers is expressed by the following formula:
[0035]
[0036] Wherein, i (i=1, 2, ..., N) represents the i-th basic waveform.
[0037] According to any of the aforementioned implementations of the first aspect of the present application, the structure of the sequence waveform layer is a three-dimensional tensor T, wherein T is represented as follows:
[0038]
[0039] The waveform function corresponding to the serial combination of multiple combined waveform layers is expressed as follows:
[0040]
[0041] Wherein, J represents J different time periods, each time period corresponds to a combination of waveforms, where j=1, 2, ..., J.
[0042] According to any of the foregoing implementations of the first aspect of the present application, in step S3, the compiling process further includes:
[0043] Mapping function definition: A set of mapping functions is predefined. The mapping functions generate corresponding sub-waveform sequence tensors based on the local quantum gate set and the target action bit. Each mapping function completes the following mapping:
[0044] Base layer->sub-waveform sequence tensor, where “->” indicates a mapping relationship;
[0045] Waveform sequence generation: traverse a local quantum circuit represented by a serial layer, obtain the base layer corresponding to all quantum operations, and generate the corresponding sub-waveform sequence tensor T for each base layer;
[0046] Parallel concatenation of waveform sequences: concatenate the sub-waveform sequence tensors of the base layer belonging to the same parallel layer along the parallel dimension of the tensor to obtain all the waveform sequence tensors of the parallel layer;
[0047] Waveform sequence serial splicing: All parallel layer waveform sequence tensors are spliced along the serial dimension of the tensor according to their order in the serial layer to obtain the complete waveform sequence tensor of the entire quantum circuit.
[0048] According to any of the foregoing implementations of the first aspect of the present application, in step S3, the compiling process further includes:
[0049] The flyweight mode is used to optimize the generation of waveform sequence tensors, including:
[0050] Central storage and parameter indexing: Establish a central storage to save all unique sub-waveform sequence tensors, and each sub-waveform sequence tensor is indexed and accessed by its key parameters;
[0051] When a request is made to generate a new sub-waveform sequence tensor, the central storage is first checked to determine whether a sub-waveform sequence tensor with the same parameters already exists;
[0052] Fast retrieval and reuse of sequences: If the corresponding sub-waveform sequence tensor is found, the existing sub-waveform sequence tensor is directly reused; if not found, a new sub-waveform sequence tensor will be created and added to the central storage.
[0053] According to any of the aforementioned implementations of the first aspect of the present application, in step S4, converting the waveform sequence tensor into waveform data executable by an arbitrary waveform generator includes:
[0054] Time series generation: calculating the total time length of the waveform sequence tensor, and generating the total time series according to the preset sampling step length by increasing the sampling step length;
[0055] Waveform allocation: Assign the corresponding sampling point interval in the time series to the waveform of each time period;
[0056] Waveform calculation: calculate the value of each combined waveform layer waveform segment in the corresponding sampling point interval;
[0057] Waveform splicing: Splice the data corresponding to each combined waveform layer calculated in sequence to obtain the final waveform data.
[0058] According to any of the aforementioned implementations of the first aspect of the present application, the underlying waveform data is defined as a one-dimensional array that can be directly imported into an arbitrary waveform generator, wherein:
[0059] After the sampling step is set, each element in the one-dimensional array represents the signal value that lasts within the sampling step.
[0060] In a second aspect, an embodiment of the present application provides a quantum circuit compilation system, including:
[0061] The acquisition module is configured to acquire a universal quantum circuit, including: acquiring the universal quantum circuit through a predefined quantum algorithm or a quantum programming tool, wherein:
[0062] The universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates;
[0063] A first compiling module, configured to compile the universal quantum circuit into an equivalent local quantum circuit;
[0064] A second compiling module is configured to compile each quantum gate in the local quantum circuit into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all the sub-waveform sequence tensors. Each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate;
[0065] The conversion module is configured to convert the waveform sequence tensor into waveform data executable by the arbitrary waveform generator to complete the compilation.
[0066] In a third aspect, an embodiment of the present application provides a computer device, including:
[0067] A memory storing executable program code;
[0068] A processor, configured to call the executable program code to execute the method according to any one of claims 1 to 11.
[0069] In a fourth aspect, an embodiment of the present application provides a computer storage medium, wherein a computer program is stored in the computer storage medium. When the computer storage medium is run on a computer, the computer executes a method as described in any one of claims 1 to 11.
[0070] The present invention converts the universal quantum circuit into a local quantum circuit first, and then converts it into a waveform sequence tensor, thereby finally obtaining waveform data executable by an arbitrary waveform generator, thereby enabling the quantum circuit to be efficiently and accurately converted into an underlying signal waveform. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0072] Figure 1 A schematic diagram of a flow chart of a quantum circuit compilation method according to an embodiment of the present application;
[0073] Figure 2 A schematic diagram of the structure of a quantum logic circuit according to an embodiment of the present application;
[0074] Figure 3 A schematic diagram of the underlying waveform corresponding to the waveform sequence tensor of an embodiment of the present application;
[0075] Figure 4 Based Figure 3 A schematic diagram of the underlying waveform corresponding to the first combined waveform layer in the waveform sequence tensor shown;
[0076] Figure 5 This is a schematic diagram of the structure of a quantum circuit compilation system according to an embodiment of the present application;
[0077] Figure 6 A schematic diagram of the structure of a computer device according to an embodiment of the present application;
[0078] Figure 7 A schematic diagram of the structure of a computer storage medium according to an embodiment of the present application.
[0079] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0080] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0081] It should be noted that all directional indications such as up, down, left, right, front, back... in the embodiments of the present application are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture as shown in the accompanying drawings. If the specific posture changes, the directional indication will also change accordingly.
[0082] In addition, the descriptions of "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0083] In a quantum computer based on an ion trap system, each quantum operation is realized by applying radio frequency signals to an acousto-optic deflector and an acousto-optic modulator. In a quantum computer based on an ion trap system, there are two acousto-optic deflectors and two acousto-optic modulators, which receive four-channel radio frequency signals. All quantum operations require four-channel radio frequency signals, which are generated by an arbitrary waveform generator. Therefore, in order to realize a quantum operation, the quantum logic circuit needs to be converted into waveform data that can be received and processed by the arbitrary waveform generator.
[0084] This application embodiment provides a quantum circuit compilation method, see Figure 1 , is a flow chart of a quantum circuit compilation method according to an embodiment of the present application, comprising:
[0085] S1. Obtaining a universal quantum circuit: Obtaining a universal quantum circuit through a predefined quantum algorithm or quantum programming tool, wherein the process of obtaining is to transform an actual quantum task into a universal quantum circuit through a predefined quantum algorithm or quantum programming tool (the process of transformation is not described in detail in the present invention), wherein the universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates;
[0086] S2. Compiling a local quantum circuit: using a first compilation module to compile the universal quantum circuit into an equivalent local quantum circuit;
[0087] S3. Compile waveform sequence tensor: Through the second compilation module, each quantum gate in the local quantum circuit is compiled into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all sub-waveform sequence tensors. Each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate;
[0088] S4. Compile into waveform data: Through the conversion module, the waveform sequence tensor is converted into waveform data executable by the arbitrary waveform generator (AWG) to complete the compilation.
[0089] In addition, an embodiment of the present application further provides a quantum circuit compilation system, which can execute the above-mentioned quantum circuit compilation method, wherein the quantum circuit compilation system includes:
[0090] The acquisition module is configured to acquire a universal quantum circuit, including: acquiring the universal quantum circuit through a predefined quantum algorithm or a quantum programming tool, wherein:
[0091] The universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates;
[0092] A first compiling module, configured to compile the universal quantum circuit into an equivalent local quantum circuit;
[0093] A second compiling module is configured to compile each quantum gate in the local quantum circuit into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all the sub-waveform sequence tensors. Each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate;
[0094] The conversion module is configured to convert the waveform sequence tensor into waveform data executable by the arbitrary waveform generator to complete the compilation.
[0095] The present invention is described in detail below.
[0096] In the present invention, the universal quantum circuit or universal quantum gate generally refers to a quantum circuit using a standard quantum gate set, which is not limited in the present invention. Without departing from the protection scope of the present invention, the universal quantum circuit is processed to finally obtain waveform data executable by an arbitrary waveform generator, which is one of the main purposes of the present invention.
[0097] The predefined quantum programming tool in step S1 may be Qiskit (a quantum computing tool). It should be understood that any other type of quantum programming tool may be applicable to the present invention.
[0098] In some embodiments of the present invention, the local quantum circuit may refer to Figure 2 , Figure 2 A schematic diagram of a local quantum circuit is shown as an example. Figure 2 In the figure, the local quantum circuit includes quantum bits, timelines, and logic gates, where q00 represents quantum bit 0, q01 represents quantum bit 1, X, Y, and MS are logic gates, X and Y represent single-bit X gates and single-bit Y gates, and MS represents a two-bit MS gate unique to the ion trap system. Figure 2 The quantum logic circuit shown indicates that an X gate is first applied to qubit 0 and a Y gate is applied to qubit 1 in parallel, followed by a two-bit MS gate applied serially to qubit 0 and qubit 1, and finally an X gate is applied serially to qubit 0.
[0099] In some embodiments of the present invention, in step S2, compiling the universal quantum circuit into an equivalent local quantum circuit includes: obtaining a local quantum gate set, the set including at least one set of universal quantum gates or universal quantum gates: converting the set of universal quantum gates in the universal quantum circuit into a local quantum gate set, identifying and obtaining a local quantum gate set suitable for a target quantum computer, inputting the local quantum gate set, and finally the first compiling module compiles the universal quantum circuit into the local quantum circuit through the above-mentioned quantum programming tool, wherein any quantum gate in the universal quantum circuit can be cascaded to approximate the preset accuracy by elements in the local quantum gate set, wherein the set of universal quantum gates is a standard quantum gate set that does not depend on specific quantum hardware. The local quantum gate set is a gate set supported by a local quantum computer system, and the required specific local quantum circuit can be obtained according to the set and the corresponding compilation tool.
[0100] In some embodiments of the present invention, between step S2 and step S3, the following step is further included: formatting the local quantum circuit into a custom quantum circuit format to optimize data management and processing efficiency, wherein the custom quantum circuit format has a multi-layer data structure, including:
[0101] The basic level BL (Basic_level) has the form: BL = {"gate":gate_type; "qubit":qubit_index}, which means applying a gate_type quantum gate on the quantum bit indexed as qubit_index, where gate_type is a quantum gate in the local quantum gate set. In the present invention, the basic level is an element containing multiple keyword parameters, which is used to describe the characteristics of a single quantum gate in the custom quantum circuit format. The keyword parameter group of a single gate can be defined by a python dictionary structure. Figure 2 The format of the local quantum circuit is converted to an example, and the structure of the basic layer can be exemplified as follows:
[0102] {"gate":"X","qubit_index":[0]}
[0103] The keywords in the structure of the base layer include the quantum gate type (i.e., "gate", which indicates the name of a single quantum operation), the target quantum bit (i.e., "qubit_index", which indicates the execution object of a single quantum operation), and other parameters that can be flexibly added as needed. The structure of the base layer described above describes the application of gate X on quantum bit No. 0.
[0104] The parallel layer CL (Compose_level) is in the form of CL = [BL1, BL2, ....], and the parallel layer is a combination of one or more base layers, where multiple quantum gates corresponding to multiple base layers are executed in parallel. The parallel layer is used to describe the parallel combination of quantum operations of multiple base layers, and then execute multiple operations at the same time. The parallel operation layer can be defined by the python list structure. Figure 2 The format of the local quantum circuit is converted to an example, and the structure of the parallel layer is as follows:
[0105] [{"gate":"X","qubit_index":[0]},{"gate":"Y","qubit_index":[1]}]
[0106] The parallel layer exists in the form of an ordered list and is formed by two basic layers in parallel. That is, the above parallel layer describes applying X gate to quantum bit No. 0 and Y gate to quantum bit No. 1 in parallel.
[0107] The serial layer SL (Sequence_level) is in the form of SL = [CL1, CL2, ....], where SL can be used to represent a local quantum circuit. The serial layer is a combination of multiple parallel layers arranged in sequence, which is used to represent a quantum circuit executed in sequence. The serial layer is at the top layer. By sequentially arranging the operations of each combined layer, a complete quantum circuit can be constructed. The serial layer can be defined by a python list structure. Figure 2 The format of the local quantum circuit is converted to an example, and the structure of the serial layer is as follows:
[0108]
[0109] The serial layer also exists in the form of an ordered list and is formed by three parallel layers in series. That is to say, the serial layer describes the application of X gate on quantum bit 0 and Y gate on quantum bit 1 in parallel, and then the execution of two-bit MS gate on quantum bit 0 and quantum bit 1 in series, and finally the execution of X gate on quantum bit 0 in series.
[0110] The design of each of the above operation levels is aimed at improving the logical clarity and execution efficiency of quantum computing, among which X, Y, and MS gates have been registered as quantum operations, and the MS gate is a gate operation unique to ion trap technology.
[0111] In some embodiments of the present invention, in step S3, the waveform sequence tensor has a multi-layer data structure. The waveform sequence tensor is a parameterized representation of the bottom-level waveform data realized by a specific mathematical model (such as trigonometric function, Fourier series, B-Spline curve, etc.), and is composed of three layers of structured data. The characteristics are as follows (taking trigonometric function as an example):
[0112] The basic waveform layer is used to represent the characteristics of a single basic waveform, including duration, amplitude, phase and frequency. The structure of the basic waveform layer is a 1×4 matrix [t, a, p, f], where t, a, p, and f represent the duration, amplitude, phase and frequency of the basic waveform respectively. The waveform function f(t) of a single waveform is expressed by the following formula:
[0113] f(t)=a sin(2πft+p) or f(t)=a cos(2πft+p) can be selected as needed. The present invention uses f(t)=a sin(2πft+p) as an example for explanation.
[0114] The combined waveform layer is used to represent the parallel combination of multiple basic waveform layers. Assuming there are N basic waveforms, the waveform function f corresponding to the i-th (i=1, 2, ..., N) basic waveform is i (t) can be expressed by the following formula:
[0115] f i (t) = a i sin(2πf i t+p i )
[0116] In the formula, there are four parameters [t i , a i , p i , f i ] definition, and f i The sum of (t) can form the waveform function F(t) corresponding to the whole set of waveforms:
[0117]
[0118] The whole set of waveforms can be parameterized by an N×4 matrix M, which can represent the parameterized structure of the basic waveform layer:
[0119]
[0120] In the matrix, each row represents a set of waveform parameters.
[0121] A sequence waveform layer is used to represent a serial combination of multiple combined waveform layers, wherein each combined waveform layer has a different time period. Assuming there are J different time periods, each time period corresponds to a waveform combination (a waveform composed of one or more basic waveforms) F j (t), where j = 1, 2, ..., J. These combinations are generated in the second layer (i.e., the combined waveform layer). Let the jth time period be from T j-1 to T j , then the function corresponding to the waveform of the entire time period, that is, the waveform sequence function corresponding to the serial combination of multiple combined waveform layers is expressed as:
[0122]
[0123] Furthermore, the waveform function is parameterized, that is, each time period is represented by an N j ×4 matrix M j Represented as , a three-dimensional tensor Tensor can be constructed to represent the entire waveform sequence, that is, the parameterized structure of the sequence wave layer can be represented:
[0124]
[0125] The above method of using Tensor to represent the entire waveform sequence can ensure that the waveform of each time period is independent of other time periods, so that the entire waveform sequence is played in a predetermined time order. Such a description is not only suitable for accurately encoding waveform sequences into quantum computers, but also facilitates the understanding and implementation of complex waveform scheduling strategies.
[0126] There are three main advantages to defining waveform sequences as 3D tensors:
[0127] 1. The three-dimensional tensor can clearly define all waveform parameters in each time period and intuitively represent the multi-level and multi-dimensional data structure, making data organization and access more intuitive and efficient.
[0128] 2. Three-dimensional tensors allow the operation and processing of the entire waveform sequence at the same time, which significantly reduces memory overhead compared to directly operating the underlying waveform data.
[0129] 3. There are multiple mature computing tools that support parallel processing of three-dimensional tensors, such as numpy, tensorflow, pytorch, matlab, etc., which can efficiently generate underlying waveform data.
[0130] In some embodiments of the present invention, in step S3, the compiling process further includes:
[0131] Mapping function definition: predefine a set of mapping functions, which map the local quantum gate set, target action bits and other possible keyword parameters to the sub-waveform sequence tensor corresponding to the set of parameters. Each mapping function completes the following mapping: base layer -> sub-waveform sequence tensor ("->" indicates a mapping relationship). For example, the X gate in the ion trap is mapped to the sub-waveform sequence tensor corresponding to the gate. In an ion trap embodiment, two AODs and two AOMs are required to work together to jointly realize a quantum gate, that is, a quantum gate needs to be mapped to four sub-waveform sequence tensors:
[0132] Waveform sequence generation: traverse a local quantum circuit represented by Sequence_level, obtain the Basic_level corresponding to all quantum operations, and generate the corresponding sub-waveform sequence tensor T for each Basic_level;
[0133] Parallel stitching of waveform sequences: stitch the sub-waveform sequence tensors of Basic_level belonging to the same parallel layer along the dimension of the parallel layer of the tensor to obtain all parallel layer waveform sequence tensors; during parallel stitching, the parameters of the parallel layer tensor need to be processed according to the specific hardware characteristics, including: ensuring that the amplitude value of the waveform of this layer is not greater than 1, adjusting the phase, etc.
[0134] Waveform sequence serial splicing: splice all parallel layer waveform sequence tensors along the dimension of the serial layer of the tensor according to their order in the serial layer to obtain the complete waveform sequence tensor of the entire quantum circuit.
[0135]
[0136] Among them, the four functions on the right side of the above formula are mathematical expressions of waveform sequence tensors, wherein the subscript AOM_R represents the AOM on the right side, AOM_L represents the AOM on the left side, AOD_R represents the AOD on the right side, and AOD_L represents the AOD on the left side.
[0137] For example, each G function can be represented by a tensor, for example:
[0138]
[0139] In this example, the waveform sequence tensor T AOM_R (indicates the waveform sequence tensor corresponding to the AOM on the right) consists of three combined waveform layers, each of which is played in sequence. AOM_R The corresponding underlying waveform data is as follows Figure 4 As shown, each combined waveform layer contains one or more basic waveforms, and the basic waveforms are played in parallel. For example, the underlying waveform data corresponding to the first combined waveform is as follows: Figure 3 shown.
[0140] In this embodiment, the core of the mapping relationship is to effectively map a set of keyword parameters to the corresponding waveform sequence tensor. This process belongs to the field of quantum control, and its goal is to adjust the shape of the pulse to complete the quantum state evolution of a specific control goal, such as enhancing the system's resistance to environmental noise and device crosstalk, and optimizing the execution time of the quantum gate. Common modulation methods include amplitude modulation, frequency modulation, phase modulation, multi-frequency modulation, and IQ modulation. The pulse shapes calculated by these modulation types can be directly represented by the pulse sequence tensor.
[0141] For each gate in the local quantum gate set, the group of mapping functions must complete such mapping, and the specific form of the mapping function is not within the scope of the present invention.
[0142] In some embodiments of the present invention, waveform sequence generation includes: traversing a local quantum circuit represented by a serial layer, obtaining the base layers corresponding to all quantum operations, and generating a corresponding sub-waveform sequence tensor for each base layer.
[0143] In some embodiments of the present invention, parallel stitching of waveform sequences includes: splicing sub-waveform sequence tensors of the base layer belonging to the same parallel layer along the parallel dimension of the tensor to obtain all parallel layer waveform sequence tensors, wherein during parallel stitching, it is necessary to process the parameters of the parallel layer tensor according to specific hardware characteristics, including: ensuring that the amplitude value of the waveform of this layer is not greater than 1, adjusting the phase, etc.
[0144] In some embodiments of the present invention, waveform sequence serial splicing includes: splicing all parallel layer waveform sequence tensors along the serial dimension of the tensor in their order in the serial layer to obtain a complete waveform sequence tensor for the entire quantum circuit. The overall form of the waveform sequence tensor is still Tensor, but it is longer than the waveform sequence tensor of a single gate.
[0145] The present invention can accurately express the pulse sequences generated by most optimization algorithms by converting the results calculated by different pulse optimization algorithms into the form of waveform sequence tensors. This enables the present invention to not only seamlessly integrate multiple modulation algorithms, but also be very suitable for testing and implementing various quantum control algorithms, greatly improving its practicality and foresight.
[0146] In some embodiments of the present invention, in step S3, the compiling process further includes:
[0147] The flyweight mode is used to optimize the generation of waveform sequence tensors, including:
[0148] Central storage and parameter indexing: Establish a central storage to store all unique sub-waveform sequence tensors, each of which is indexed and accessed by its key parameters (such as quantum gate type, action bits, and other operation parameters);
[0149] When a request is made to generate a new sub-waveform sequence tensor, the central storage is first checked to determine whether a sub-waveform sequence tensor with the same parameters already exists;
[0150] Fast retrieval and reuse of sequences: If the corresponding sub-waveform sequence tensor is found, the existing sub-waveform sequence tensor is directly reused; if not found, a new sub-waveform sequence tensor will be created and added to the central storage. This method ensures that the generation of waveform sequence tensors is both efficient and resource-saving, which is particularly suitable for processing quantum operations with high repetitiveness.
[0151] In some embodiments of the present invention, in order to ensure the accuracy of converting the waveform sequence tensor into waveform data and the accuracy of the waveform phases in different time periods, the following strategies are further adopted:
[0152] In step S4, the waveform sequence tensor is converted into waveform data executable by the arbitrary waveform generator, including:
[0153] Time series generation: Calculate the total time length of the waveform sequence tensor, and generate the total time series incrementally according to the sampling step size preset for the AWG instrument;
[0154] Waveform allocation: Assign the corresponding sampling point interval in the time series to the waveform of each time period;
[0155] Waveform calculation: Combined with the mathematical model G(t) corresponding to the waveform sequence tensor, the value of each waveform segment (i.e., waveform combination layer) in the corresponding sampling point interval is calculated;
[0156] Waveform splicing: splice each calculated waveform data (i.e., corresponding to each combined waveform layer) in order to obtain the final waveform data. The expression form of the waveform data is exemplified as follows:
[0157] [1.0, 0.8, 0.6, 0.4, 0.2, 0.0, -0.2, -0.4, -0.6, -0.8]
[0158] The values in the waveform data are voltage amplitudes. The underlying waveform data is defined as a one-dimensional array that can be directly imported into an arbitrary waveform generator, wherein, after the sampling step is set, each element in the one-dimensional array represents a signal value (e.g., a voltage value) that lasts within the sampling step. For example, assuming that the sampling rate of the arbitrary waveform generator is 1 GHz, the waveform data in the example represents a waveform with a duration of 10 nanoseconds, and the voltage amplitude duration corresponding to each value is 1 nanosecond.
[0159] The generated four-channel waveform data are transmitted to the arbitrary waveform generator and can be played. The four-channel waveform data corresponds to the four underlying waveforms corresponding to the local quantum circuit. When the trigger command is received, the arbitrary waveform generator plays the four-channel waveform data to two-channel acousto-optic deflectors and two-channel acousto-optic modulators to modulate the laser, thereby controlling the interaction between the laser and ions / atoms and realizing the operation of quantum bits.
[0160] In summary, the present invention provides a method for compiling from quantum circuits to underlying pulse waveforms. In addition to higher conversion efficiency and accuracy, it also has the following significant advantages:
[0161] Wide hardware compatibility: The underlying implementation hardware of the present invention is an arbitrary waveform generator (AWG), so that any quantum computer hardware that uses AWG as a signal source, including but not limited to ion trap systems, can utilize the present method.
[0162] Flexible pulse modulation compatibility: As a continuously evolving field, quantum control technology often generates new pulse optimization algorithms to achieve richer quantum control goals. In the present invention, the pulse modulation algorithm can be used as a flexible and variable module that can be changed at any time when defining the mapping relationship between quantum gates and waveform sequences. It is only necessary to convert the results of the algorithm into the required pulse (waveform) sequence tensor format.
[0163] This application also provides a quantum circuit compilation system, see Figure 5 , Figure 5 This is a schematic diagram of the structure of a quantum circuit compilation system according to an embodiment of the present application, including:
[0164] An acquisition module, used for acquiring a quantum logic circuit;
[0165] A first ordered list generating module is configured to generate a first ordered list based on the quantum logic circuit, for parameterizing and representing the quantum logic circuit;
[0166] A waveform list generation module is configured to generate four waveform lists based on the first ordered list, for parameterizing waveform data corresponding to the quantum logic circuit;
[0167] The waveform data generating module is configured to generate four lines of waveform data based on four waveform lists to complete the compilation, wherein the waveform data includes a plurality of voltage amplitudes arranged in an orderly manner.
[0168] The quantum circuit compilation system of the present application converts the quantum logic circuit into the underlying signal waveform of the ion trap system quantum computer through the first ordered list generation module, the waveform list generation module and the waveform data generation module.
[0169] The present application also provides a computer device, see Figure 6 , the device comprises:
[0170] A memory storing executable program code;
[0171] The processor is used to call the executable program code to execute the above method.
[0172] The present application also provides a computer storage medium, see Figure 7 The computer storage medium stores a computer program, and when the computer storage medium runs on the computer, the computer executes the method as described above.
[0173] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. All equivalent structural changes made under the concept of the present application using the contents of the present application specification and drawings, or directly / indirectly used in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A quantum circuit compilation method, characterized in that: include: S1. Obtaining a universal quantum circuit: Obtaining a universal quantum circuit through a predefined quantum algorithm or quantum programming tool, where: The universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates; S2. Compile the local quantum circuit: use the first compilation module to compile the universal quantum circuit into an equivalent local quantum circuit; in step S2, compile the universal quantum circuit into an equivalent local quantum circuit, including: obtain a local quantum gate set: identify and obtain a local quantum gate set suitable for a target quantum computer, the set containing at least one set of universal quantum gates or universal quantum gates; compile into an equivalent local quantum circuit: input a local quantum gate set to compile the universal quantum circuit into the local quantum circuit, wherein any quantum gate in the universal quantum circuit can be approximated by cascading elements in the local quantum gate set to a preset accuracy; S3. Compile waveform sequence tensor: Through the second compilation module, compile each quantum gate in the local quantum circuit into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all the sub-waveform sequence tensors, where each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate; S4. Compile into waveform data: Through the conversion module, the waveform sequence tensor is converted into waveform data executable by the arbitrary waveform generator to complete the compilation.
2. The quantum circuit compilation method according to claim 1, characterized in that: Between step S2 and step S3, the following steps are also included: Formatting the local quantum circuit into a custom quantum circuit format to optimize data management and processing efficiency, wherein: The customized quantum circuit format has a multi-layer data structure, including: The base layer BL is an element containing multiple keyword parameters, which is used to describe the characteristics of a single quantum gate in the custom quantum circuit format, wherein the keywords include the quantum gate type and the target quantum bit, and the specific form is: BL={"gate":gate_type;"qubit":qubit_index} Indicates applying a gate_type quantum gate to the quantum bit indexed as qubit_index, where gate_type is a quantum gate in the local quantum gate set; The parallel layer CL is a combination of one or more basic layers, where multiple quantum gates corresponding to multiple basic layers are executed in parallel. The specific form is: CL = [BL1, BL2, ....], BL1, BL2 are different parallel base layers; The serial layer SL is a combination of multiple parallel layers arranged in sequence, which is used to represent quantum circuits executed in sequence. The specific form is: SL = [CL1, CL2, ...], where CL1 and CL2 are different parallel layers in a sequential series, and SL can be used to represent a local quantum circuit.
3. The quantum circuit compilation method according to claim 1, characterized in that: In step S3, the waveform sequence tensor has a multi-layer data structure, including: The basic waveform layer is used to represent the characteristics of a single basic waveform, including duration, amplitude, phase, and frequency; A combined waveform layer is used to represent a parallel combination of multiple basic waveform layers; The sequence waveform layer is used to represent a serial combination of multiple combination waveform layers.
4. The quantum circuit compilation method according to claim 3, characterized in that: The structure of the basic waveform layer is a 1×4 matrix [t, a, p, f], where t, a, p, and f represent the duration, amplitude, phase, and frequency of the basic waveform, respectively; The waveform function f(t) of a single waveform is expressed by the following formula: f(t) = a sin(2πft+p).
5. The quantum circuit compilation method according to claim 4, characterized in that: The structure of the combined waveform layer is an N×4 matrix M, where M is expressed as follows: The waveform function F(t) corresponding to the parallel combination of multiple basic waveform layers is expressed by the following formula: Wherein, i represents the i-th basic waveform, where i=1, 2, ..., N.
6. The quantum circuit compilation method according to claim 5, characterized in that: The structure of the sequence waveform layer is a three-dimensional tensor T, where T is expressed as follows: The waveform function corresponding to the serial combination of multiple combined waveform layers is expressed as follows: Wherein, J represents J different time periods, and each time period corresponds to a combination of waveforms.
7. The quantum circuit compilation method according to claim 2, characterized in that: In step S3, the compilation process further includes: Mapping function definition: A set of mapping functions is predefined. The mapping functions generate corresponding sub-waveform sequence tensors based on the local quantum gate set and the target action bit. Each mapping function completes the following mapping: Base layer->sub-waveform sequence tensor, where "->" indicates a mapping relationship; Waveform sequence generation: traverse a local quantum circuit represented by a serial layer, obtain the base layer corresponding to all quantum operations, and generate the corresponding sub-waveform sequence tensor T for each base layer; Parallel concatenation of waveform sequences: concatenate the sub-waveform sequence tensors of the base layer belonging to the same parallel layer along the parallel dimension of the tensor to obtain all the parallel layer waveform sequence tensors; Waveform sequence serial splicing: All parallel layer waveform sequence tensors are spliced along the serial dimension of the tensor according to their order in the serial layer to obtain the complete waveform sequence tensor of the entire quantum circuit.
8. The quantum circuit compilation method according to claim 7, characterized in that: In step S3, the compilation process further includes: The flyweight mode is used to optimize the generation of waveform sequence tensors, including: Central storage and parameter indexing: Establish a central storage to save all unique sub-waveform sequence tensors, and each sub-waveform sequence tensor is indexed and accessed by its key parameters; When a request is made to generate a new sub-waveform sequence tensor, the central storage is first checked to determine whether a sub-waveform sequence tensor with the same parameters already exists; Fast retrieval and reuse of sequences: If the corresponding sub-waveform sequence tensor is found, the existing sub-waveform sequence tensor is directly reused; if not found, a new sub-waveform sequence tensor will be created and added to the central storage.
9. The quantum circuit compilation method according to claim 3, characterized in that: In step S4, the waveform sequence tensor is converted into waveform data executable by the arbitrary waveform generator, including: Time series generation: calculating the total time length of the waveform sequence tensor, and generating the total time series incrementally according to the preset sampling step length; Waveform allocation: Assign the corresponding sampling point interval in the time series to the waveform of each time period; Waveform calculation: calculate the value of each combined waveform layer waveform segment in the corresponding sampling point interval; Waveform splicing: Splice the data corresponding to each combined waveform layer calculated in sequence to obtain the final waveform data.
10. The quantum circuit compilation method according to any one of claims 1 to 8, characterized in that: The underlying waveform data is defined as a one-dimensional array that can be directly imported into an arbitrary waveform generator, where After the sampling step is set, each element in the one-dimensional array represents the signal value that lasts within the sampling step.
11. A quantum circuit compilation system, characterized in that: include: The acquisition module is configured to acquire a universal quantum circuit, including: acquiring the universal quantum circuit through a predefined quantum algorithm or a quantum programming tool, wherein: The universal quantum circuit includes an ordered set of multiple quantum bits and quantum operations, and the quantum gates used in the universal quantum circuit are universal quantum gates or universal quantum gates; The first compiling module is configured to compile the universal quantum circuit into an equivalent local quantum circuit, including: obtaining a local quantum gate set: identifying and obtaining a local quantum gate set suitable for a target quantum computer, the set including at least one set of universal quantum gates or universal quantum gates; compiling into an equivalent local quantum circuit: inputting a local quantum gate set to compile the universal quantum circuit into the local quantum circuit, wherein any quantum gate in the universal quantum circuit can be approximated to a preset accuracy by cascading elements in the local quantum gate set; A second compiling module is configured to compile each quantum gate in the local quantum circuit into a corresponding sub-waveform sequence tensor. The waveform sequence tensor of the local quantum circuit can be obtained by orderly splicing all the sub-waveform sequence tensors. Each sub-waveform sequence tensor is a parameterized representation of the underlying waveform data corresponding to the quantum gate; The conversion module is configured to convert the waveform sequence tensor into waveform data executable by the arbitrary waveform generator to complete the compilation.
12. A computer device, characterized in that: include: A memory storing executable program code; A processor, configured to call the executable program code to execute the method according to any one of claims 1 to 10.
13. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer storage medium runs on a computer, the computer executes the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
A computer implemented method for real time quantum compiling based on artificial intelligence
US20240169237A1
Quantum emulator
WO2023213958A1