[go: up one dir, main page]

CN110363301A - Quantum circuit processing method, device, storage medium and electronic device - Google Patents

Quantum circuit processing method, device, storage medium and electronic device Download PDF

Info

Publication number
CN110363301A
CN110363301A CN201910626565.3A CN201910626565A CN110363301A CN 110363301 A CN110363301 A CN 110363301A CN 201910626565 A CN201910626565 A CN 201910626565A CN 110363301 A CN110363301 A CN 110363301A
Authority
CN
China
Prior art keywords
quantum
logic gates
quantum logic
double
control bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910626565.3A
Other languages
Chinese (zh)
Other versions
CN110363301B (en
Inventor
窦猛汉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Benyuan Quantum Computing Technology Hefei Co ltd
Original Assignee
Hefei Native Quantum Computing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Native Quantum Computing Technology Co Ltd filed Critical Hefei Native Quantum Computing Technology Co Ltd
Publication of CN110363301A publication Critical patent/CN110363301A/en
Application granted granted Critical
Publication of CN110363301B publication Critical patent/CN110363301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Logic Circuits (AREA)

Abstract

本发明公开了一种量子线路的处理方法、装置、存储介质和电子装置。其中,该方法包括:在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。本发明解决了相关技术中不能实现对量子线路的两比特逻辑门进行转换的技术问题。

The invention discloses a quantum circuit processing method, device, storage medium and electronic device. Wherein, the method includes: when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, storing the control bit of the double quantum logic gate into a preset variable; The double quantum logic gate with the number of bits greater than or equal to 1 is decomposed to obtain the quantum logic gate with the number of control bits less than 1; the target quantum circuit is output, wherein the target quantum circuit includes the quantum logic gate with the number of control bits less than 1, and the target quantum The line supports the quantum chip instruction set. The invention solves the technical problem that the conversion of the two-bit logic gate of the quantum circuit cannot be realized in the related art.

Description

量子线路的处理方法、装置、存储介质和电子装置Quantum circuit processing method, device, storage medium and electronic device

本申请要求于2018年8月02日提交中国专利局、申请号为201810872386.3、发明名称为“量子线路的处理方法、装置、存储介质和电子装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 201810872386.3 and the title of the invention "quantum circuit processing method, device, storage medium and electronic device" submitted to the China Patent Office on August 02, 2018, the entire content of which is passed References are incorporated in this application.

技术领域technical field

本发明涉及通信领域,具体而言,涉及一种量子线路的处理方法、装置、存储介质和电子装置。The present invention relates to the communication field, in particular, to a quantum circuit processing method, device, storage medium and electronic device.

背景技术Background technique

量子芯片的指令集是量子芯片或量子比特所支持的量子操作的集合。其中包含量子比特所支持的单量子比特逻辑门的集合,两比特量子逻辑门的集合,量子芯片上量子比特的连接信息。The instruction set of a quantum chip is the collection of quantum operations supported by a quantum chip or qubit. It contains the collection of single-qubit logic gates supported by qubits, the collection of two-bit quantum logic gates, and the connection information of qubits on the quantum chip.

在实际的量子编程中,量子逻辑门的表示往往是高度参数化的,这意味着,类似的量子逻辑门有可能不属于该量子比特所支持的指令集。相关技术中可以实现分解任意单比特逻辑门到H,S,T门构成的集合中。但并不能分解两比特门的方案或其它更复杂(大于2量子比特)量子逻辑门的方案。并不能实现对量子线路的两比特逻辑门转换。In actual quantum programming, the representation of quantum logic gates is often highly parameterized, which means that similar quantum logic gates may not belong to the instruction set supported by the qubit. In the related art, it is possible to decompose any single-bit logic gate into a set composed of H, S, and T gates. But it does not break down the scheme of two-bit gates or other more complex (greater than 2 qubit) quantum logic gate schemes. The conversion of two-bit logic gates to quantum circuits cannot be realized.

针对上述的问题,目前尚未提出有效的解决方案。For the above problems, no effective solution has been proposed yet.

发明内容Contents of the invention

本发明实施例提供了一种量子线路的处理方法、装置、存储介质和电子装置,以至少解决相关技术中不能实现对量子线路的两比特逻辑门进行转换的技术问题。Embodiments of the present invention provide a quantum circuit processing method, device, storage medium and electronic device, to at least solve the technical problem in the related art that the two-bit logic gate of the quantum circuit cannot be converted.

根据本发明实施例的一个方面,提供了一种量子线路的处理方法,包括:在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将所述双量子逻辑门的控制比特存储到预设变量中;将所述预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出目标量子线路,其中,所述目标量子线路中包括控制比特数小于1的所述量子逻辑门,并且所述目标量子线路支持量子芯片指令集。According to an aspect of an embodiment of the present invention, a processing method for a quantum circuit is provided, including: when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by a single quantum logic gate, converting the double quantum logic gate The control bit of the gate is stored in a preset variable; the double quantum logic gate with a control bit number greater than or equal to 1 in the preset variable is decomposed to obtain a quantum logic gate with a control bit number less than 1; the target quantum circuit is output, wherein , the target quantum circuit includes the quantum logic gate whose control bit number is less than 1, and the target quantum circuit supports a quantum chip instruction set.

可选地,将所述双量子逻辑门的控制比特存储到所述预设变量中之前,所述方法还包括:转换所述待转换量子线路中的量子逻辑门,其中,转换后的量子逻辑门包括双量子逻辑门和单量子逻辑门。Optionally, before storing the control bit of the double quantum logic gate into the preset variable, the method further includes: converting the quantum logic gate in the quantum circuit to be converted, wherein the converted quantum logic Gates include dual quantum logic gates and single quantum logic gates.

可选地,转换所述待转换量子线路中的量子逻辑门包括:在所述量子逻辑门的形式大于所述双量子逻辑门的形式的情况下,将所述量子逻辑门的形式分解为所述双量子逻辑门和所述单量子逻辑门组合的形式。Optionally, converting the quantum logic gate in the quantum circuit to be converted includes: decomposing the form of the quantum logic gate into all The combination form of the double quantum logic gate and the single quantum logic gate.

可选地,将所述预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门,包括:遍历所述预设变量中控制比特数大于1或者等于1的双量子逻辑门;利用预设分解算法分解所述预设变量中控制比特数大于1的双量子逻辑门,得到控制比特数小于1的量子逻辑门。Optionally, decomposing the double quantum logic gates with the number of control bits greater than or equal to 1 in the preset variable to obtain the quantum logic gate with the number of control bits less than 1, including: traversing the number of control bits in the preset variable greater than 1 or a double quantum logic gate equal to 1; using a preset decomposition algorithm to decompose the double quantum logic gate with a control bit number greater than 1 in the preset variable, to obtain a quantum logic gate with a control bit number less than 1.

可选地,所述量子逻辑门包括:操作矩阵,控制比特,转置共轭标记。Optionally, the quantum logic gate includes: an operation matrix, a control bit, and a transpose conjugate mark.

可选地,所述量子芯片指令集包括:量子芯片的连接图,所述量子芯片连接图中与每个顶点所支持的单比特操作;所述量子芯片连接图中每个边所支持的双比特操作。Optionally, the quantum chip instruction set includes: the connection graph of the quantum chip, the single-bit operation supported by each vertex in the connection graph of the quantum chip; the dual operation supported by each edge in the connection graph of the quantum chip bit manipulation.

根据本发明的另一个实施例,还提供一种量子线路的处理装置,包括:存储模块,用于在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将所述双量子逻辑门的控制比特存储到预设变量中;分解模块,用于将所述预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出模块,用于输出目标量子线路,其中,所述目标量子线路中包括控制比特数小于1的所述量子逻辑门,并且所述目标量子线路支持量子芯片指令集。According to another embodiment of the present invention, there is also provided a quantum circuit processing device, including: a memory module, which is used to store The control bits of the double-quantum logic gate are stored in preset variables; the decomposition module is used to decompose the double-quantum logic gates whose number of control bits is greater than or equal to 1 in the preset variable to obtain the number of control bits less than 1 A quantum logic gate; an output module, configured to output a target quantum circuit, wherein the target quantum circuit includes the quantum logic gate whose control bit number is less than 1, and the target quantum circuit supports a quantum chip instruction set.

可选地,所述装置还包括:转换模块,用于将所述双量子逻辑门的控制比特存储到所述预设变量中之前,转换所述待转换量子线路中的量子逻辑门,其中,转换后的量子逻辑门包括双量子逻辑门和单量子逻辑门。Optionally, the device further includes: a conversion module, configured to convert the quantum logic gate in the quantum circuit to be converted before storing the control bit of the double quantum logic gate into the preset variable, wherein, The converted quantum logic gates include double quantum logic gates and single quantum logic gates.

可选地,所述转换模块包括:第一分解单元,用于在所述量子逻辑门的形式大于所述双量子逻辑门的形式的情况下,将所述量子逻辑门的形式分解为所述双量子逻辑门和所述单量子逻辑门组合的形式。Optionally, the conversion module includes: a first decomposition unit, configured to decompose the form of the quantum logic gate into the form of the quantum logic gate when the form of the quantum logic gate is larger than the form of the double quantum logic gate Combination forms of double quantum logic gates and said single quantum logic gates.

可选地,所述分解模块包括:遍历单元,用于遍历所述预设变量中控制比特数大于1或者等于1的双量子逻辑门;第二分解单元,用于利用预设分解算法分解所述预设变量中控制比特数大于1的双量子逻辑门,得到控制比特数小于1的量子逻辑门。Optionally, the decomposition module includes: a traversal unit for traversing the double quantum logic gates whose control bit number is greater than 1 or equal to 1 in the preset variable; a second decomposition unit for decomposing the The double quantum logic gate with the number of control bits greater than 1 in the preset variable is obtained to obtain the quantum logic gate with the number of control bits less than 1.

根据本发明的另一个实施例,还提供一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述中的方法。According to another embodiment of the present invention, a storage medium is further provided, and a computer program is stored in the storage medium, wherein the computer program is configured to execute the above method when running.

根据本发明的另一个实施例,还提供一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述中的方法。According to another embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above method.

在本发明实施例中,采用在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。达到了将量子线路中所有不支持量子芯片指令集中的量子逻辑门转换为量子芯片指令集中所支持的量子逻辑门的目的,从而实现了将量子线路适配到任意的量子芯片指令集的技术效果,进而解决了相关技术中不能实现对量子线路的两比特逻辑门进行转换的技术问题。In the embodiment of the present invention, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, the control bit of the double quantum logic gate is stored in the preset variable; the preset variable Decompose the double quantum logic gate with the number of control bits greater than or equal to 1 to obtain the quantum logic gate with the number of control bits less than 1; output the target quantum circuit, wherein the target quantum circuit includes the quantum logic gate with the number of control bits less than 1, and The target quantum circuit supports the quantum chip instruction set. Achieved the goal of converting all quantum logic gates in the quantum circuit that do not support the quantum chip instruction set into quantum logic gates supported by the quantum chip instruction set, thus achieving the technical effect of adapting the quantum circuit to any quantum chip instruction set , and then solve the technical problem that the conversion of the two-bit logic gate of the quantum circuit cannot be realized in the related technology.

附图说明Description of drawings

此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described here are used to provide a further understanding of the present invention and constitute a part of the application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations to the present invention. In the attached picture:

图1是本发明实施例的一种量子线路的处理方法的移动终端的硬件结构框图;Fig. 1 is a block diagram of the hardware structure of a mobile terminal of a quantum circuit processing method according to an embodiment of the present invention;

图2是根据本发明实施例提供的量子线路的处理方法的流程示意图;2 is a schematic flowchart of a quantum circuit processing method provided according to an embodiment of the present invention;

图3是本实施例的算法流程图;Fig. 3 is the algorithm flowchart of the present embodiment;

图4是根据本发明实施例提供的量子线路的处理装置的结构示意图。Fig. 4 is a schematic structural diagram of a quantum circuit processing device provided according to an embodiment of the present invention.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is an embodiment of a part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first" and "second" in the description and claims of the present invention and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

根据本发明实施例,提供了一种量子线路的处理方法的实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。According to an embodiment of the present invention, an embodiment of a quantum circuit processing method is provided. It should be noted that the steps shown in the flow charts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and , although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that shown or described herein.

本发明实施例所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在移动终端上为例,图1是本发明实施例的一种量子线路的处理方法的移动终端的硬件结构框图。如图1所示,移动终端10可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,可选地,上述移动终端还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述移动终端的结构造成限定。例如,移动终端10还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiments provided by the embodiments of the present invention can be executed in mobile terminals, computer terminals or similar computing devices. Taking a mobile terminal as an example, FIG. 1 is a block diagram of a hardware structure of a mobile terminal according to a quantum circuit processing method according to an embodiment of the present invention. As shown in FIG. 1, the mobile terminal 10 may include one or more (only one is shown in FIG. 1) processors 102 (the processors 102 may include but not limited to processing devices such as microprocessor MCU or programmable logic device FPGA, etc. ) and a memory 104 for storing data. Optionally, the above-mentioned mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. Those skilled in the art can understand that the structure shown in FIG. 1 is only for illustration, and it does not limit the structure of the above mobile terminal. For example, the mobile terminal 10 may also include more or fewer components than those shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .

存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如本发明实施例中的量子线路的处理方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至移动终端10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the quantum circuit processing method in the embodiment of the present invention, and the processor 102 runs the computer program stored in the memory 104, thereby Executing various functional applications and data processing is to realize the above-mentioned method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory that is remotely located relative to the processor 102, and these remote memories may be connected to the mobile terminal 10 through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括移动终端10的通信供应商提供的无线网络。在一个实例中,传输装置106包括一个网络适配器(Network Interface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输装置106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。The transmission device 106 is used to receive or transmit data via a network. The specific example of the above-mentioned network may include a wireless network provided by the communication provider of the mobile terminal 10 . In one example, the transmission device 106 includes a network interface controller (NIC for short), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (Radio Frequency, RF for short) module, which is used to communicate with the Internet in a wireless manner.

图2是根据本发明实施例提供的量子线路的处理方法的流程示意图,如图2所示,该方法包括如下步骤:Fig. 2 is a schematic flowchart of a quantum circuit processing method provided according to an embodiment of the present invention. As shown in Fig. 2, the method includes the following steps:

步骤S202,在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;Step S202, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, storing the control bit of the double quantum logic gate into a preset variable;

步骤S204,将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;Step S204, decomposing the double quantum logic gates whose number of control bits is greater than or equal to 1 in the preset variable, to obtain quantum logic gates whose number of control bits is less than 1;

步骤S206,输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。Step S206, outputting a target quantum circuit, wherein the target quantum circuit includes a quantum logic gate with a control bit number less than 1, and the target quantum circuit supports a quantum chip instruction set.

通过上述步骤,采用在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。达到了将量子线路中所有不支持量子芯片指令集中的量子逻辑门转换为量子芯片指令集中所支持的量子逻辑门的目的,从而实现了将量子线路适配到任意的量子芯片指令集的技术效果,进而解决了相关技术中不能实现对量子线路的两比特逻辑门进行转换的技术问题。Through the above steps, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, the control bit of the double quantum logic gate is stored in the preset variable; the control bit in the preset variable The double quantum logic gate whose number is greater than or equal to 1 is decomposed to obtain the quantum logic gate whose control bit number is less than 1; output the target quantum circuit, wherein, the target quantum circuit includes the quantum logic gate whose control bit number is less than 1, and the target quantum circuit Support quantum chip instruction set. Achieved the goal of converting all quantum logic gates in the quantum circuit that do not support the quantum chip instruction set into quantum logic gates supported by the quantum chip instruction set, thus achieving the technical effect of adapting the quantum circuit to any quantum chip instruction set , and then solve the technical problem that the conversion of the two-bit logic gate of the quantum circuit cannot be realized in the related technology.

需要说明的是,上述中的执行主体可以是计算机程序,但不限于此。It should be noted that the execution subject mentioned above may be a computer program, but is not limited thereto.

在本实施例中,待转换量子线路中包括不支持量子芯片指令集的量子逻辑门,即包括两比特逻辑门或者是大于两比特的逻辑门。本实施例的表现形式是一段计算机程序,包括输入的待转化的量子线路和量子芯片指令集,输出的是转化后的量子线路(即目标量子线路),包括1个或多个按顺序排列的量子逻辑门。In this embodiment, the quantum circuits to be converted include quantum logic gates that do not support the quantum chip instruction set, that is, include two-bit logic gates or logic gates greater than two bits. The expression form of this embodiment is a piece of computer program, including the input quantum circuit to be converted and the quantum chip instruction set, and the output is the converted quantum circuit (that is, the target quantum circuit), including one or more sequentially arranged Quantum logic gates.

可选地,输入的待转化的量子线路以及目标量子线路的表现形式可以是一个链表,数组,JS对象简谱(JavaScript Object Notation,简称为JSON)字符串等等。此外,量子线路是由量子逻辑门组成的,其中每一个量子逻辑门包含三个信息:操作矩阵,控制比特,转置共轭标记。Optionally, the representation form of the input quantum circuit to be converted and the target quantum circuit may be a linked list, an array, a string of JavaScript Object Notation (JSON for short) and the like. In addition, quantum circuits are composed of quantum logic gates, where each quantum logic gate contains three pieces of information: an operation matrix, control bits, and a transpose-conjugate label.

可选地,本实施例在将双量子逻辑门的控制比特存储到预设变量中之前,还包括转换待转换量子线路中的量子逻辑门,其中,转换后的量子逻辑门包括双量子逻辑门和单量子逻辑门。在量子逻辑门的形式大于双量子逻辑门的形式的情况下,将量子逻辑门的形式分解为双量子逻辑门和单量子逻辑门组合的形式。例如,操作矩阵假定以最多4×4的形式给出,若大于4×4的矩阵,对每一个这样的矩阵,预先执行分解算法,将它分解到最多4×4的矩阵。分解算法可以根据“任意矩阵可以分成2×2的矩阵和4×4的矩阵组合”的公知技术进行设置,由于任意矩阵可以分成2×2的矩阵和4×4的矩阵组合,因此构造4×4矩阵,完全是可以通过2×2和4×4的矩阵构造(实际就是控制非门(Controlled Not Gate,简称为CNOT)门与单比特量子门是通用门,任意门都可以转化成这两类门的组合)。Optionally, this embodiment also includes converting the quantum logic gates in the quantum circuit to be converted before storing the control bits of the double quantum logic gates in the preset variable, wherein the converted quantum logic gates include double quantum logic gates and single quantum logic gates. In the case that the form of the quantum logic gate is larger than the form of the double quantum logic gate, the form of the quantum logic gate is decomposed into the form of the combination of the double quantum logic gate and the single quantum logic gate. For example, the operation matrix is assumed to be given in the form of at most 4×4. If the matrix is larger than 4×4, for each such matrix, the decomposition algorithm is executed in advance to decompose it into a matrix of at most 4×4. The decomposition algorithm can be set according to the known technology that "arbitrary matrix can be divided into 2×2 matrix and 4×4 matrix combination”. Since any matrix can be divided into 2×2 matrix and 4×4 matrix combination, the 4× 4 matrices can be completely constructed by 2×2 and 4×4 matrices (actually, the Controlled Not Gate (CNOT) gate and the single-bit quantum gate are general-purpose gates, and any gate can be converted into these two combination of categories).

本实施例中的预设变量可以是自定义的ControlQubitVec向量,用来指明控制量子比特向量,也可以是其他的向量。The preset variable in this embodiment may be a custom ControlQubitVec vector used to indicate the control qubit vector, or may be other vectors.

可选地,通过以下方式将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门:遍历预设变量中控制比特数大于1或者等于1的双量子逻辑门;利用预设分解算法分解预设变量中控制比特数大于1的双量子逻辑门,得到控制比特数小于1的量子逻辑门。控制比特数大于1的双量子逻辑门是指所有操作矩阵不是C-U的逻辑门,控制比特数小于1的量子逻辑门是C-U的量子逻辑门和/或单量子比特门。遍历所有操作矩阵为4×4的逻辑门,将所有操作矩阵不是C-U的逻辑门,转化为C-U的量子逻辑门和单量子比特门的组合。具体的,将所有操作矩阵不是C-U(控制酉变换,控制U门,例如CNOT是控制NOT门,CZ是控制Z门)的逻辑门,转化为C-U的量子逻辑门和单量子比特门的组合,其中,转化算法是公知技术,在此不做过多描述,在这一步过后,所有的4×4的量子逻辑门都是C-U类型操作。遍历所有ControlQubitVec.size()>1的逻辑门,执行“多比特控制门分解算法”,将逻辑门替换为ControlQubitVec.size()<=1的逻辑门表示的量子线路(这里实际就是转换成了通用量子逻辑门的形式了)。然后,遍历所有ControlQubitVec.size()==1的逻辑门。其中:多比特控制门分解算法为现有技术,可以起到减少量子逻辑门的复杂度的效果。本实施例所述的分解预设变量中控制比特数大于1的双量子逻辑门的分解算法和多比特控制门分解算法思想均可以根据Michael.A.Nielsen的《量子计算与量子信息》第四章内容结合计算机代码实现,故在此不做过多描述。Optionally, decompose the double quantum logic gate with the number of control bits greater than or equal to 1 in the preset variable in the following manner to obtain the quantum logic gate with the number of control bits less than 1: traverse the number of control bits in the preset variable greater than 1 or equal to A double quantum logic gate of 1; using a preset decomposition algorithm to decompose a double quantum logic gate with a control bit number greater than 1 in a preset variable, to obtain a quantum logic gate with a control bit number less than 1. The double quantum logic gate with the number of control bits greater than 1 refers to a logic gate whose operation matrix is not C-U, and the quantum logic gate with the number of control bits less than 1 is a C-U quantum logic gate and/or a single qubit gate. Traverse all logic gates whose operation matrix is 4×4, and convert all logic gates whose operation matrix is not C-U into a combination of C-U quantum logic gates and single-qubit gates. Specifically, all operation matrices are not C-U (control unitary transformation, control U gate, for example, CNOT is to control NOT gate, CZ is to control Z gate), and convert it into a combination of C-U quantum logic gate and single qubit gate, Among them, the conversion algorithm is a well-known technology, and it will not be described too much here. After this step, all 4×4 quantum logic gates are C-U type operations. Traverse all the logic gates of ControlQubitVec.size()>1, execute the "multi-bit control gate decomposition algorithm", and replace the logic gates with the quantum circuits represented by the logic gates of ControlQubitVec.size()<=1 (actually converted into in the form of universal quantum logic gates). Then, traverse all logic gates with ControlQubitVec.size()==1. Wherein: the multi-bit control gate decomposition algorithm is an existing technology, which can reduce the complexity of the quantum logic gate. In the decomposition preset variable described in this embodiment, the decomposition algorithm of the double quantum logic gate with the number of control bits greater than 1 and the multi-bit control gate decomposition algorithm idea can be based on Michael.A.Nielsen's "Quantum Computing and Quantum Information" No. 4 The content of this chapter is implemented in combination with computer codes, so it will not be described too much here.

可选地,量子芯片指令集包括:量子芯片的连接图,量子芯片连接图中与每个顶点所支持的单比特操作;量子芯片连接图中每个边所支持的双比特操作。Optionally, the quantum chip instruction set includes: a connection graph of the quantum chip, a single-bit operation supported by each vertex in the connection graph of the quantum chip, and a double-bit operation supported by each edge in the connection graph of the quantum chip.

量子线路中量子逻辑门不仅可以包含单比特门,还可以包含两比特门、多比特门。每个量子逻辑门还可以具有多个控制比特,以及转置共轭标记。生成的量子线路,是根据输入的量子芯片指令集进行适配的,其中每个量子逻辑门都是指令集中包含的元素,所以可以在芯片上进行运行。Quantum logic gates in quantum circuits can include not only single-bit gates, but also two-bit gates and multi-bit gates. Each quantum logic gate can also have multiple control bits, as well as transpose conjugate labels. The generated quantum circuit is adapted according to the input quantum chip instruction set, and each quantum logic gate is an element contained in the instruction set, so it can be run on the chip.

下面结合一个优选实施例对本发明进行详细说明:Below in conjunction with a preferred embodiment the present invention is described in detail:

本实施例的主要目的是将量子线路中,所有不支持量子芯片指令集中的量子逻辑门转换为量子芯片指令集中所支持的量子逻辑门。The main purpose of this embodiment is to convert all quantum logic gates in the quantum circuit that do not support the instruction set of the quantum chip into quantum logic gates supported by the instruction set of the quantum chip.

图3是本实施例的算法流程图,具体包括以下步骤:Fig. 3 is the algorithm flowchart of this embodiment, specifically comprises the following steps:

S301:算法开始,其表现形式是一段计算机程序(量子程序)。S301: The algorithm starts, and its manifestation is a piece of computer program (quantum program).

S302:量子程序具有的输入是【1.待转化的量子线路2.量子芯片指令集】,它具有的输出是【转化后的量子线路(1个或多个按顺序排列的量子逻辑门)】。S302: The input of the quantum program is [1. The quantum circuit to be converted 2. The instruction set of the quantum chip], and the output it has is [the converted quantum circuit (one or more quantum logic gates arranged in sequence)] .

输入的量子线路具有的表现形式可以是一个链表,数组,JSON字符串等等。该程序的输出为同样表现形式的量子线路。量子线路是由量子逻辑门组成的,其中每一个量子逻辑门包含三个信息:操作矩阵,控制比特,转置共轭标记。The input form of the quantum circuit can be a linked list, an array, a JSON string and so on. The output of this program is a quantum circuit in the same form. Quantum circuits are composed of quantum logic gates, and each quantum logic gate contains three pieces of information: operation matrix, control bit, and transpose conjugate label.

S303:操作矩阵假定以最多4×4的形式给出,若大于4×4的矩阵,对每一个这样的矩阵,预先执行分解算法,将它分解到最多4×4的矩阵。分解算法可以根据“任意矩阵可以分成2×2的矩阵和4×4的矩阵组合”的公知技术进行设置,由于任意矩阵可以分成2×2的矩阵和4×4的矩阵组合,因此构造4×4矩阵,完全是可以通过2×2和4×4的矩阵构造(实际就是CNOT门与单比特量子门是通用门,任意门都可以转化成这两类门的组合)。S303: The operation matrix is assumed to be given in the form of at most 4×4. If the matrix is larger than 4×4, for each such matrix, perform a decomposition algorithm in advance to decompose it into a matrix of at most 4×4. The decomposition algorithm can be set according to the known technology that "arbitrary matrix can be divided into 2×2 matrix and 4×4 matrix combination”. Since any matrix can be divided into 2×2 matrix and 4×4 matrix combination, the 4× 4 matrices can be constructed through 2×2 and 4×4 matrices (actually, CNOT gates and single-bit quantum gates are universal gates, and any gate can be converted into a combination of these two types of gates).

S304-S305:遍历所有操作矩阵为4×4的逻辑门,将所有操作矩阵不是C-U(控制酉变换,控制U门,例如CNOT是控制NOT门,CZ是控制Z门)的逻辑门,转化为C-U的量子逻辑门和单量子比特门的组合。在这一步过后,所有的4×4的量子逻辑门都是C-U类型操作。S304-S305: traverse all logic gates whose operation matrix is 4×4, and convert all logic gates whose operation matrix is not C-U (control unitary transformation, control U gate, such as CNOT is to control NOT gate, CZ is to control Z gate) into C-U's combination of quantum logic gates and single-qubit gates. After this step, all 4×4 quantum logic gates are C-U type operations.

S306-S308:对所有4×4的逻辑门,将C-U操作中的控制比特移动到ControlQubitVec中(若不存在,则建立一个ControlQubitVec),将C-U操作中的U(被控制执行的矩阵)矩阵作为新的操作矩阵。该步结束后,所有的量子逻辑门的操作矩阵都为2×2的。S306-S308: For all 4×4 logic gates, move the control bits in the C-U operation to ControlQubitVec (if it does not exist, set up a ControlQubitVec), and use the U (controlled matrix) matrix in the C-U operation as New operation matrix. After this step ends, the operation matrix of all quantum logic gates is 2×2.

S309-S310:遍历所有ControlQubitVec.size()>1的逻辑门,执行“多比特控制门分解算法”,将逻辑门替换为ControlQubitVec.size()<=1的逻辑门表示的量子线路(这里实际就是转换成了通用量子逻辑门的形式了)。S309-S310: traverse all the logic gates of ControlQubitVec.size()>1, execute the "multi-bit control gate decomposition algorithm", and replace the logic gates with the quantum circuits represented by the logic gates of ControlQubitVec.size()<=1 (the actual It is converted into the form of a universal quantum logic gate).

S311:遍历所有ControlQubitVec.size()==1的逻辑门,参考专利201811082315.X,申请日2018年09月17日,名称:两量子比特逻辑门的处理方法及装置,将逻辑门和量子指令集作为输入,执行参考专利201811082315.X图4中所示的算法,用每个输出的量子线路替换该单比特门。这里逻辑门的操作矩阵为2×2矩阵,并且包含一个控制比特,因此整体为两比特操作。可以利用该专利的方案,直接转换为指令集中的两比特门,并且这里的两比特门表示为4×4矩阵。这一步结束后,ControlQubitVec.size()==0必定为真,操作矩阵包含4×4和2×2的形式,并且,所有的4×4的操作矩阵,一定是满足量子指令集的两比特操作。S311: Traverse all logic gates with ControlQubitVec.size()==1, refer to patent 201811082315.X, application date: September 17, 2018, name: processing method and device for two-qubit logic gates, combining logic gates and quantum instructions Set as input, execute the algorithm shown in Figure 4 of reference patent 201811082315.X, and replace the single-bit gate with a quantum circuit for each output. Here, the operation matrix of the logic gate is a 2×2 matrix, and contains one control bit, so the whole is a two-bit operation. The scheme of this patent can be directly converted into a two-bit gate in the instruction set, and the two-bit gate here is expressed as a 4×4 matrix. After this step, ControlQubitVec.size()==0 must be true, the operation matrix contains 4×4 and 2×2 forms, and all 4×4 operation matrices must satisfy the two bits of the quantum instruction set operate.

S312:将量子线路输入到优化算法中,可以得到一种较为优化的表示。可以优化生成的量子线路,减少最终量子线路中的逻辑门。S312: Inputting the quantum circuit into the optimization algorithm can obtain a relatively optimized representation. The resulting quantum circuit can be optimized to reduce the number of logic gates in the final quantum circuit.

S313-S314:输出量子线路,算法结束。S313-S314: Output the quantum circuit, and the algorithm ends.

由上述可知,本实施例可以将任意的量子线路,适配到任意的量子芯片指令集上。It can be known from the above that in this embodiment, any quantum circuit can be adapted to any quantum chip instruction set.

需要说明的是,上述步骤的执行主体可以是上述图1所示的终端,但并不限于此。It should be noted that the execution subject of the above steps may be the terminal shown in FIG. 1 above, but is not limited thereto.

本发明实施例还提供了一种量子线路的处理装置,图4是根据本发明实施例提供的量子线路的处理装置的结构示意图,如图4所示,该装置包括:An embodiment of the present invention also provides a quantum circuit processing device. FIG. 4 is a schematic structural diagram of a quantum circuit processing device provided according to an embodiment of the present invention. As shown in FIG. 4 , the device includes:

存储模块42,用于在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;The storage module 42 is used to store the control bit of the double quantum logic gate in the preset variable when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate;

分解模块44,用于将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;The decomposition module 44 is used to decompose the double quantum logic gate with the number of control bits greater than or equal to 1 in the preset variable to obtain the quantum logic gate with the number of control bits less than 1;

输出模块46,用于输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。The output module 46 is configured to output the target quantum circuit, wherein the target quantum circuit includes a quantum logic gate whose control bit number is less than 1, and the target quantum circuit supports a quantum chip instruction set.

通过上述装置,采用在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。达到了将量子线路中所有不支持量子芯片指令集中的量子逻辑门转换为量子芯片指令集中所支持的量子逻辑门的目的,从而实现了将量子线路适配到任意的量子芯片指令集的技术效果,进而解决了相关技术中不能实现对量子线路的两比特逻辑门进行转换的技术问题。Through the above device, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, the control bit of the double quantum logic gate is stored in the preset variable; the control bit in the preset variable The double quantum logic gate whose number is greater than or equal to 1 is decomposed to obtain the quantum logic gate whose control bit number is less than 1; output the target quantum circuit, wherein, the target quantum circuit includes the quantum logic gate whose control bit number is less than 1, and the target quantum circuit Support quantum chip instruction set. Achieved the goal of converting all quantum logic gates in the quantum circuit that do not support the quantum chip instruction set into quantum logic gates supported by the quantum chip instruction set, thus achieving the technical effect of adapting the quantum circuit to any quantum chip instruction set , and then solve the technical problem that the conversion of the two-bit logic gate of the quantum circuit cannot be realized in the related technology.

在一个可选的实施例中,上述装置还包括转换模块,用于将双量子逻辑门的控制比特存储到预设变量中之前,转换待转换量子线路中的量子逻辑门,其中,转换后的量子逻辑门包括双量子逻辑门和单量子逻辑门。转换模块包括:第一分解单元,用于在量子逻辑门的形式大于双量子逻辑门的形式的情况下,将量子逻辑门的形式分解为双量子逻辑门和单量子逻辑门组合的形式。In an optional embodiment, the above-mentioned device further includes a conversion module, which is used to convert the quantum logic gate in the quantum circuit to be converted before storing the control bits of the double quantum logic gate into preset variables, wherein the converted Quantum logic gates include double quantum logic gates and single quantum logic gates. The conversion module includes: a first decomposing unit, used for decomposing the form of the quantum logic gate into the combination form of the double quantum logic gate and the single quantum logic gate when the form of the quantum logic gate is larger than that of the double quantum logic gate.

在一个可选的实施例中,分解模块包括:遍历单元,用于遍历预设变量中控制比特数大于1或者等于1的双量子逻辑门;第二分解单元,用于利用预设分解算法分解预设变量中控制比特数大于1的双量子逻辑门,得到控制比特数小于1的量子逻辑门。In an optional embodiment, the decomposition module includes: a traversal unit for traversing the double quantum logic gates whose control bit number is greater than 1 or equal to 1 in the preset variable; a second decomposition unit for decomposing The double quantum logic gate whose control bit number is greater than 1 in the preset variable obtains the quantum logic gate whose control bit number is less than 1.

在本实施例中,待转换量子线路中包括不支持量子芯片指令集的量子逻辑门,即包括两比特逻辑门或者是大于两比特的逻辑门。本实施例的表现形式是一段计算机程序,包括输入的待转化的量子线路和量子芯片指令集,输出的是转化后的量子线路(即目标量子线路),包括1个或多个按顺序排列的量子逻辑门。In this embodiment, the quantum circuits to be converted include quantum logic gates that do not support the quantum chip instruction set, that is, include two-bit logic gates or logic gates greater than two bits. The expression form of this embodiment is a piece of computer program, including the input quantum circuit to be converted and the quantum chip instruction set, and the output is the converted quantum circuit (that is, the target quantum circuit), including one or more sequentially arranged Quantum logic gates.

可选地,输入的待转化的量子线路以及目标量子线路的表现形式可以是一个链表,数组,JS对象简谱(JavaScript Object Notation,简称为JSON)字符串等等。此外,量子线路是由量子逻辑门组成的,其中每一个量子逻辑门包含三个信息:操作矩阵,控制比特,转置共轭标记。Optionally, the representation form of the input quantum circuit to be converted and the target quantum circuit may be a linked list, an array, a string of JavaScript Object Notation (JSON for short) and the like. In addition, quantum circuits are composed of quantum logic gates, where each quantum logic gate contains three pieces of information: an operation matrix, control bits, and a transpose-conjugate label.

可选地,本实施例在将双量子逻辑门的控制比特存储到预设变量中之前,还包括转换待转换量子线路中的量子逻辑门,其中,转换后的量子逻辑门包括双量子逻辑门和单量子逻辑门。在量子逻辑门的形式大于双量子逻辑门的形式的情况下,将量子逻辑门的形式分解为双量子逻辑门和单量子逻辑门组合的形式。例如,操作矩阵假定以最多4×4的形式给出,若大于4×4的矩阵,对每一个这样的矩阵,预先执行分解算法,将它分解到最多4×4的矩阵。分解算法可以根据“任意矩阵可以分成2×2的矩阵和4×4的矩阵组合”的公知技术进行设置,由于任意矩阵可以分成2×2的矩阵和4×4的矩阵组合,因此构造4×4矩阵,完全是可以通过2×2和4×4的矩阵构造(实际就是CNOT门与单比特量子门是通用门,任意门都可以转化成这两类门的组合)。Optionally, this embodiment also includes converting the quantum logic gates in the quantum circuit to be converted before storing the control bits of the double quantum logic gates in the preset variable, wherein the converted quantum logic gates include double quantum logic gates and single quantum logic gates. In the case that the form of the quantum logic gate is larger than the form of the double quantum logic gate, the form of the quantum logic gate is decomposed into the form of the combination of the double quantum logic gate and the single quantum logic gate. For example, the operation matrix is assumed to be given in the form of at most 4×4. If the matrix is larger than 4×4, for each such matrix, the decomposition algorithm is executed in advance to decompose it into a matrix of at most 4×4. The decomposition algorithm can be set according to the known technology that "arbitrary matrix can be divided into 2×2 matrix and 4×4 matrix combination”. Since any matrix can be divided into 2×2 matrix and 4×4 matrix combination, the 4× 4 matrices can be constructed through 2×2 and 4×4 matrices (actually, CNOT gates and single-bit quantum gates are universal gates, and any gate can be converted into a combination of these two types of gates).

本实施例中的预设变量可以是自定义的ControlQubitVec向量,用来指明控制量子比特向量,也可以是其他的向量。The preset variable in this embodiment may be a custom ControlQubitVec vector used to indicate the control qubit vector, or may be other vectors.

可选地,通过以下方式将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门:遍历预设变量中控制比特数大于1或者等于1的双量子逻辑门;利用预设分解算法分解预设变量中控制比特数大于1的双量子逻辑门,得到控制比特数小于1的量子逻辑门。例如:遍历所有操作矩阵为4×4的逻辑门,将所有操作矩阵不是C-U的逻辑门,转化为C-U的量子逻辑门和单量子比特门的组合。在这一步过后,所有的4×4的量子逻辑门都是C-U类型操作。遍历所有ControlQubitVec.size()>1的逻辑门,执行“多比特控制门分解算法”,将逻辑门替换为ControlQubitVec.size()<=1的逻辑门表示的量子线路(这里实际就是转换成了通用量子逻辑门的形式了)。然后,遍历所有ControlQubitVec.size()==1的逻辑门。Optionally, decompose the double quantum logic gate with the number of control bits greater than or equal to 1 in the preset variable in the following manner to obtain the quantum logic gate with the number of control bits less than 1: traverse the number of control bits in the preset variable greater than 1 or equal to A double quantum logic gate of 1; using a preset decomposition algorithm to decompose a double quantum logic gate with a control bit number greater than 1 in a preset variable, to obtain a quantum logic gate with a control bit number less than 1. For example: traverse all logic gates whose operation matrix is 4×4, and convert all logic gates whose operation matrix is not C-U into a combination of C-U quantum logic gates and single-qubit gates. After this step, all 4×4 quantum logic gates are C-U type operations. Traverse all the logic gates of ControlQubitVec.size()>1, execute the "multi-bit control gate decomposition algorithm", and replace the logic gates with the quantum circuits represented by the logic gates of ControlQubitVec.size()<=1 (actually converted into in the form of universal quantum logic gates). Then, traverse all logic gates with ControlQubitVec.size()==1.

可选地,量子芯片指令集包括:量子芯片的连接图,量子芯片连接图中与每个顶点所支持的单比特操作;量子芯片连接图中每个边所支持的双比特操作。Optionally, the quantum chip instruction set includes: a connection graph of the quantum chip, a single-bit operation supported by each vertex in the connection graph of the quantum chip, and a double-bit operation supported by each edge in the connection graph of the quantum chip.

量子线路中量子逻辑门不仅可以包含单比特门,还可以包含两比特门、多比特门。每个量子逻辑门还可以具有多个控制比特,以及转置共轭标记。生成的量子线路,是根据输入的量子芯片指令集进行适配的,其中每个量子逻辑门都是指令集中包含的元素,所以可以在芯片上进行运行。Quantum logic gates in quantum circuits can include not only single-bit gates, but also two-bit gates and multi-bit gates. Each quantum logic gate can also have multiple control bits, as well as transpose conjugate labels. The generated quantum circuit is adapted according to the input quantum chip instruction set, and each quantum logic gate is an element contained in the instruction set, so it can be run on the chip.

需要说明的是,上述装置可以位于上述图1所示的终端中,但并不限于此。It should be noted that the foregoing apparatus may be located in the terminal shown in FIG. 1 above, but is not limited thereto.

本发明的实施例还提供了一种存储介质,该存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。An embodiment of the present invention also provides a storage medium, in which a computer program is stored, wherein the computer program is set to execute the steps in any one of the above method embodiments when running.

可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的计算机程序:Optionally, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:

S1,在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;S1, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, storing the control bit of the double quantum logic gate into a preset variable;

S2,将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;S2, decomposing the double quantum logic gate with the number of control bits greater than or equal to 1 in the preset variable to obtain the quantum logic gate with the number of control bits less than 1;

S3,输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。S3, outputting a target quantum circuit, wherein the target quantum circuit includes a quantum logic gate with a control bit number less than 1, and the target quantum circuit supports a quantum chip instruction set.

可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。Optionally, in this embodiment, the above-mentioned storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), Various media that can store computer programs, such as removable hard disks, magnetic disks, or optical disks.

本发明的实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。An embodiment of the present invention also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.

可选地,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Optionally, the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.

可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:

S1,在待转换量子线路中的双量子逻辑门的操作受到单量子逻辑门控制的情况下,将双量子逻辑门的控制比特存储到预设变量中;S1, when the operation of the double quantum logic gate in the quantum circuit to be converted is controlled by the single quantum logic gate, storing the control bit of the double quantum logic gate into a preset variable;

S2,将预设变量中控制比特数大于或者等于1的双量子逻辑门进行分解,得到控制比特数小于1的量子逻辑门;S2, decomposing the double quantum logic gate with the number of control bits greater than or equal to 1 in the preset variable to obtain the quantum logic gate with the number of control bits less than 1;

S3,输出目标量子线路,其中,目标量子线路中包括控制比特数小于1的量子逻辑门,并且目标量子线路支持量子芯片指令集。S3, outputting a target quantum circuit, wherein the target quantum circuit includes a quantum logic gate with a control bit number less than 1, and the target quantum circuit supports a quantum chip instruction set.

可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementation manners, and details are not repeated in this embodiment.

上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present invention are for description only, and do not represent the advantages and disadvantages of the embodiments.

在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed technical content can be realized in other ways. Wherein, the device embodiments described above are only illustrative. For example, the division of the units may be a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or may be Integrate into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of units or modules may be in electrical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes. .

以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that, for those of ordinary skill in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications can also be made. It should be regarded as the protection scope of the present invention.

Claims (12)

1. a kind of processing method of quantum wire characterized by comprising
It, will be described in the case that the operation of double Quantum logic gates in quantum wire to be converted is controlled by single Quantum logic gates The control bit of double Quantum logic gates is stored into design variables;
Double Quantum logic gates by control bit number in the design variables more than or equal to 1 are decomposed, and control ratio is obtained Quantum logic gates of the special number less than 1;
Export target quantum wire, wherein include the quantum logic of the control bit number less than 1 in the target quantum wire Door, and the target quantum wire supports quantum chip instruction set.
2. the method according to claim 1, wherein by the control bit storage of double Quantum logic gates to institute Before stating in design variables, the method also includes:
Convert the Quantum logic gates in the quantum wire to be converted, wherein the Quantum logic gates after conversion include that double quantum are patrolled Collect door and single Quantum logic gates.
3. according to the method described in claim 2, it is characterized in that, converting the Quantum logic gates in the quantum wire to be converted Include:
In the case where the form of the Quantum logic gates is greater than the form of double Quantum logic gates, by the Quantum logic gates Form be decomposed into the forms of double Quantum logic gates and single Quantum logic gates combination.
4. the method according to claim 1, wherein control bit number in the design variables to be greater than or wait Double Quantum logic gates in 1 are decomposed, and Quantum logic gates of the control bit number less than 1 are obtained, comprising:
It traverses control bit number in the design variables and is greater than 1 or double Quantum logic gates equal to 1;
Double Quantum logic gates that control bit number in the design variables is greater than 1 are decomposed using preset decomposition algorithm, are controlled Quantum logic gates of the bit number less than 1.
5. the method according to claim 1, wherein the Quantum logic gates include:
Operation matrix, control bit, transposition conjugation label.
6. the method according to claim 1, wherein the quantum chip instruction set includes:
The connection figure of quantum chip, the single-bit supported in the quantum chip connection figures with each vertex operate;The amount The dibit operation that each side is supported in sub- chip connection figures.
7. a kind of processing unit of quantum wire characterized by comprising
Memory module, what the operation for double Quantum logic gates in quantum wire to be converted was controlled by single Quantum logic gates In the case of, the control bit of double Quantum logic gates is stored into design variables;
Decomposing module is divided for double Quantum logic gates by control bit number in the design variables more than or equal to 1 Solution, obtains Quantum logic gates of the control bit number less than 1;
Output module, for exporting target quantum wire, wherein include control bit number in the target quantum wire less than 1 The Quantum logic gates, and the target quantum wire support quantum chip instruction set.
8. device according to claim 7, which is characterized in that described device further include:
Conversion module, for converting institute before storing the control bit of double Quantum logic gates into the design variables State the Quantum logic gates in quantum wire to be converted, wherein the Quantum logic gates after conversion include double Quantum logic gates and single amount Sub- logic gate.
9. device according to claim 8, which is characterized in that the conversion module includes:
First decomposition unit, for the form in the Quantum logic gates be greater than double Quantum logic gates form the case where Under, the form of the Quantum logic gates is decomposed into the form of double Quantum logic gates and single Quantum logic gates combination.
10. device according to claim 7, which is characterized in that the decomposing module includes:
Traversal Unit is greater than 1 or double Quantum logic gates equal to 1 for traversing control bit number in the design variables;
Second decomposition unit, for decomposing double amounts that control bit number in the design variables is greater than 1 using preset decomposition algorithm Sub- logic gate obtains Quantum logic gates of the control bit number less than 1.
11. a kind of storage medium, which is characterized in that be stored with computer program in the storage medium, wherein the computer Program is arranged to execute method described in any one of claim 1 to 6 when operation.
12. a kind of electronic device, including memory and processor, which is characterized in that be stored with computer journey in the memory Sequence, the processor are arranged to run the computer program to execute side described in any one of claim 1 to 6 Method.
CN201910626565.3A 2018-08-02 2019-07-11 Quantum line processing method, quantum line processing device, storage medium, and electronic device Active CN110363301B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2018108723863 2018-08-02
CN201810872386.3A CN109165741A (en) 2018-08-02 2018-08-02 Processing method, device, storage medium and the electronic device of quantum wire

Publications (2)

Publication Number Publication Date
CN110363301A true CN110363301A (en) 2019-10-22
CN110363301B CN110363301B (en) 2021-06-08

Family

ID=64898736

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201810872386.3A Pending CN109165741A (en) 2018-08-02 2018-08-02 Processing method, device, storage medium and the electronic device of quantum wire
CN201910626565.3A Active CN110363301B (en) 2018-08-02 2019-07-11 Quantum line processing method, quantum line processing device, storage medium, and electronic device

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201810872386.3A Pending CN109165741A (en) 2018-08-02 2018-08-02 Processing method, device, storage medium and the electronic device of quantum wire

Country Status (1)

Country Link
CN (2) CN109165741A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111461334A (en) * 2020-03-30 2020-07-28 北京百度网讯科技有限公司 Quantum circuit processing method, device and device
CN112073126A (en) * 2020-08-14 2020-12-11 合肥本源量子计算科技有限责任公司 Method and device for ordering network node importance
CN113222155A (en) * 2020-01-21 2021-08-06 合肥本源量子计算科技有限责任公司 Quantum line construction method and device, electronic device and storage medium
CN113934431A (en) * 2021-10-27 2022-01-14 中国人民解放军战略支援部队信息工程大学 A quantum program compilation method, device and electronic device
CN114970872A (en) * 2021-02-26 2022-08-30 合肥本源量子计算科技有限责任公司 Quantum line compiling method, device, medium, and electronic device
CN115618955A (en) * 2022-12-19 2023-01-17 量子科技长三角产业创新中心 A quantum circuit optimization method, device, equipment and storage medium

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109754087B (en) * 2019-01-11 2020-12-04 合肥本源量子计算科技有限责任公司 Quantum program transformation method, device and electronic device
CN109615079B (en) * 2019-01-30 2022-12-06 合肥本源量子计算科技有限责任公司 Quantum bit control signal generation system
US11783217B2 (en) * 2019-02-21 2023-10-10 IonQ, Inc. Quantum circuit optimization
CN109858628B (en) * 2019-02-28 2021-04-27 北京百度网讯科技有限公司 Method, apparatus, device, and computer-readable storage medium for compiling quantum circuits
CN110188885B (en) * 2019-06-28 2021-04-06 合肥本源量子计算科技有限责任公司 A quantum computing simulation method, device, storage medium and electronic device
CN110826719B (en) * 2019-10-14 2022-08-16 合肥本源量子计算科技有限责任公司 Quantum program processing method and device, storage medium and electronic device
CN111415011B (en) 2020-02-10 2022-04-26 北京百度网讯科技有限公司 Determination method, apparatus, device and readable storage medium for quantum pulse
CN114511089B (en) * 2020-10-23 2024-06-14 本源量子计算科技(合肥)股份有限公司 Quantum connectivity spectrum connectivity optimization method, device, terminal and storage medium
CN112230818A (en) * 2020-10-30 2021-01-15 合肥本源量子计算科技有限责任公司 A method and device for editing quantum logic gates at a terminal interface
EP4328808A4 (en) 2021-05-28 2024-11-06 Origin Quantum Computing Technology (Hefei) Co., Ltd METHOD AND DEVICE FOR PRODUCING A QUANTUM CIRCUIT CORRESPONDING TO A LINEAR FUNCTION
CN114970873A (en) * 2022-06-14 2022-08-30 浪潮集团有限公司 Method for inserting operation of three-bit gate in graphic programming in quantum computing cloud platform
CN117787424B (en) * 2023-12-20 2025-03-11 北京百度网讯科技有限公司 Quantum circuit processing method, device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8190553B2 (en) * 2007-12-20 2012-05-29 Routt Thomas J Methods and systems for quantum search, computation and memory
US20150186587A1 (en) * 2012-07-19 2015-07-02 Microsoft Technology Licensing, Llc Method and system for optimal decomposition of single-qubit quantum circuits using standard quantum gates
CN107977541A (en) * 2018-01-17 2018-05-01 合肥本源量子计算科技有限责任公司 A kind of method for optimizing quantum wire emulation
CN108334952A (en) * 2017-11-24 2018-07-27 南京航空航天大学 A kind of novel universal quantum door and quantum wire optimization method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8190553B2 (en) * 2007-12-20 2012-05-29 Routt Thomas J Methods and systems for quantum search, computation and memory
US20150186587A1 (en) * 2012-07-19 2015-07-02 Microsoft Technology Licensing, Llc Method and system for optimal decomposition of single-qubit quantum circuits using standard quantum gates
CN108334952A (en) * 2017-11-24 2018-07-27 南京航空航天大学 A kind of novel universal quantum door and quantum wire optimization method
CN107977541A (en) * 2018-01-17 2018-05-01 合肥本源量子计算科技有限责任公司 A kind of method for optimizing quantum wire emulation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵千川: "《量子计算和量子信息》", 31 January 2004 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113222155A (en) * 2020-01-21 2021-08-06 合肥本源量子计算科技有限责任公司 Quantum line construction method and device, electronic device and storage medium
CN113222155B (en) * 2020-01-21 2023-08-11 本源量子计算科技(合肥)股份有限公司 Quantum circuit construction method and device, electronic device and storage medium
CN111461334A (en) * 2020-03-30 2020-07-28 北京百度网讯科技有限公司 Quantum circuit processing method, device and device
CN112073126A (en) * 2020-08-14 2020-12-11 合肥本源量子计算科技有限责任公司 Method and device for ordering network node importance
CN114970872A (en) * 2021-02-26 2022-08-30 合肥本源量子计算科技有限责任公司 Quantum line compiling method, device, medium, and electronic device
CN114970872B (en) * 2021-02-26 2024-06-14 本源量子计算科技(合肥)股份有限公司 Quantum circuit compiling method and device, medium and electronic device
CN113934431A (en) * 2021-10-27 2022-01-14 中国人民解放军战略支援部队信息工程大学 A quantum program compilation method, device and electronic device
CN115618955A (en) * 2022-12-19 2023-01-17 量子科技长三角产业创新中心 A quantum circuit optimization method, device, equipment and storage medium
CN115618955B (en) * 2022-12-19 2023-04-07 量子科技长三角产业创新中心 Quantum line optimization method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110363301B (en) 2021-06-08
CN109165741A (en) 2019-01-08

Similar Documents

Publication Publication Date Title
CN110363301A (en) Quantum circuit processing method, device, storage medium and electronic device
US8972237B2 (en) Optimizing quantum simulations by intelligent permutation
CN114764549B (en) Quantum circuit simulation calculation method and device based on matrix product state
CN112633508A (en) Quantum line generation method and device, storage medium and electronic device
CN105068854B (en) A kind of method that the control to different product is realized using same rule
CN111832564A (en) Image character recognition method, system, electronic device and storage medium
CN111355671B (en) Network traffic classification method, medium and terminal equipment based on self-attention mechanism
CN114358216B (en) Quantum clustering method and related device based on machine learning framework
JP2021512387A (en) Quantum computing device design
CN114358318B (en) Machine learning framework-based classification method and related device
WO2022267854A1 (en) Method, system and apparatus for processing quantum computing task, and operating system
CN115293254A (en) Quantum multilayer perceptron-based classification method and related equipment
Wang A family of quantum von Neumann architecture
CN113222161A (en) Method and device for realizing user-defined quantum logic gate
CN113222153A (en) Quantum state simulation method and device, storage medium and electronic device
CN115511089A (en) Quantum computing task processing method and device and quantum computer operating system
CN113222151B (en) Quantum state transformation method and device
CN115310614A (en) Quantum line construction method and device and quantum computer operating system
CN115907024A (en) A method, device and quantum computer for constructing a quantum program to be mapped
Xiang et al. Machine learning for object detection
CN116403657A (en) A drug response prediction method, device, storage medium and electronic device
CN116933879A (en) Quantum state determination method and device
CN115511094A (en) Quantum line execution result determining method and device and quantum computer operating system
Rongali et al. Investigating Applications of Run Length Encoding in Data Compression & Source Coding
CN109698703A (en) Gene sequencing data decompression method, system and computer-readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, high tech Zone, Hefei City, Anhui Province

Patentee after: Benyuan Quantum Computing Technology (Hefei) Co.,Ltd.

Country or region after: China

Address before: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, high tech Zone, Hefei City, Anhui Province

Patentee before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI

Country or region before: China

CP03 Change of name, title or address