CN112162724B - Quantum division operation method and device with precision - Google Patents

Quantum division operation method and device with precision Download PDF

Info

Publication number
CN112162724B
CN112162724B CN202011059513.1A CN202011059513A CN112162724B CN 112162724 B CN112162724 B CN 112162724B CN 202011059513 A CN202011059513 A CN 202011059513A CN 112162724 B CN112162724 B CN 112162724B
Authority
CN
China
Prior art keywords
quantum state
quantum
bit
target
state
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.)
Active
Application number
CN202011059513.1A
Other languages
Chinese (zh)
Other versions
CN112162724A (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
Benyuan Quantum Computing Technology Hefei 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 Benyuan Quantum Computing Technology Hefei Co ltd filed Critical Benyuan Quantum Computing Technology Hefei Co ltd
Priority to CN202011059513.1A priority Critical patent/CN112162724B/en
Publication of CN112162724A publication Critical patent/CN112162724A/en
Priority to EP21874279.9A priority patent/EP4224308A1/en
Priority to US18/029,558 priority patent/US12086569B2/en
Priority to PCT/CN2021/119125 priority patent/WO2022068618A1/en
Application granted granted Critical
Publication of CN112162724B publication Critical patent/CN112162724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/57Arithmetic logic units [ALU], i.e. arrangements or devices for performing two or more of the operations covered by groups G06F7/483 – G06F7/556 or for performing logical operations
    • G06F7/575Basic arithmetic logic units, i.e. devices selectable to perform either addition, subtraction or one of several logical operations, using, at least partially, the same circuitry
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Complex Calculations (AREA)

Abstract

The invention belongs to the field of quantum computation, in particular to a quantum division operation method and device with precision, the method comprises the steps of obtaining dividend data and divisor data to be operated, converting the dividend data into a first target quantum state, converting the divisor data into a second target quantum state, iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, outputting a finally obtained counting result as an integer bit of a quotient of the dividend data and the divisor data, carrying out quantum evolution corresponding to the decimal operation of a current first target quantum state and a current second target quantum state of an iterative operator, and outputting a quantum state on a finally obtained preset precision bit quantum bit. The invention realizes the basic arithmetic operation which can be used in the quantum circuit, and fills the blank of the related technology.

Description

Quantum division operation method and device with precision
Technical Field
The invention belongs to the field of quantum computation, and particularly relates to a quantum division operation method and device with precision.
Background
Quantum computers use the superposition of quanta and in theory have the ability to accelerate exponentially in some cases. For example, cracking RSA keys takes hundreds of years on classical computers, while executing quantum algorithms on quantum computers takes only a few hours. However, the current quantum computer is limited by the limited number of controllable bits caused by the development of quantum chip hardware, so that the computing power is limited, and the quantum algorithm cannot be universally run. Generally, quantum algorithms are operated by quantum computing simulation methods.
In the analog implementation of a quantum algorithm, it is generally necessary to construct the quantum algorithm by means of various quantum logic gates, but when the quantum algorithm is constructed by means of only various quantum logic gates, there is no quantum logic gate which operates corresponding to the basic arithmetic operation of classical operations such as addition, subtraction, multiplication, division. Therefore, there is an urgent need to provide a technique capable of implementing basic arithmetic operation in quantum wires to fill the gap of the related art.
Disclosure of Invention
The invention aims to provide a quantum division operation method and device with precision, which are used for solving the defects in the prior art, filling the blank of the related technology and realizing basic arithmetic operation in a quantum circuit.
The technical scheme adopted by the invention is as follows:
the embodiment of the invention provides a quantum division operation method with precision, which comprises the following steps:
the method comprises the steps of obtaining divisor data and divisor data to be operated, converting the divisor data into a first target quantum state, and converting the divisor data into a second target quantum state; wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, and outputting a counting result finally obtained as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
And outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
Optionally, the iteratively performing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state, and counting the execution times of the subtraction until the dividend data is subtracted into a negative number includes:
executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction operation result;
performing quantum state evolution corresponding to subtraction operation on a third target quantum state of the current first preset auxiliary bit and a fourth target quantum state of the current second preset auxiliary bit to add 1 to a value contained in the current third target quantum state; wherein, the initial value contained in the third target quantum state and the value contained in the fourth target quantum state are both-1;
measuring a sign bit sub-quantum state of a first target quantum state currently containing a subtraction result, and judging whether the value of the sign bit of the first target quantum state currently containing the subtraction result is 0 or not;
And under the condition that the value of the sign bit of the first target quantum state currently containing the subtraction result is 0, returning to the step of executing the quantum state evolution corresponding to the subtraction between the current first target quantum state and the current second target quantum state until the value of the sign bit of the first target quantum state currently containing the subtraction result is 1.
Optionally, the outputting the finally obtained count result as an integer bit of a quotient of the dividend data and the divisor data includes:
and outputting a third target quantum state finally obtained, wherein the third target quantum state comprises an integer bit binary value of a quotient of the dividend data and the divisor data.
Optionally, the iteratively performing quantum state evolution corresponding to the decimal operation of the quotient on the current first target quantum state and the current second target quantum state includes:
inverting the sign bit quantum state of the current second target quantum state, and executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state after the inversion of the sign bit so as to evolve the current first target quantum state into a quantum state containing a binary value of a remainder obtained by dividing the divisor data by the divisor data;
Shifting each bit quantum state of the current first target quantum state by one bit leftwards, inverting the sign bit quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state after shifting leftwards by one bit and the second target quantum state after inverting again, and counting the execution times of the subtraction operation until the first target quantum state after shifting leftwards by one bit is subtracted into negative number, and obtaining a decimal quantum state of a binary value containing a counting result on a preset intermediate bit quantum bit;
the last sub-quantum state of the decimal quantum state and the initial quantum state of the corresponding preset precision bit quantum bit are processedExchanging states and outputting quantum states on the exchanged preset precision bit quantum bits;
and returning to execute the step of inverting the sign bit sub-quantum state of the current second target quantum state, and executing the quantum state evolution step corresponding to the subtraction operation on the second target quantum state after inverting the current first target quantum state and the sign bit until reaching the preset iteration times required by the iteration execution of the quantum state evolution corresponding to the decimal operation of the quotient, wherein the preset iteration times are consistent with the digits of the decimal precision to be calculated.
Optionally, the method further comprises:
obtaining preset sign bit quantum bits, and executing preset quantum logic gate operation on the quantum bits corresponding to the sign bit sub-quantum states of the first target quantum state, the quantum bits corresponding to the sign bit sub-quantum states of the second target quantum state, the first preset auxiliary bits and the preset sign bit quantum bits to finally obtain the sign value represented by the sign bit sub-quantum states in the third target quantum state.
Optionally, the quantum state evolution corresponding to the subtraction operation includes:
for two quantum states to be operated, respectively serving as a reduced quantum state containing reduced data and a reduced quantum state containing reduced data, acquiring a quantum state of a third preset auxiliary bit, and controlling the reduced quantum state to execute quantum state evolution corresponding to complement operation according to a symbol bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to acquire a first complement quantum state; wherein the first complement quantum state is a quantum state containing a complement of the reduced data;
executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the number reduction quantum state, and controlling the current number reduction quantum state to execute quantum state evolution corresponding to complement operation according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit to obtain a second complement quantum state; wherein the second complement quantum state is a quantum state containing a complement of the reduction data;
Performing quantum state evolution corresponding to addition operation on the first complement quantum state and the second complement quantum state to evolve the first complement quantum state into a fifth target quantum state containing the sum of the complement of the subtracted data and the complement of the subtracted data;
according to the symbol bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit, controlling the fifth target quantum state to execute quantum state evolution corresponding to complement operation, obtaining an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction result of the subtracted data and the subtracted data; wherein the sixth target quantum state is a complement quantum state comprising the sum of the complement codes;
according to the sign bit sub-quantum state in the current reducing quantum state and the quantum state of the current third preset auxiliary bit, controlling the current reducing quantum state to execute quantum state evolution corresponding to the complement operation, and executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the current reducing quantum state so as to restore the current reducing quantum state.
Optionally, the controlling the quantum state evolution corresponding to the complement operation performed by the reduced quantum state according to the sign bit sub-quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit includes:
Executing CNOT gate operation on a first sign bit quantum bit corresponding to a sign bit sub-quantum state in the reduced number quantum state and the third preset auxiliary bit, wherein the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
according to the quantum state of the third preset auxiliary bit after CNOT gate operation is executed, controlling whether the current subtracted quantum state executes quantum state evolution corresponding to complement code operation or not;
if yes, inverting the non-sign sub-quantum state of the current subtracted quantum state, and inverting the inverted subtracted quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain an evolved first complement quantum state, otherwise, taking the subtracted number quantum state as the first complement quantum state;
performing CNOT gate operation on the current first sign bit quantum bit and the third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Optionally, the performing the quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the reduced number quantum state, and controlling the quantum state evolution corresponding to the current reduced number quantum state performing the complement operation according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit, includes:
Performing an X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the reduced number quantum state to obtain a reversed sign bit sub-quantum state;
executing CNOT gate operation on the current second sign bit quantum bit and a third preset auxiliary bit, wherein the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed, controlling whether the current subtractive quantum state executes quantum state evolution corresponding to the complement code operation or not;
if so, inverting the unsigned bit quantum state of the current reduced quantum state, and mixing the inverted reduced quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain evolved second complement quantum states, otherwise, taking the current reduced quantum states as the second complement quantum states;
performing CNOT gate operation on the current second sign bit quantum bit and the third preset auxiliary bit to restore the current quantum state of the third preset auxiliary bit; the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Optionally, the quantum state evolution corresponding to the addition operation includes:
determining the number of target modules of a front cascade module MAJ module to be cascaded and a rear cascade module UMA module to be cascaded according to the number of quantum bits corresponding to two quantum states to be operated, wherein the number of the modules of the MAJ module is the same as the number of the modules of the UMA module;
cascading the MAJ modules and UMA modules with the number of the target modules according to the addition instruction to generate a target quantum circuit corresponding to the adder;
and carrying out addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit, generating a target quantum state result and outputting the result.
Optionally, the MAJ module is a MAJ quantum wire, the UMA module is a UMA quantum wire, the MAJ quantum wire and the UMA quantum wire each comprise two CNOT quantum logic gates and one TOFFOLI quantum logic gate,
and before the step of cascading the MAJ modules and UMA modules with the number of the target modules according to the addition instruction and generating the target quantum circuit corresponding to the adder, the method further comprises the following steps:
acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and one TOFFOLI quantum logic gate, a control relation among the operation quantum bits and a time sequence relation between the two CNOT quantum logic gates and one TOFFOLI quantum logic gate;
And constructing the two CNOT quantum logic gates and one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation to generate the MAJ quantum circuit or the UMA quantum circuit as a corresponding MAJ module or UMA module.
Optionally, the MAJ module and the UMA module each include three input items and three output items,
according to the addition instruction, the MAJ modules and UMA modules with the number of the target modules are cascaded, and the step of generating the target quantum circuit corresponding to the adder specifically comprises the following steps:
according to the addition instruction, three output items of an MAJ cascade module are used as three input items of a corresponding UMA cascade module, so that the MAJ cascade module and the corresponding UMA cascade module are cascaded, a target quantum circuit corresponding to the adder is generated, wherein the MAJ cascade module is determined by cascading MAJ modules with the number of target modules, and the UMA cascade module is determined by cascading UMA modules with the number of target modules.
Optionally, the three input items of the MAJ module comprise a carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module comprise a carry output item and two intermediate result output items, the three input items of the UMA module comprise a carry output item and two intermediate result output items of the corresponding MAJ module, the three output items of the UMA module comprise a result carry output item, an accumulation and output item and a sub-quantum state input item to be calculated,
According to the addition instruction, the step of using three output items of a MAJ cascade module as three input items of a corresponding UMA cascade module to cascade the MAJ cascade module and the corresponding UMA cascade module, and generating a target quantum circuit corresponding to the adder specifically includes:
according to the addition instruction, taking a carry output item output by the last MAJ module and the two sub-quantum state input items to be calculated as three input items of the next MAJ module, so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of one MAJ module as two input items of a corresponding UMA module, acquiring a last UMA module of the corresponding UMA module, taking a result carry output item of the last UMA module as one input item of the corresponding UMA module, and cascading the MAJ modules with the target modules and UAM modules with the target modules to generate an initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
adding a CNOT quantum logic gate between the last MAJ module and the corresponding first UMA module in the initial quantum circuit, wherein a quantum bit corresponding to a carry output item of the MAJ module is used as a control bit, and a preset carry auxiliary bit is used as a controlled bit, so as to generate a target quantum circuit of the adder.
Still another embodiment of the present invention provides a quantum division operation device with precision, the device including:
the conversion module is used for acquiring divisor data to be operated and divisor data, converting the divisor data into a first target quantum state and converting the divisor data into a second target quantum state; wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
the first quantum state evolution module is used for carrying out quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state in an iterative manner, counting the execution times of the subtraction operation until the divisor data is subtracted into a negative number, and outputting a finally obtained counting result as an integer bit of a quotient of the divisor data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
the second quantum state evolution module is used for iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
And the output module is used for outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
The invention also provides an electronic device comprising a memory in which a computer program is stored and a processor arranged to run the computer program to perform the above-mentioned method of steps.
The invention also provides a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the above-mentioned method of steps when run.
Compared with the prior art, the quantum division operation method with precision provided by the invention has the advantages that the dividend data and the divisor data to be operated are obtained, the dividend data are converted into the first target quantum state, the divisor data are converted into the second target quantum state, the quantum state evolution corresponding to the subtraction operation is iteratively executed on the first target quantum state and the second target quantum state, the execution times of the subtraction operation are counted until the dividend data are subtracted into the negative number, the finally obtained counting result is used as the integer bit of the quotient of the divisor data and the divisor data to be outputted, the quantum state evolution corresponding to the decimal operation of the current first target quantum state and the current second target quantum state is iteratively executed, and the quantum state on the finally obtained preset precision bit quantum bit is outputted, so that the basic arithmetic operation in a quantum circuit can be realized, and the blank of the related technology is filled.
Drawings
FIG. 1 is a block diagram of a computer terminal hardware architecture of a quantum division method with precision according to an embodiment of the present invention;
FIG. 2 is a flow chart of a quantum division method with precision according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a quantum circuit of a quantum division operation method with precision according to an embodiment of the present invention;
FIG. 4 is a quantum circuit schematic diagram of a quantum division method with precision according to another embodiment of the present invention;
FIG. 5 is a schematic diagram of a quantum circuit of a complementary code operation according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a quantum circuit of a first half portion corresponding to a subtractor according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a second half quantum circuit corresponding to a subtractor according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a quantum circuit corresponding to a subtractor according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of an adder according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of an adder quantum circuit according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of an MAJ module according to one embodiment of the present invention;
FIG. 12 is a schematic diagram of a MAJ module quantum circuit assembly process according to one embodiment of the present invention;
Fig. 13 is a schematic diagram of a UMA module provided in an embodiment of the present invention;
fig. 14 is a schematic diagram of a UMA module quantum wire assembly process according to an embodiment of the present invention.
Fig. 15 is a schematic structural diagram of a quantum division device with precision according to an embodiment of the present invention.
Detailed Description
The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention.
It should be noted that the terms "first," "second," and the like in the description and in the claims are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The embodiment of the invention provides a quantum division operation method and a device with precision, which are used for realizing basic arithmetic operation of quantum bits in a quantum circuit, and the method can be applied to electronic equipment such as mobile terminals, in particular mobile phones and tablet computers; such as computer terminals, in particular general computers, quantum computers, etc.
The following describes the operation of the computer terminal in detail by taking it as an example. Fig. 1 is a hardware block diagram of a computer terminal with a quantum division operation method with precision according to an embodiment of the present application. As shown in fig. 1, the computer terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the quantum computing simulation method in the embodiments of the present application, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., implement the method described above. 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 memory remotely located relative to the processor 102, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
It should be noted that a real quantum computer is a hybrid structure, which includes two major parts: part of the computers are classical computers and are responsible for performing classical computation and control; the other part is quantum equipment, which is responsible for running quantum programs so as to realize quantum computation. The quantum program is a series of instruction sequences which are written by a quantum language such as the Qrun language and can run on a quantum computer, so that the support of quantum logic gate operation is realized, and finally, quantum computing is realized. Specifically, the quantum program is a series of instruction sequences for operating the quantum logic gate according to a certain time sequence.
In practical applications, quantum computing simulations are often required to verify quantum algorithms, quantum applications, etc., due to the development of quantum device hardware. Quantum computing simulation is a process of realizing simulated operation of a quantum program corresponding to a specific problem by means of a virtual architecture (namely a quantum virtual machine) built by resources of a common computer. In general, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program, namely the program for representing the quantum bit and the evolution thereof written in the classical language, wherein the quantum bit, the quantum logic gate and the like related to quantum computation are all represented by corresponding classical codes.
Quantum circuits, which are one embodiment of quantum programs, also weigh sub-logic circuits, are the most commonly used general quantum computing models, representing circuits that operate on qubits under an abstract concept, the composition of which includes qubits, circuits (timelines), and various quantum logic gates, and finally the results often need to be read out by quantum measurement operations.
Unlike conventional circuits, which are connected by metal lines to carry voltage or current signals, in a quantum circuit, the circuit can be seen as being connected by time, i.e., the state of the qubit naturally evolves over time, as indicated by the hamiltonian operator, during which it is operated until a logic gate is encountered.
One quantum program is corresponding to one total quantum circuit, and the quantum program refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that: one quantum program may consist of a quantum circuit, a measurement operation for the quantum bits in the quantum circuit, a register to hold the measurement results, and a control flow node (jump instruction), and one quantum circuit may contain several tens to hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process of executing all quantum logic gates according to a certain time sequence. Note that the timing is the time sequence in which a single quantum logic gate is executed.
It should be noted that in classical computation, the most basic unit is a bit, and the most basic control mode is a logic gate, and the purpose of the control circuit can be achieved by a combination of logic gates. Similarly, the way in which the qubits are handled is a quantum logic gate. Quantum logic gates are used, which are the basis for forming a quantum circuit, and comprise single-bit quantum logic gates, such as Hadamard gates (H gates), pauli-X gates, pauli-Y gates, pauli-Z gates, RX gates, RY gates and RZ gates; multi-bit quantum logic gates such as CNOT gate, CR gate, iSWAP gate, toffoli gate. Quantum logic gates are typically represented using unitary matrices, which are not only in matrix form, but also an operation and transformation.
Currently, there are no classical operations such as four-law operation functions that can be implemented, and an example is: the quantum logic gate for addition, subtraction, multiplication and division operation is needed to construct a quantum circuit to realize the functional operation of any four arithmetic operations, thereby promoting the development of quantum computation and the expansion and landing of the quantum application field.
Referring to fig. 2, fig. 2 is a schematic flow chart of a quantum division operation method with precision according to an embodiment of the present invention, which may include the following steps:
S201, obtaining divisor data and divisor data to be operated, converting the divisor data into a first target quantum state, and converting the divisor data into a second target quantum state; wherein the target quantum state comprises: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
specifically, the decimal data to be operated can be converted into binary quantum state representation by using the existing amplitude coding mode. For example, the dividend data is 7, the signed binary representation 0111, the most significant bit is 0 representing a positive number, and 1 representing a negative number; the divisor data is 4 and the signed binary representation 011. In this embodiment, the highest bits of the first target quantum state and the second target quantum state are both 0, that is, the dividend and the divisor participating in the operation are both positive numbers.
A 5-bit qubit a.sign, a3, a2, a1, a0 may be obtained, 7 encoded into a first target qustate of a.sign, a3, a2, a1, a0The amplitude of the quantum state is set to 1. Wherein (1)>Called->One sub-quantum state corresponds to one quantum bit, and the upper order is from the lower order to the left, the highest order is to Sign, fourth bit corresponding to a3, third bit corresponding to a2, second bit corresponding to a1, lowest bit corresponding to a0, highest bit ≡>Representing a sign bit sub-quantum state, the remainder representing a magnitude bit sub-quantum state. In order to unify the operational dimensions, additionally obtain 5-bit qubits b.sign, b3, b2, b1, b0, encode 4 to the second target quantum state +.sign, b3, b2, b1, b0 ≡>The amplitudes are 1.
S202, carrying out quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state in an iterative manner, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, and outputting a counting result finally obtained as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
specifically, the number of times of subtraction operation refers to the number of times of quantum state evolution corresponding to the subtraction operation performed on the first target quantum state and the second target quantum state, that is, the number of iterations.
In a specific implementation, quantum state evolution corresponding to subtraction operation can be performed on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction operation result;
Performing quantum state evolution corresponding to subtraction operation on a third target quantum state of the current first preset auxiliary bit and a fourth target quantum state of the current second preset auxiliary bit to add 1 to a value contained in the current third target quantum state; wherein, the initial value contained in the third target quantum state and the value contained in the fourth target quantum state are both-1;
measuring a sign bit sub-quantum state of a first target quantum state currently containing a subtraction result, and judging whether the value of the sign bit of the first target quantum state currently containing the subtraction result is 0 or not;
and under the condition that the value of the sign bit of the first target quantum state currently containing the subtraction result is 0, returning to execute the step of carrying out quantum state evolution corresponding to the subtraction on the current first target quantum state and the current second target quantum state until the value of the sign bit of the first target quantum state currently containing the subtraction result is judged to be 1.
Exemplary, the current first and second target quantum states areAnd->. For a pair ofAnd->Performing a corresponding quantum state evolution of the subtraction operation to add +.>The value 00111 contained is subtractedThe value 00100 included gives the first target quantum state +. >Second target Quantum state->Unchanged;
the current third target quantum state of the first preset auxiliary bits r.sign, r2, r1, r0, r.sign, r2, r1 and r0 of 4 bits is obtained as an initial state, and can be set asI.e. the initial value comprised is-1, and the current fourth target quantity of the 4-bit second preset auxiliary bits d.sign, d2, d1, d0, d.sign, d2, d1, d0 is obtainedThe sub-state is +.>
Wherein the quantum state of the qubit is typically initialized toBy applying a quantum logic gate operation, such as an X gate, to the corresponding qubit +.>The state is reversed to obtain->A state;
then, for the current third target quantum stateAnd the current fourth target quantum state->Performing a corresponding quantum state evolution of the subtraction operation to add +.>The value 1001 involved minus +.>The value 1001 included gives the third target quantum state +.>Fourth target Quantum state->Unchanged, realizing the original third target quantum state->The value of-1 plus 1;
measuring the first target quantum currently containing the subtraction result by applying a measurement operation to the qubit a3 corresponding to the sign bit sub-quantum state of the first target quantum stateState ofThe sign bit quantum state of +.>Namely, the sign bit has a value of 0, and the method returns to execute the quantum state evolution step corresponding to the subtraction operation on the current first target quantum state and the current second target quantum state:
At this time, the current first target quantum state isThe current second target quantum state is +.>Continuously executing quantum state evolution corresponding to subtraction operation to obtain: first target Quantum state->Second target quantum state
Current third target quantum stateFourth target Quantum state at present->Continuously executing quantum state evolution corresponding to subtraction operation to obtain: third target Quantum state->Fourth target Quantum state->Thereby the original third target quantum state +.>Continuing to add 1 to the value 0 of (2);
measuring the current first target quantum stateThe sign bit quantum state of +.>I.e. the sign bit has a value of 1, indicating that the dividend 7 is subtracted to a negative number by two subtractions, the iteration is ended. The final iteration number is 1, and the third target quantum state plays a role in counting.
Specifically, a third target quantum state obtained finally may be output, where the third target quantum state includes a value that is a quotient of the dividend data and the divisor data.
Continuing with the above example, the third target quantum state finally obtained after the end of the iteration isThe third target quantum state can be directly output as integer bits of the quotient of divisor 7 and divisor 4, inclusive of a value of 0001 >The value contained in the third target quantum state may be further converted into a decimal value of 1 and output.
S203, iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
specifically, for the current first target quantum state and the current second target quantum state, iteratively executing quantum state evolution corresponding to the decimal operation of the quotient may include:
s2031, inverting the sign bit sub-quantum state of the current second target quantum state, and executing quantum state evolution corresponding to subtraction operation on the second target quantum state after the inversion of the current first target quantum state and the sign bit to evolve the current first target quantum state into a quantum state containing a remainder binary value obtained by dividing the divisor data by the divisor data;
s2032, shifting each sub-quantum state of the current first target quantum state by one bit leftwards, inverting the symbol sub-quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state shifted leftwards and the inverted second target quantum state, and counting the execution times of the subtraction operation until the first target quantum state shifted leftwards is reduced to a negative number, and obtaining a decimal quantum state containing a binary value of a counting result on a preset intermediate-bit quantum bit;
S2033, the last sub-quantum state of the decimal quantum state and the initial quantum state of the corresponding preset precision bit quantum bitExchanging states and outputting quantum states on the exchanged preset precision bit quantum bits;
s2034, returning to execute the step of inverting the sign bit sub-quantum state of the current second target quantum state, and executing quantum state evolution corresponding to subtraction operation on the second target quantum state after inverting the current first target quantum state and the sign bit until reaching the preset iteration number required by the iteration execution of quantum state evolution corresponding to decimal operation of the quotient, wherein the preset iteration number is consistent with the number of bits of the decimal precision to be calculated.
Exemplary, the current first target Quantum stateSecond target Quantum state->Third target Quantum state->Fourth target Quantum state->The decimal place of the quotient retains a 3-bit precision.
First iteration: step 1: for the sign bit quantum state of the second target quantum stateInverting the second target quantum state after inversion to be +.>For the current first target quantum state +.>And a second target quantum state after the inversionPerforming quantum state evolution corresponding to subtraction operation, wherein the evolved first target quantum state becomes +. >The second target quantum state is->The method comprises the steps of carrying out a first treatment on the surface of the In fact, the _on>The binary value 00011 (decimal value 3) is included, which is the remainder of dividing divisor 7 by divisor 4.
Step 2: to make the first target quantum stateThe whole left shift is +.>For the second target quantum state->The sign bit of (2) is inverted again to be reduced to +.>Then->And->Iteratively performing quantum state evolution corresponding to subtraction and counting the number of iterations until +.>And (3) subtracting the number into a negative number, storing the counting result into decimal quantum states of preset intermediate-bit quantum bits cc.sign, cc2, cc1 and cc0, and finally obtaining the following steps: first target Quantum state->Second target Quantum state->Decimal quantum state->
It should be noted that, the principle is the same as the above-mentioned principle of implementing the subtraction of the divisor data to the negative number by iteratively executing the quantum state evolution corresponding to the subtraction operation on the first target quantum state and the second target quantum state, and counting the execution times of the subtraction operation, namely, actuallyAnd->And performing division operation.
Step 3: the decimal place is in quantum stateIs the last one of the sub-quantum states->An initial quantum state of a corresponding preset precision bit qubit f2>By using SWAP gate exchange, outputting the quantum state of f2 after exchange>The decimal quantum state becomes +.>The method comprises the steps of carrying out a first treatment on the surface of the The preset precision bit quantum bit can be set to be f2, f1 and f0, wherein in the first iteration, the last sub-quantum state of the decimal quantum state is output to f2, the second iteration is output to f1, and the third iteration is output to f 0.
Second iteration: current first target quantum stateCurrent second target quantum state->Current decimal quantum state->Returning to the steps 1-3, and combining the last sub-quantum state of the decimal quantum state with the initial quantum state of f1 +.>Exchanging, outputting the exchanged quantum state of f1, and finally obtaining: current first target quantum stateCurrent second target quantum state->Quantum state of f 2->Decimal quantum state->
Third iteration: current first target quantum stateCurrent second target quantum state->Current decimal quantum state->Returning to the steps 1-3, and combining the last sub-quantum state of the decimal quantum state with the initial quantum state of f0 +.>Exchanging, outputting the exchanged f0 quantum state, and finally obtaining: current first target quantum stateCurrent second target quantum state->Quantum state of f 0- >Decimal quantum state->
Illustratively, fig. 3 is a quantum circuit schematic diagram for performing quantum division operations with precision. As shown in fig. 3, t is a classical bit for storing a measurement result, a.sign, a are quantum bits for encoding a sign, a value of the dividend data, and correspond to a first target quantum state;
sign, b are quantum bits of the sign, numerical value of the code divisor data, correspond to the second target quantum state;
the sign, r 0 constitute the first preset auxiliary bit, r.sign is the quantum bit of the sign of the encoder, r 0 is the quantum bit of the value of the encoder, r 0 is the lowest bit;
sign, d 0 constitute the second preset auxiliary bit, d.sign encodes the sign bit, d encodes the numerical value bit, wherein d 0 is the lowest bit; the second preset auxiliary bit corresponds to a fourth target quantum state with an initial state of 0 state, and the sign bit sub-quantum state corresponding to d.sign and the numerical value bit sub-quantum state corresponding to d [0] are inverted through an X gate to obtain a fourth target quantum state with a value of-1, and the fourth target quantum state is used for adding 1 in a subtracter to play a role in counting;
kk is an auxiliary qubit required by a subtracter module in the upper half of the line, n+3 bits are total, k is an auxiliary qubit required by a subtracter module in the lower half of the line, n+2 bits are total, the n+2 bits share the first (n+2) bits in kk, and the graph shows that actually kk contains k; f < cnt-1 >, f < i >, f < 0 > represent preset precision bit qubits;
The subtracter module is a functional module for executing quantum state evolution corresponding to subtraction operation, X represents a quantum logic gate X gate, qwhile represents quantum iterative operation, and the execution time sequence of a quantum circuit is sequentially from a first layer to a fifth layer:
a first layer: the measurement operation in Qwhile is used for measuring the value of a.sign and storing the value onto a classical bit t, when t <1, the iteration operation in Qwhile is executed, and the sum++ is executed, the sum value is stored onto the corresponding classical bit (sum initial value is 0), until t reaches 1, and the iteration is ended;
a second layer: the iteration times of the second layer are cnt times, cnt is the decimal precision of the required quotient, in each iteration of the second layer, the layer Qwhile also performs corresponding iteration, and a t=0 module indicates that t is set to 0; sign, cc [0] represent preset intermediate qubits, where cc.sign represents sign bits; the measurement operation in the layer Qwhile is used for measuring the value of a.sign and storing the value onto a classical bit t, when t <1, performing iterative operation in the Qwhile, and performing s [ i ] ++, storing the value of s [ i ] onto a corresponding classical bit (s [ i ] is initially 0, i=0, 1,2 … … represents the ith iteration of the second layer), and ending the iteration in the Qwhile until t reaches 1; the lower right one of the second layer is a solid vertical line and two virtual vertical line icons representing a quantum logic gate SWAP gate;
Third layer: the iteration number of the third layer is cnt number, when s [ cnt-i-1]>0, performing subtractor iteration operation in the layer Qwhile, and performingUp to s [ cnt-i-1]Ending the iteration in Qwhile when the number of the iterations is less than or equal to 0; the inverse left shift one-bit operation is an inverse operation of shifting one bit left;
fourth layer: when sum is>0, performing subtractor iteration operation in the layer Qwhile, and performingEnding the iteration in Qwhile until sum is less than or equal to 0; the two X gates at the lower left of the fourth layer are used for the pair d.sign, d [0]]The quantum state of (2) is inverted again to realize reduction to the initial state.
Further, through the operation of the third layer and the fourth layer, s [ i ] and sum can be reduced to an initial value of 0, a.sign, b.d.sign, d [0] are reduced to an initial state, the integer bit of the quotient is obtained on r, the preset precision decimal of the quotient is obtained on f, and the quantum state of the auxiliary quantum bit can be reduced, so that the method can be reused.
S204, outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
Continuing the above example, three iterations are performed to obtain 3-bit preset precision bit quantum bits f2, f1, f0 with quantum states of I.e. the decimal binary value of the quotient is 110 (decimal 0.75). The integer bit binary value of the quotient obtained by the above calculation is 0001 (decimal 1), and the quotient of the final dividend 7 and the divisor 4 is 1.75.
In practical application, under the condition that the divisor and/or the divisor has negative numbers, a preset sign bit quantum bit can be obtained, and a preset quantum logic gate operation is executed on the quantum bit corresponding to the sign bit sub-quantum state of the first target quantum state, the quantum bit corresponding to the sign bit sub-quantum state of the second target quantum state, the first preset auxiliary bit and the preset sign bit quantum bit, so as to finally obtain a sign value represented by the sign bit sub-quantum state in the third target quantum state.
Illustratively, fig. 4 is a quantum circuit schematic diagram of a quantum division operation with precision supporting sign bit operation. Wherein, the positive divider with precision is the quantum circuit shown in FIG. 3, and sign bit quantum bits u [0], u [1] are added; the circle icons connected with vertical lines represent quantum logic gate CNOT gates, the quantum bits corresponding to the time lines where the large circles are located are controlled bits, and the quantum bits corresponding to the time lines where the solid points are located are control bits; classical bits are cnt+2 bits, including in fig. 3: 1-position sum, cnt-position s [ i ], 1-position t; v is the auxiliary qubit total 3n+3 bits, including in fig. 3: n+3 bits kk, n bits d.sign and d, n bits cc.sign and cc.
By applying a series of CNOT gates as shown in FIG. 4 to u [0], u [1], a.sign, b.sign, r.sign, a sign sub-quantum state containing the sign value of the quotient can be finally obtained at r.sign.
The specific implementation of quantum state evolution corresponding to the subtraction operation is described in detail below.
Specifically, the quantum state evolution corresponding to the subtraction operation may be performed by the subtractor, which may include:
s301, respectively taking two quantum states to be operated as a reduced quantum state containing reduced data and a reduced quantum state containing reduced data, obtaining a quantum state of a third preset auxiliary bit, and controlling the reduced quantum state to execute quantum state evolution corresponding to complement operation according to a symbol bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to obtain a first complement quantum state; wherein the first complement quantum state is a quantum state containing a complement of the reduced data;
as can be seen from the foregoing embodiments, the two quantum states to be operated on have the following group: a first target quantum state and a second target quantum state; a third target quantum state and a fourth target quantum state; and the second target quantum state is obtained after the first target quantum state and the sign bit are inverted. The former may be referred to as a decremented sub-state, and the data included therein may be a decremented number in the subtraction operation, and the latter may be referred to as a decremented number, and the data included therein may be a decremented number.
In this embodiment, the greatest difference between the subtractor and the adder described below is that a negative number is generated, so that a binary processing method is adopted to add one sign bit to both the number to be subtracted and the number to be subtracted to represent the positive and negative of the numerical value, and a complementary code is used to perform the operation. The positive number complement is unchanged, and the negative number is added with 1 after being inverted according to the bit except the sign bit. And the method is corresponding to a quantum circuit, namely whether the complementary code operation is performed is controlled by using sign bits, the inverse is performed by using an X gate, and 1 is added through an adder. And after the operation is completed under the condition of the complement, the result is subjected to the complement operation once again, and the target value is obtained. And obtaining the reduced data and the reduced data to be operated, and respectively converting the reduced data and the reduced data into a first target quantum state and a second target quantum state. Wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude.
Specifically, according to the sign bit sub-quantum state in the subtracted quantum state and the quantum state of the third preset auxiliary bit, controlling the subtracted quantum state to execute quantum state evolution corresponding to the complement operation, and executing CNOT gate operation on the first sign bit quantum bit and the third preset auxiliary bit corresponding to the sign bit sub-quantum state in the subtracted quantum state, wherein the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit; moreover, the CNOT gate can be replaced by other equivalent existing quantum logic gates or quantum logic gate combinations, which is also reasonable and feasible;
According to the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed, controlling whether the current subtracted number quantum state executes quantum state evolution corresponding to the complement code operation or not;
if yes, inverting the non-sign sub-quantum state of the current subtracted quantum state, and inverting the inverted subtracted quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain an evolved first complement quantum state, otherwise, taking the subtracted number quantum state as the first complement quantum state; wherein after CNOT gate operation is executedThe quantum state of the third preset auxiliary bit of (2) may be +.>When in state, the quantum state evolution corresponding to the complement code operation is controlled to be executed, otherwise, the quantum state evolution is not executed;
performing CNOT gate operation on the current first sign bit quantum bit and the third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Illustratively, the reduced quantum states are assumed to be。/>The symbol bit sub-quantum state is the sub-quantum state of the highest bit, namely +.>The value of the bit is 0, the corresponding first sign bit quantum bit is g.sign, the third preset auxiliary bit is preset quantum bit q1, and the first sign bit quantum is initially +. >A state.
CNOT gate operation is performed on g.sign and q1, g.sign is the control bit, q1 is the controlled bit, and the quantum state of g.sign bit isAfter CNOT gate operation, the quantum state of the controlled bit q1 is +.>Is unchanged.
Since the quantum state of q1 after performing the CNOT gate operation isStates, so quantum states corresponding to the complement operations are not evolved for the subtracted quantum states. In principle, the method is characterized in that,when the number is reduced to be positive, the complementary code is not needed in the subtraction operation, or the complementary code is self, and the +.>As a first complement quantum state.
Finally, CNOT gates can be performed again on the current g.sign and q1, the quantum state of the g.sign bit beingAfter CNOT gate operation, the quantum state of the controlled bit q1 is +.>Unchanged, with reduced q1 as +.>And state, thereby releasing the information stored in the third auxiliary bit. The first complement quantum state may contain a value 0011 that is the complement of the subtracted number 0011.
As shown in fig. 5, q 1 And a third preset auxiliary bit for controlling whether to perform a complement operation, wherein the first target quantum state is g, g.sign is a sign bit sub-quantum state in the first target quantum state, the remaining g is a numerical bit sub-quantum state representing the data numerical value, j is a fourth preset auxiliary bit, namely an auxiliary bit set to be 1, and p is an auxiliary bit (a fifth preset auxiliary bit described below) used by the adder. Corresponding to fig. 3, k is n+2 bits, that is, includes: n bits j, 1 bit p, 1 bit q1.
The quantum circuit shown in FIG. 5 realizes the quantum circuit for the operation of complementing g, and g.sign and q are firstly 1 Performing CNOT gate operation such that q 1 Temporarily express g.sign and use q 1 Control whether to perform complement, and after complement is completed, q is again calculated 1 And (5) reduction. Thus, the quantum state evolution corresponding to the complement code operation of the subtracted number quantum state is controlled to obtain a first complement code quantum state.
Specifically, according to the sign bit sub-quantum state of g, the first preset auxiliary bit q is used 1 To control whether the complementary code is to be fetched. If g is a negative numberAnd performing negative complement operation. The complement of negative number is that 1 is added after inverting by bit except sign bit, if the operation of inverting by bit except sign bit is realized by logic gate, only X gate is needed to be made to all the value bits, 1 is added after inverting, therefore, by adding j and g, the value of j is set as 1, p is the auxiliary bit of adder, after adding g and j after inverting the value bits, the value after inverting the complement is stored on g, q is added 1 And (5) reducing the mixture to be used next time.
Examples: when g is a negative number, g.sign is 1, thus q 1 Also 1, the inverse operation is needed, and when g is positive, g.sign is 0, so q 1 And also 0, no complement is needed.
S302, executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the number reduction quantum state, and controlling quantum state evolution corresponding to complement code operation executed by the current number reduction quantum state according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit to obtain a second complement code quantum state; wherein the second complement quantum state is a quantum state containing a complement of the reduction data;
specifically, the X gate operation may be performed on the second sign bit quantum bit corresponding to the sign bit sub-quantum state in the reduced number quantum state, to obtain the inverted sign bit sub-quantum state; the X gate can be replaced by other equivalent existing quantum logic gates or quantum logic gate combinations, and the method is reasonable and feasible;
likewise, performing a CNOT gate operation on a current second sign bit qubit and a third preset auxiliary bit, wherein the second sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit;
according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed, controlling whether the current subtractive quantum state executes quantum state evolution corresponding to the complement code operation or not;
If so, inverting the unsigned sub-quantum state of the current reduced quantum state, and mixing the inverted reduced quantum state with a fourth preset auxiliary bit amountSub-statePerforming addition operation on the states to obtain evolved second complement quantum states, otherwise, taking the current reduced quantum states as the second complement quantum states;
performing CNOT gate operation on the current second sign bit quantum bit and the third preset auxiliary bit to restore the current quantum state of the third preset auxiliary bit; the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Exemplary, the reduced quantum state is assumed to be。/>The symbol bit sub-quantum state is the sub-quantum state of the highest bit, namely +.>A state, the value of the bit is 0, the corresponding second sign bit quantum bit is set to h.sign, and the current third auxiliary bit is restored to +.>A state.
First, an X gate can be performed on h.sign to sub-quantum state of the corresponding sign bitThe reverse is->The reduced number of quantum states becomes +.>
The CNOT gate operation is continuously performed on h.sign and q1, h.sign is used as a control bit, q1 is used as a controlled bit, and the quantum state of the current h.sign bit isAfter CNOT gate operation, the quantum state of the controlled bit q1 is +. >Is inverted as +.>A state.
The quantum state of q1 after performing CNOT gate operation isThe state is thus the current reduced number quantum state +.>And executing quantum state evolution corresponding to the complement operation. The implementation of the quantum state evolution corresponding to the execution of the complement operation is as follows:
for the current reduced number quantum stateIs inverted and the inverted reduced number quantum stateQuantum states +.>Executing quantum state evolution corresponding to addition operation to obtain a second complement quantum state after evolution as +.>
Wherein, can be realized by executing X gate pairsNon-sign bit quantum state of->Taking the reverse; in order to keep the dimensions consistent, the fourth preset auxiliary bit is preset 4-bit quantum bit j3, j2, j1, j0, and the quantum state of the fourth preset auxiliary bitIn fact written +.>Both are equivalent.
Finally, CNOT gates can be performed again on the current h.sign and q1, the quantum state of the h.sign bit beingAfter CNOT gate operation, the quantum state of the controlled bit q1 is +.>Is inverted as +.>Thereby reducing q1 again to the original +.>In state, the storage space of q1 is released. The second complement quantum state may contain a value 1100 that is the complement of the reduction 1100 after performing an X gate on h.sign.
In this embodiment, the second target quantum state h is the same as the first target quantum state h, and the first target quantum state h is the same as the second target quantum state j [0] The X gate is done to set the value to 1 and the sign sub-quantum state h.sign in the second target quantum state is done to change the subtraction to addition. As shown in fig. 6, fig. 6 is a schematic quantum circuit diagram of quantum state evolution corresponding to the complementary code operation performed on g and h, and the second complementary code quantum state is obtained by performing the complementary code operation on the second target quantum state h according to the same method.
S303, performing quantum state evolution corresponding to addition operation on the first complement quantum state and the second complement quantum state to evolve the first complement quantum state into a fifth target quantum state containing the sum of the complement of the subtracted data and the complement of the subtracted data;
illustratively, for the first complement quantum stateAnd the second complement quantum state is +.>Executing quantum state evolution corresponding to addition operation, and adding the first complement quantum state +.>Is evolved into the fifth target quantum state->
In this embodiment, after the complement is obtained, g and h are added, and after the addition is completed, the previous operation is restored, and the obtained complement is stored in g. Substituting the first complement quantum state and the second complement quantum state into a quantum circuit of an adder, and executing quantum state evolution corresponding to addition operation, thereby evolving the first complement quantum state into a third target quantum state containing the sum of the complement of the subtracted data and the complement of the subtracted data.
S304, according to the symbol bit sub-quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit, controlling the fifth target quantum state to execute quantum state evolution corresponding to complement operation, obtaining an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction result of the subtracted data and the subtracted data; wherein the sixth target quantum state is a complement quantum state comprising the sum of the complement codes;
exemplary, according to the present fifth target Quantum stateSymbol bit quantum state of->And the quantum state of the current third preset auxiliary bit +.>Control of the fifth target quantum state>Performing quantum state evolution corresponding to the complement operation to obtain a sixth objective quantum state after evolution +.>It comprises a value of 1001 (decimal-1), i.e. is the reduced number quantum state +.>Comprising a reduced number 0011 (decimal 3) and a reduced number quantum state +.>The subtraction result of the included reduction 0100 (decimal 4).
It should be noted that the evolution of the quantum state corresponding to the execution of the complementary code operation may be the same as that described above, and after the evolution, the quantum state of the third predetermined auxiliary bit is still restored toTo facilitate subsequent computing use.
S305, according to the sign bit sub-quantum state in the current reduced quantum state and the quantum state of the current third preset auxiliary bit, controlling the current reduced quantum state to execute quantum state evolution corresponding to the complement operation, and executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the current reduced quantum state so as to restore the current reduced quantum state.
Exemplary, the current reduced number quantum state is a second complement quantum stateThe quantum state of the current third preset auxiliary bit is +.>. Continuing to control +.>Performing quantum state evolution corresponding to the complementary code operation to obtain evolved +.>Then the sign bit quantum state is reversed through X gate operation, and is restored to the initial number-reducing quantum state +.>
In this embodiment, after the addition operation, the quantum state evolution corresponding to the complement operation is further performed on the third target quantum state of the sum of the complement of the subtracted data and the complement of the subtracted data. As shown in FIG. 7, first, for j [0] The purpose of doing an X gate is to make j [0] The value of (2) is set to 1, so that +1 operation in the complementary code is conveniently solved. The reason for the X gate operation on the sign bit of h is to convert g-h to g+ (-h). Then, g and h are processed with complementary codes, after the processing is finished, the complementary codes of g and h are added, after a result is obtained, g and h are processed with complementary code solving operation once, the complementary codes are restored to normal values, and finally initial operation is restored, namely auxiliary bits are restored, and 2X gates are processed. The quantum circuit diagram of the entire subtractor shown in fig. 8 is thus constituted, which is a functionally simple example.
Specific implementations of quantum state evolution corresponding to performing addition operations are described in detail below.
Specifically, the quantum state evolution corresponding to the addition operation may be performed by the adder, which may include:
s401, determining the number of target modules of a front cascade module MAJ module to be cascaded and a rear cascade module UMA module to be cascaded according to the number of quantum bits corresponding to two quantum states to be operated, wherein the number of the modules of the MAJ module is the same as the number of the modules of the UMA module;
from the foregoing, the two quantum states to be operated on may be: a first complement quantum state and a second complement quantum state; inverted subtracted quantum state and fourth preset auxiliary bit quantum stateA state.
Exemplary, as shown in FIG. 9, the first qubit in the line is the fifth predetermined auxiliary bit, initiallyThe state is finally restored to +>States e and f are quantum states corresponding to the data to be added, each corresponding to a set of quantum bits. c represents the final carry term, corresponding to the preset carry auxiliary bit, s is the output bit not containing carry. It is generally required that the number of qubits corresponding to e and f be the same, and the number of bits s and e, f be the same.
Exemplary, as shown in FIG. 10, e [i] And f [i] The ith bit and c of the quantum state corresponding to the two addends respectively [i] Is the upper level carry.
s [i] =e [i] XOR f [i] XOR c [i]
c [i+1] = (e [i] AND f [i] ) XOR (e [i] AND f [i] ) XOR (e [i] AND f [i] ),
Wherein the first quantum bit is a fifth preset auxiliary bit corresponding to c in the quantum circuit 0 . The first MAJ module comprises three input quantum states and three corresponding output quantum states, wherein the three input quantum states are c respectively 0 、e 0 、f 0 ,e 0 A 0 th quantum state of the first quantum state to be calculated, f 0 A 0 th quantum state which is the second quantum state to be operated on, c 0 And the quantum state of the auxiliary bit is preset for the fifth, and the initial value is 0, namely no carry. The three output quantum states are respectively、/>、c 1 ,c 1 E is 0 And f 0 The added carry, and similarly, the three input quantum states of the next MAJ module are c 1 、e 1 、f 1 The three output quantum states are respectively +.>、/>、c 2 And so on to the last MAJ module.
For the first UMA module, the first UMA module comprises three input quantum states and three corresponding output quantum states, wherein the three output quantum states of the MAJ module are the three input quantum states of the corresponding UMA module, and the three output quantum states are c respectively 0 、s 0 、e 0 ,s 0 E is 0 And f 0 The result of the addition, which does not contain carry. Similarly, s1 is e 1 And f 1 And similarly, c4 is the final carry term, the result of the addition, which does not contain a carry. In practical application, the quantum bit corresponding to c4 may not be set in the quantum circuit under the condition that the final carry is not calculated.
And the number of the modules of the MAJ module and the number of UMA modules can be determined according to the number of sub-quantum states contained in any quantum state to be operated, wherein one sub-quantum state corresponds to one quantum bit, and the number of the modules of the MAJ module and the number of the UMA modules are equal. The figure shows, by way of example only, 4-bit qubits for each of codes e and f, with the number of MAJ modules and UMA modules each being 4. The MAJ module and the UMA module form a front and rear cascade unit of the adder. The MAJ module may be used to extract the carry term of any one step and pass on to the next stage, thereby calculating the final carry term. On the one hand, the UMA module extracts information of c and transmits the information to the UMA of the previous stage, s (result item) of each stage is calculated, and e information is recovered.
Exemplary: when 4 (the quantum state corresponding to the 3 qubits is denoted as 100) +2 (the quantum state corresponding to the 3 qubits is denoted as 010) =6 (the quantum state corresponding to the 3 qubits is denoted as 110). At this time, the number of the qubits of the encoding operation result is consistent with the number of the qubits of the encoding e or the number of the qubits used for encoding f, and the number of the modules of the MAJ module and the number of the UMA modules are 3.
Exemplary: when 4 (the quantum state corresponding to the 3 qubits is represented as 100) +7 (the quantum state corresponding to the 3 qubits is represented as 111) =11 (the quantum state corresponding to the 3 qubits is represented as 011), but it is understood that the binary number corresponding to 11 is 1011 and the bit at the leftmost 1 is a carry term, which can be represented by an auxiliary bit. At this time, the number of the qubits of the encoding operation result and the number of the qubits of the encoding e or the number of the qubits of the encoding f is large, and the number of the modules of the MAJ module and the number of the UMA modules are 3.
For example, when 2 (the quantum state corresponding to the encoding at 2 qubits is denoted as 10) +4 (the quantum state corresponding to the encoding at 3 qubits is denoted as 100) =6 (the quantum state corresponding to the encoding at 3 qubits is denoted as 110). At this time, the numerical term "3" of the numerical value of the code "6" is consistent with the number of quantum states of the quantum bit of the code b, and the number of modules of the MAJ module and the number of UMA modules are both 3.
S402, cascading MAJ modules and UMA modules of the target module number according to an addition instruction to generate a target quantum circuit corresponding to the adder;
The MAJ cascade module and the UMA module respectively comprise three input items and three output items, and the three output items of one MAJ cascade module can be used as the three input items of one corresponding UMA cascade module according to an addition instruction so as to cascade the MAJ cascade module and the corresponding UMA cascade module to generate a target quantum circuit corresponding to the adder, wherein the MAJ cascade module is determined by cascading among the MAJ modules of the target module number, and the UMA cascade module is determined by cascading among the UMA modules of the target module number.
Specifically, the three input items of the MAJ module comprise one carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module comprise one carry output item and two intermediate result output items, the three input items of the UMA module comprise one carry output item and two intermediate result output items of the corresponding MAJ module, the three output items of the UMA module comprise one result carry output item, an accumulation and output item and one sub-quantum state input item to be calculated,
then, according to the addition instruction, the carry output item output by the last MAJ module and the two sub-quantum state input items to be calculated are used as three input items of the next MAJ module, so that MAJ modules with the number of the target modules are cascaded;
Taking two intermediate result output items of one MAJ module as two input items of a corresponding UMA module, acquiring a last UMA module of the corresponding UMA module, taking a result carry output item of the last UMA module as one input item of the corresponding UMA module, and cascading the MAJ modules with the target modules and UAM modules with the target modules to generate an initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
adding a CNOT quantum logic gate between the last MAJ module and the corresponding first UMA module in the initial quantum circuit, wherein a quantum bit corresponding to a carry output item of the MAJ module is used as a control bit, and a preset carry auxiliary bit is used as a controlled bit, so as to generate a target quantum circuit of the adder. In the case that the carry term is not required, the CNOT gate and the carry auxiliary bit may not be set.
In this embodiment, as shown in fig. 10, according to the illustrated embodiment, the three output bits of the MAJ module are used as the three input bits of the UMA module, so that the same number of MAJ modules and UMA modules are cascaded to generate the target quantum circuit corresponding to the adder. The open circles and the solid circles connected in the circuit diagram represent CNOT gate operation, the quantum bits corresponding to the open circles are control bits, and the solid circles correspond to the controlled bits.
The method comprises the steps of generating a target quantum circuit corresponding to an adder, wherein the MAJ module is a MAJ quantum circuit, the UMA module is a UMA quantum circuit, the MAJ quantum circuit and the UMA quantum circuit both comprise two CNOT quantum logic gates and one TOFFOLI quantum logic gate, and the MAJ module and the UMA module of the target module number are cascaded according to an addition instruction, and before the step of generating the target quantum circuit corresponding to the adder, the method further comprises the steps of: acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and one TOFFOLI quantum logic gate, a control relation among the operation quantum bits and a time sequence relation between the two CNOT quantum logic gates and one TOFFOLI quantum logic gate; and constructing the two CNOT quantum logic gates and one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation to generate the MAJ quantum circuit or the UMA quantum circuit as a corresponding MAJ module or UMA module.
In this embodiment, the MAJ module and the UMA module form a front and rear cascade unit of the adder. As shown in fig. 11, the MAJ module is configured to extract the carry term after each stage of addition operation and transfer the carry term to the next stage, thereby calculating the final carry term. As shown in fig. 12, the MAJ module may mainly consist of three logic gates, two CNOT gates and one Toffoli gate. The role of the CNOT gate (first, second logic gate from left to right in FIG. 12) is: adding the control bits to the target bits to form a modulo-2 addition, i.e., an exclusive-or operation, to obtain (e i +c i )%2、(e i +f i ) %2, the order of the two CNOT gates can be exchanged. The function of the Toffoli gate (third logic gate from left to right in fig. 12) is: adding both control bits to the target bit to obtain a carry term c [i+1] = (e [i] AND f [i] ) XOR (e [i] AND f [i] ) XOR (e [i] AND f [i] ). I.e. by the first CNOT gate from left to right in FIG. 12The +.A. is realized by the second CNOT gate from left to right in FIG. 12>Through left-to-right in FIG. 12Three TOFFOLI gate implementation c i+1 Thus, a front-stage cascade unit of the quantum adder is formed by 2 CNOT gates and 1 TOFFOLI gate.
Example 1: e, e i Is 1, f i 1, c i 1.
MAJ Module starts to handle e i Added to c i On, c i The value of the upper is changed to 0, and then e is set i Added to f i Upper f i The value of the last is also changed to 0, and finally f is used i And c i Added to e i On e i The value of (c) becomes 1, namely c i+1 Is 1.
Example 2: e, e i Is 0, f i 1, c i 1.
MAJ Module starts to handle e i Added to c i On, c i The value of the above is changed to 1, and then e is set i Added to f i Upper f i The value of the last is also 1, and f is finally used i And c i Added to e i On e i The value of (c) becomes 1, namely c i+1 Is 1.
As shown in FIG. 13, the UMA module is used in the later stage of the cascaded adder, and the UMA module is implemented in a similar manner to the MAJ module, as shown in FIG. 14, by first using the Toffoli gate (the first logic gate from left to right in FIG. 14) to divide c i+1 Reduction to e i Reuse e i One reduction of (e+c)% 2 with CNOT gate (second logic gate from left to right in FIG. 14), will (e) i +c i ) %2 reduction to c i Finally, reuse c i Couple (e) i +f i ) %2 is done once as CNOT gate (third logic gate from left to right in FIG. 14) to get the final result s of the current bit [i] =e [i] XOR f [i] XOR c [i]
Example 1: (e) i +c i ) %2 is 0, (e) i +f i ) %2 is 0, c i+1 1.
Starting handle (e) i +c i ) %2 and (e) i +f i ) %2 to c i+1 On, c i+1 The value of (2) becomes 1 and the meaning of the expression becomes e i Reuse e i Added to (e) i +c i ) %2, (e) i +c i ) The value of% 2 becomes 1, and the meaning of the expression becomes c i Reuse c i Added to (e) i +f i ) %2, (e) i +f i ) The value of% 2 becomes 1 and the meaning becomes s i
Example 2: (e) i +c i ) %2 is 1, (e) i +f i ) %2 is 1, c i+1 1.
Starting handle (e) i +c i ) %2 and (e) i +f i ) %2 to c i+1 On, c i+1 The value of (2) becomes 0 and the meaning becomes e i Reuse e i Added to (e) i +c i ) %2, (e) i +c i ) The value of% 2 becomes 1 and the meaning becomes c i Reuse c i Added to (e) i +f i ) %2, (e) i +f i ) The value of% 2 becomes 0 and the meaning becomes s i
The last CNOT gate from top to bottom in FIG. 10, i.e. the CNOT gate in the middle of the whole adder MAJ module and UMA module, is used to save c i+1 As a result of (a).
S403, carrying out addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit, generating a target quantum state result and outputting the result.
In this embodiment, the two quantum states to be operated, such as |111> and |111>, are input into the adder (i.e. the target quantum circuit) to obtain the corresponding binary representation target quantum state calculation result (including the carry term and the result term obtained by directly adding the sub-quantum states). And then directly outputting the target quantum state result |1110> of the binary representation, or further converting the target quantum state result |1110> into a decimal result 14 and outputting the decimal result to finish the addition operation of the two target data.
It can be seen that, by obtaining the dividend data and the divisor data to be operated, converting the dividend data into the first target quantum state, converting the divisor data into the second target quantum state, iteratively executing the quantum state evolution corresponding to the subtraction operation on the first target quantum state and the second target quantum state, counting the execution times of the subtraction operation until the dividend data is subtracted into the negative number, outputting the finally obtained count result as the integer bit of the quotient of the dividend data and the divisor data, outputting the quantum state evolution corresponding to the decimal operation of the iterative execution operator on the current first target quantum state and the current second target quantum state, and outputting the quantum state on the finally obtained preset precision bit quantum bit, thereby realizing the basic arithmetic operation in the quantum circuit and filling the blank of the related technology.
Referring to fig. 15, fig. 15 is a schematic structural diagram of a quantum division operation device with precision according to an embodiment of the present invention, which may include:
the conversion module 1501 is configured to obtain dividend data and divisor data to be operated, convert the dividend data into a first target quantum state, and convert the divisor data into a second target quantum state; wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
a first quantum state evolution module 1502, configured to iteratively perform quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state, count the number of times of execution of the subtraction operation until the dividend data is subtracted to a negative number, and output a finally obtained count result as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
a second quantum state evolution module 1503, configured to iteratively execute quantum state evolution corresponding to the decimal operation of the quotient for the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
And an output module 1504, configured to output a quantum state on the finally obtained preset precision bit qubit, where the quantum state includes a binary value of the decimal of the quotient.
Specifically, the first quantum state evolution module is specifically configured to:
executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction operation result;
performing quantum state evolution corresponding to subtraction operation on a third target quantum state of the current first preset auxiliary bit and a fourth target quantum state of the current second preset auxiliary bit to add 1 to a value contained in the current third target quantum state; wherein, the initial value contained in the third target quantum state and the value contained in the fourth target quantum state are both-1;
measuring a sign bit sub-quantum state of a first target quantum state currently containing a subtraction result, and judging whether the value of the sign bit of the first target quantum state currently containing the subtraction result is 0 or not;
and under the condition that the value of the sign bit of the first target quantum state currently containing the subtraction result is 0, returning to the step of executing the quantum state evolution corresponding to the subtraction between the current first target quantum state and the current second target quantum state until the value of the sign bit of the first target quantum state currently containing the subtraction result is 1.
Specifically, the output module is specifically configured to:
and outputting a third target quantum state finally obtained, wherein the third target quantum state comprises an integer bit binary value of a quotient of the dividend data and the divisor data.
Specifically, the second quantum state evolution module is specifically configured to:
inverting the sign bit quantum state of the current second target quantum state, and executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state after the inversion of the sign bit so as to evolve the current first target quantum state into a quantum state containing a binary value of a remainder obtained by dividing the divisor data by the divisor data;
shifting each bit quantum state of the current first target quantum state by one bit leftwards, inverting the sign bit quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state after shifting leftwards by one bit and the second target quantum state after inverting again, and counting the execution times of the subtraction operation until the first target quantum state after shifting leftwards by one bit is subtracted into negative number, and obtaining a decimal quantum state of a binary value containing a counting result on a preset intermediate bit quantum bit;
The last sub-quantum state of the decimal quantum state and the initial quantum state of the corresponding preset precision bit quantum bit are processedExchanging states and outputting quantum states on the exchanged preset precision bit quantum bits;
and returning to execute the step of inverting the sign bit sub-quantum state of the current second target quantum state, and executing the quantum state evolution step corresponding to the subtraction operation on the second target quantum state after inverting the current first target quantum state and the sign bit until reaching the preset iteration times required by the iteration execution of the quantum state evolution corresponding to the decimal operation of the quotient, wherein the preset iteration times are consistent with the digits of the decimal precision to be calculated.
Specifically, the device further comprises:
the execution module is used for obtaining preset sign bit quantum bits, and executing preset quantum logic gate operation on the quantum bits corresponding to the sign bit sub-quantum states of the first target quantum state, the quantum bits corresponding to the sign bit sub-quantum states of the second target quantum state, the first preset auxiliary bits and the preset sign bit quantum bits to finally obtain the sign value represented by the sign bit sub-quantum states in the third target quantum state.
Specifically, the operation module includes:
the first complement operation unit is used for respectively taking two quantum states to be operated as a reduced quantum state containing reduced data and a reduced quantum state containing reduced data to acquire a quantum state of a third preset auxiliary bit, and controlling the reduced quantum state to execute quantum state evolution corresponding to complement operation according to a symbol bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to acquire a first complement quantum state; wherein the first complement quantum state is a quantum state containing a complement of the reduced data;
the second complement operation unit is used for executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the number reduction quantum state, and controlling quantum state evolution corresponding to the current number reduction quantum state execution complement operation according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit to obtain a second complement quantum state; wherein the second complement quantum state is a quantum state containing a complement of the reduction data;
an addition operation unit, configured to perform quantum state evolution corresponding to addition operation on the first complement quantum state and the second complement quantum state, so as to evolve the first complement quantum state into a fifth target quantum state that includes a sum of a complement of the subtracted data and a complement of the subtracted data;
The third complement operation unit is used for controlling the fifth target quantum state to execute the quantum state evolution corresponding to the complement operation according to the symbol bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit, obtaining an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction result of the subtracted data and the subtracted data; wherein the sixth target quantum state is a complement quantum state comprising the sum of the complement codes;
and the fourth complement operation unit is used for controlling the current reduction quantum state to execute quantum state evolution corresponding to complement operation according to the sign bit sub-quantum state in the current reduction quantum state and the quantum state of the current third preset auxiliary bit, and executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the current reduction quantum state so as to restore the current reduction quantum state.
Specifically, the first complement operation unit is specifically configured to:
executing CNOT gate operation on a first sign bit quantum bit corresponding to a sign bit sub-quantum state in the reduced number quantum state and the third preset auxiliary bit, wherein the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
According to the quantum state of the third preset auxiliary bit after CNOT gate operation is executed, controlling whether the current subtracted quantum state executes quantum state evolution corresponding to complement code operation or not;
if yes, inverting the non-sign sub-quantum state of the current subtracted quantum state, and inverting the inverted subtracted quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain an evolved first complement quantum state, otherwise, taking the subtracted number quantum state as the first complement quantum state;
performing CNOT gate operation on the current first sign bit quantum bit and the third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Specifically, the second complement operation unit is specifically configured to:
performing an X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the reduced number quantum state to obtain a reversed sign bit sub-quantum state;
executing CNOT gate operation on the current second sign bit quantum bit and a third preset auxiliary bit, wherein the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
According to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed, controlling whether the current subtractive quantum state executes quantum state evolution corresponding to the complement code operation or not;
if so, inverting the unsigned bit quantum state of the current reduced quantum state, and mixing the inverted reduced quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain evolved second complement quantum states, otherwise, taking the current reduced quantum states as the second complement quantum states;
performing CNOT gate operation on the current second sign bit quantum bit and the third preset auxiliary bit to restore the current quantum state of the third preset auxiliary bit; the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
Specifically, the addition unit includes:
the determining subunit is used for determining the number of target modules of a front cascade module MAJ module to be cascaded and a rear cascade module UMA module to be cascaded according to the number of quantum bits corresponding to the two quantum states to be operated, wherein the number of the modules of the MAJ module is the same as the number of the modules of the UMA module;
The cascade subunit is used for cascading the MAJ modules and UMA modules with the number of the target modules according to the addition instruction to generate a target quantum circuit corresponding to the adder;
and the operation subunit is used for carrying out addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit, generating a target quantum state result and outputting the result.
Specifically, the MAJ module is a MAJ quantum wire, the UMA module is a UMA quantum wire, the MAJ quantum wire and the UMA quantum wire both comprise two CNOT quantum logic gates and one TOFFOLI quantum logic gate,
the addition operation unit further includes:
the acquisition subunit is used for acquiring the operation quantum bits corresponding to the two CNOT quantum logic gates and one TOFFOLI quantum logic gate, the control relation between the operation quantum bits and the time sequence relation between the two CNOT quantum logic gates and one TOFFOLI quantum logic gate;
and the constructing subunit is used for constructing and generating the MAJ quantum circuit or the UMA quantum circuit as a corresponding MAJ module or UMA module according to the operation quantum bit, the control relation and the time sequence relation.
Specifically, the MAJ module and the UMA module each include three input items and three output items, and the cascade subunit is specifically configured to:
according to the addition instruction, three output items of an MAJ cascade module are used as three input items of a corresponding UMA cascade module, so that the MAJ cascade module and the corresponding UMA cascade module are cascaded, a target quantum circuit corresponding to the adder is generated, wherein the MAJ cascade module is determined by cascading MAJ modules with the number of target modules, and the UMA cascade module is determined by cascading UMA modules with the number of target modules.
Specifically, the three input items of the MAJ module include one carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module include one carry output item and two intermediate result output items, the three input items of the UMA module include one carry output item and two intermediate result output items of the corresponding MAJ module, and the three output items of the UMA module include one result carry output item, an accumulation sum output item and one sub-quantum state input item to be calculated; the cascade subunit is specifically configured to:
According to the addition instruction, taking a carry output item output by the last MAJ module and the two sub-quantum state input items to be calculated as three input items of the next MAJ module, so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of one MAJ module as two input items of a corresponding UMA module, acquiring a last UMA module of the corresponding UMA module, taking a result carry output item of the last UMA module as one input item of the corresponding UMA module, and cascading the MAJ modules with the target modules and UAM modules with the target modules to generate an initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
adding a CNOT quantum logic gate between the last MAJ module and the corresponding first UMA module in the initial quantum circuit, wherein a quantum bit corresponding to a carry output item of the MAJ module is used as a control bit, and a preset carry auxiliary bit is used as a controlled bit, so as to generate a target quantum circuit of the adder.
Therefore, the invention obtains the dividend data and the divisor data to be operated, converts the dividend data into the first target quantum state, converts the divisor data into the second target quantum state, iteratively executes quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state, counts the execution times of the subtraction operation until the dividend data is subtracted into a negative number, outputs the finally obtained counting result as integer bits of a quotient of the dividend data and the divisor data, and outputs the quantum state evolution corresponding to the decimal operation of the iterative execution quotient on the current first target quantum state and the current second target quantum state and finally obtained quantum state on the preset precision bit quantum bit, thereby realizing basic arithmetic operation in a quantum circuit and filling the blank of related technology.
Yet another embodiment of the present invention provides an electronic device comprising a memory having a computer program stored therein and a processor configured to run the computer program to perform a method as described below:
s1, obtaining divisor data and divisor data to be operated, converting the divisor data into a first target quantum state, and converting the divisor data into a second target quantum state; wherein the target quantum state comprises: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
s2, carrying out quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state in an iterative manner, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, and outputting a counting result finally obtained as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
s3, iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
And S4, outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
Yet another embodiment of the present invention provides a storage medium having a computer program stored therein, wherein the computer program is configured to, when run, perform the method of:
s1, obtaining divisor data and divisor data to be operated, converting the divisor data into a first target quantum state, and converting the divisor data into a second target quantum state; wherein the target quantum state comprises: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
s2, carrying out quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state in an iterative manner, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, and outputting a counting result finally obtained as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
S3, iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
and S4, outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.

Claims (15)

1. A quantum division operation method with precision, the method comprising:
the method comprises the steps of obtaining divisor data and divisor data to be operated, converting the divisor data into a first target quantum state, and converting the divisor data into a second target quantum state; wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
Iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state, counting the execution times of the subtraction operation until the dividend data is subtracted into a negative number, and outputting a counting result finally obtained as an integer bit of a quotient of the dividend data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state until reaching preset iteration times; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
and outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
2. The method of claim 1, wherein iteratively performing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state and counting a number of times the subtraction is performed until the dividend data is subtracted to a negative number, comprises:
Executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction operation result;
performing quantum state evolution corresponding to subtraction operation on a third target quantum state of the current first preset auxiliary bit and a fourth target quantum state of the current second preset auxiliary bit to add 1 to a value contained in the current third target quantum state; wherein the first preset auxiliary bit is a quantum bit of the encoder; the second preset auxiliary bit is a quantum bit of a coding counting result, and the initial value contained in the third target quantum state and the value contained in the fourth target quantum state are both-1;
measuring a sign bit sub-quantum state of a first target quantum state currently containing a subtraction result, and judging whether the value of the sign bit of the first target quantum state currently containing the subtraction result is 0 or not;
and under the condition that the value of the sign bit of the first target quantum state currently containing the subtraction result is 0, returning to the step of executing the quantum state evolution corresponding to the subtraction between the current first target quantum state and the current second target quantum state until the value of the sign bit of the first target quantum state currently containing the subtraction result is 1.
3. The method according to claim 2, wherein outputting the finally obtained count result as integer bits of a quotient of the dividend data and the divisor data comprises:
and outputting a third target quantum state finally obtained, wherein the third target quantum state comprises an integer bit binary value of a quotient of the dividend data and the divisor data.
4. A method according to claim 3, wherein iteratively performing the quantum state evolution corresponding to the quotient's decimal operation on the current first target quantum state and the current second target quantum state comprises:
inverting the sign bit quantum state of the current second target quantum state, and executing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state after the inversion of the sign bit so as to evolve the current first target quantum state into a quantum state containing a binary value of a remainder obtained by dividing the divisor data by the divisor data;
shifting each bit quantum state of the current first target quantum state by one bit leftwards, inverting the sign bit quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction operation on the first target quantum state after shifting leftwards by one bit and the second target quantum state after inverting again, and counting the execution times of the subtraction operation until the first target quantum state after shifting leftwards by one bit is subtracted into negative number, and obtaining a decimal quantum state of a binary value containing a counting result on a preset intermediate bit quantum bit;
The last sub-quantum state of the decimal quantum state and the initial quantum state of the corresponding preset precision bit quantum bit are processedExchanging states and outputting quantum states on the exchanged preset precision bit quantum bits;
and returning to execute the step of inverting the sign bit sub-quantum state of the current second target quantum state, and executing the quantum state evolution step corresponding to the subtraction operation on the second target quantum state after inverting the current first target quantum state and the sign bit until reaching the preset iteration times required by the iteration execution of the quantum state evolution corresponding to the decimal operation of the quotient, wherein the preset iteration times are consistent with the digits of the decimal precision to be calculated.
5. The method according to claim 4, wherein the method further comprises:
obtaining preset sign bit quantum bits, and executing preset quantum logic gate operation on the quantum bits corresponding to the sign bit sub-quantum states of the first target quantum state, the quantum bits corresponding to the sign bit sub-quantum states of the second target quantum state, the first preset auxiliary bits and the preset sign bit quantum bits to finally obtain the sign value represented by the sign bit sub-quantum states in the third target quantum state.
6. The method of any one of claims 1-5, wherein performing quantum state evolution corresponding to a subtraction operation comprises:
for two quantum states to be operated, respectively serving as a reduced quantum state containing reduced data and a reduced quantum state containing reduced data, acquiring a quantum state of a third preset auxiliary bit, and controlling the reduced quantum state to execute quantum state evolution corresponding to complement operation according to a symbol bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to acquire a first complement quantum state; the first complement quantum state is a quantum state containing the complement of the reduced number data, and a third preset auxiliary bit is used for controlling whether to perform complement operation or not;
executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the number reduction quantum state, and controlling the current number reduction quantum state to execute quantum state evolution corresponding to complement operation according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit to obtain a second complement quantum state; wherein the second complement quantum state is a quantum state containing a complement of the reduction data;
Performing quantum state evolution corresponding to addition operation on the first complement quantum state and the second complement quantum state to evolve the first complement quantum state into a fifth target quantum state containing the sum of the complement of the subtracted data and the complement of the subtracted data;
according to the symbol bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit, controlling the fifth target quantum state to execute quantum state evolution corresponding to complement operation, obtaining an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction result of the subtracted data and the subtracted data; wherein the sixth target quantum state is a complement quantum state comprising the sum of the complement codes;
according to the sign bit sub-quantum state in the current reducing quantum state and the quantum state of the current third preset auxiliary bit, controlling the current reducing quantum state to execute quantum state evolution corresponding to the complement operation, and executing quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the current reducing quantum state so as to restore the current reducing quantum state.
7. The method of claim 6, wherein the controlling the reduced quantum states to perform the quantum state evolution corresponding to the complement operation according to the sign bit sub-quantum state in the reduced quantum states and the quantum state of the third preset auxiliary bit comprises:
Executing CNOT gate operation on a first sign bit quantum bit corresponding to a sign bit sub-quantum state in the reduced number quantum state and the third preset auxiliary bit, wherein the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
according to the quantum state of the third preset auxiliary bit after CNOT gate operation is executed, controlling whether the current subtracted quantum state executes quantum state evolution corresponding to complement code operation or not;
if yes, inverting the non-sign sub-quantum state of the current subtracted quantum state, and inverting the inverted subtracted quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain an evolved first complement quantum state, otherwise, taking the subtracted number quantum state as the first complement quantum state;
performing CNOT gate operation on the current first sign bit quantum bit and the third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; the first sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
8. The method of claim 6, wherein performing the quantum state evolution corresponding to sign bit inversion on the sign bit sub-quantum state in the reduced quantum state, and controlling the quantum state evolution corresponding to the complement operation performed on the current reduced quantum state according to the inverted sign bit sub-quantum state and the quantum state of the third preset auxiliary bit, comprises:
Performing an X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the reduced number quantum state to obtain a reversed sign bit sub-quantum state;
executing CNOT gate operation on the current second sign bit quantum bit and a third preset auxiliary bit, wherein the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit;
according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed, controlling whether the current subtractive quantum state executes quantum state evolution corresponding to the complement code operation or not;
if so, inverting the unsigned bit quantum state of the current reduced quantum state, and mixing the inverted reduced quantum state with the quantum state of the fourth preset auxiliary bitPerforming addition operation on the states to obtain evolved second complement quantum states, otherwise, taking the current reduced quantum states as the second complement quantum states;
performing CNOT gate operation on the current second sign bit quantum bit and the third preset auxiliary bit to restore the current quantum state of the third preset auxiliary bit; the second sign bit quantum bit is a control bit, and the third preset auxiliary bit is a controlled bit.
9. The method of claim 6, wherein the performing the quantum state evolution corresponding to the addition operation comprises:
determining the number of target modules of a front cascade module MAJ module to be cascaded and a rear cascade module UMA module to be cascaded according to the number of quantum bits corresponding to two quantum states to be operated, wherein the number of the modules of the MAJ module is the same as the number of the modules of the UMA module;
cascading the MAJ modules and UMA modules with the number of the target modules according to the addition instruction to generate a target quantum circuit corresponding to the adder;
and carrying out addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit, generating a target quantum state result and outputting the result.
10. The method of claim 9, wherein the MAJ module is a MAJ quantum wire, the UMA module is a UMA quantum wire, the MAJ quantum wire and the UMA quantum wire each comprise two CNOT quantum logic gates and one TOFFOLI quantum logic gate,
and before the step of cascading the MAJ modules and UMA modules with the number of the target modules according to the addition instruction and generating the target quantum circuit corresponding to the adder, the method further comprises the following steps:
Acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and one TOFFOLI quantum logic gate, a control relation among the operation quantum bits and a time sequence relation between the two CNOT quantum logic gates and one TOFFOLI quantum logic gate;
and constructing the two CNOT quantum logic gates and one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation to generate the MAJ quantum circuit or the UMA quantum circuit as a corresponding MAJ module or UMA module.
11. The method of claim 10, wherein the MAJ module and the UMA module each include three input items and three output items,
according to the addition instruction, the MAJ modules and UMA modules with the number of the target modules are cascaded, and the step of generating the target quantum circuit corresponding to the adder specifically comprises the following steps:
according to the addition instruction, three output items of an MAJ cascade module are used as three input items of a corresponding UMA cascade module, so that the MAJ cascade module and the corresponding UMA cascade module are cascaded, a target quantum circuit corresponding to the adder is generated, wherein the MAJ cascade module is determined by cascading MAJ modules with the number of target modules, and the UMA cascade module is determined by cascading UMA modules with the number of target modules.
12. The method of claim 11, wherein the three inputs of the MAJ module include a carry input and two sub-quantum state inputs to be calculated, the three outputs of the MAJ module include a carry output and two intermediate result outputs, the three inputs of the UMA module include a carry output and two intermediate result outputs corresponding to the MAJ module, the three outputs of the UMA module include a result carry output, a accumulate and output, and a sub-quantum state input to be calculated,
according to the addition instruction, the step of using three output items of a MAJ cascade module as three input items of a corresponding UMA cascade module to cascade the MAJ cascade module and the corresponding UMA cascade module, and generating a target quantum circuit corresponding to the adder specifically includes:
according to the addition instruction, taking a carry output item output by the last MAJ module and the two sub-quantum state input items to be calculated as three input items of the next MAJ module, so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of one MAJ module as two input items of a corresponding UMA module, acquiring a last UMA module of the corresponding UMA module, taking a result carry output item of the last UMA module as one input item of the corresponding UMA module, and cascading the MAJ modules with the target modules and UAM modules with the target modules to generate an initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
Adding a CNOT quantum logic gate between the last MAJ module and the corresponding first UMA module in the initial quantum circuit, wherein a quantum bit corresponding to a carry output item of the MAJ module is used as a control bit, and a preset carry auxiliary bit is used as a controlled bit, so as to generate a target quantum circuit of the adder.
13. A quantum division arithmetic device with precision, the device comprising:
the conversion module is used for acquiring divisor data to be operated and divisor data, converting the divisor data into a first target quantum state and converting the divisor data into a second target quantum state; wherein the target quantum states include: a sign bit sub-quantum state representing the data sign and a magnitude bit sub-quantum state representing the data magnitude;
the first quantum state evolution module is used for carrying out quantum state evolution corresponding to subtraction operation on the first target quantum state and the second target quantum state in an iterative manner, counting the execution times of the subtraction operation until the divisor data is subtracted into a negative number, and outputting a finally obtained counting result as an integer bit of a quotient of the divisor data and the divisor data; wherein, the number to be subtracted of each execution of the subtraction operation is the subtraction result of the last execution of the subtraction operation, and the number to be subtracted is the divisor data;
The second quantum state evolution module is used for iteratively executing quantum state evolution corresponding to decimal operation of the quotient on the current first target quantum state and the current second target quantum state; the preset iteration times of the iteration are consistent with the number of bits of the decimal precision to be calculated, and quantum states containing values of corresponding precision bits are obtained on corresponding preset precision bit quantum bits after each iteration;
and the output module is used for outputting the quantum state on the finally obtained preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal of the quotient.
14. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 12.
15. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of claims 1 to 12 when run.
CN202011059513.1A 2020-09-30 2020-09-30 Quantum division operation method and device with precision Active CN112162724B (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202011059513.1A CN112162724B (en) 2020-09-30 2020-09-30 Quantum division operation method and device with precision
EP21874279.9A EP4224308A1 (en) 2020-09-30 2021-09-17 Quantum division operation method and apparatus with precision
US18/029,558 US12086569B2 (en) 2020-09-30 2021-09-17 Method and device for quantum division operation with precision
PCT/CN2021/119125 WO2022068618A1 (en) 2020-09-30 2021-09-17 Quantum division operation method and apparatus with precision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011059513.1A CN112162724B (en) 2020-09-30 2020-09-30 Quantum division operation method and device with precision

Publications (2)

Publication Number Publication Date
CN112162724A CN112162724A (en) 2021-01-01
CN112162724B true CN112162724B (en) 2024-02-09

Family

ID=73862338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011059513.1A Active CN112162724B (en) 2020-09-30 2020-09-30 Quantum division operation method and device with precision

Country Status (1)

Country Link
CN (1) CN112162724B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12086569B2 (en) 2020-09-30 2024-09-10 Origin Quantum Computing Technology (Hefei) Co., Ltd. Method and device for quantum division operation with precision
CN115879554B (en) * 2021-09-28 2024-06-14 本源量子计算科技(合肥)股份有限公司 Quantum modulus square operation method and device, electronic device and modulus arithmetic component

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2062549C1 (en) * 1992-09-30 1996-06-20 Научно-производственное предприятие "Всероссийский научно-исследовательский институт электромеханики с заводом" Analog-to-digital converter
JPH10116267A (en) * 1996-10-09 1998-05-06 Sony Corp Arithmetic unit and information processor
CN1952875A (en) * 2006-09-18 2007-04-25 华为技术有限公司 A fixed-point divider and operational method thereof
CN103699356A (en) * 2012-09-27 2014-04-02 任光前 Parallel division algorithm and parallel division calculator
CN104636113A (en) * 2015-02-06 2015-05-20 周炜 Algorithm for processing big integer through computer
CN104699450A (en) * 2015-03-18 2015-06-10 浪潮集团有限公司 Base-16 fixed point divider based on carry-save adder
CN110188885A (en) * 2019-06-28 2019-08-30 合肥本源量子计算科技有限责任公司 A kind of quantum calculation analogy method, device, storage medium and electronic device
CN111610959A (en) * 2020-05-21 2020-09-01 陆丽娜 Two-dimensional, multi-dimensional and data processing method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030093451A1 (en) * 2001-09-21 2003-05-15 International Business Machines Corporation Reversible arithmetic coding for quantum data compression

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2062549C1 (en) * 1992-09-30 1996-06-20 Научно-производственное предприятие "Всероссийский научно-исследовательский институт электромеханики с заводом" Analog-to-digital converter
JPH10116267A (en) * 1996-10-09 1998-05-06 Sony Corp Arithmetic unit and information processor
CN1952875A (en) * 2006-09-18 2007-04-25 华为技术有限公司 A fixed-point divider and operational method thereof
CN103699356A (en) * 2012-09-27 2014-04-02 任光前 Parallel division algorithm and parallel division calculator
CN104636113A (en) * 2015-02-06 2015-05-20 周炜 Algorithm for processing big integer through computer
CN104699450A (en) * 2015-03-18 2015-06-10 浪潮集团有限公司 Base-16 fixed point divider based on carry-save adder
CN110188885A (en) * 2019-06-28 2019-08-30 合肥本源量子计算科技有限责任公司 A kind of quantum calculation analogy method, device, storage medium and electronic device
CN111610959A (en) * 2020-05-21 2020-09-01 陆丽娜 Two-dimensional, multi-dimensional and data processing method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
(全)同态加密及其在云计算中的应用研究;蒋林智;《CNKI学位》;第2018年卷(第10期);全文 *
Four Arithmetic Operations on the Quantum Computer;Yong Zhang;《Journal of Physics: Conference Series》;第1575卷;第1-7页 *

Also Published As

Publication number Publication date
CN112162724A (en) 2021-01-01

Similar Documents

Publication Publication Date Title
CN112162723B (en) Quantum subtraction operation method, device, electronic device and storage medium
CN112114776B (en) Quantum multiplication method, device, electronic device and storage medium
CN111563599B (en) Quantum circuit decomposition method and device, storage medium and electronic device
CN112162724B (en) Quantum division operation method and device with precision
CN112214200B (en) Quantum subtraction operation method, device, electronic device and storage medium
CN113222156B (en) Quantum simulation method and device for operation to be executed
CN113222157B (en) Quantum simulation method, quantum simulation device, electronic device and storage medium
CN115809707B (en) Quantum comparison operation method, device, electronic device and basic arithmetic component
CN112162725B (en) Quantum division operation method, quantum division operation device, electronic device and storage medium
CN115809706B (en) Quantum modulus multiplication operation method and device, electronic device and modulus arithmetic component
CN115809042B (en) Quantum modulus addition operation method and device, electronic device and modulus arithmetic component
CN115879554B (en) Quantum modulus square operation method and device, electronic device and modulus arithmetic component
CN116048458B (en) Quantum computation-based numerical dividing method, device, equipment and storage medium
CN115936127B (en) Quantum technology-based numerical comparison method and device and quantum computer
CN115879552B (en) Quantum modulus multiplication inverse operation method and device, electronic device and modulus arithmetic component
CN115879555B (en) Quantum modulus rapid multiplication operation method, device and modulus arithmetic component
CN115879553B (en) Quantum modulus complete multiplication method and device and modulus arithmetic component
CN116049506B (en) Quantum calculation-based numerical value searching method, device, equipment and storage medium
US12086569B2 (en) Method and device for quantum division operation with precision
WO2024109730A1 (en) Variable modular multiplier, operation method, and related device
CN115879557B (en) Quantum circuit-based data size comparison method and device and quantum computer
CN115713122B (en) Method and device for determining size relation between quantum data and classical data
CN115879556A (en) Quantum modulus operation method, device, medium and modulus arithmetic component
CN118095458A (en) Variable modular multiplication arithmetic unit, arithmetic method and related device
CN117744817A (en) Quantum Fourier transform-based constant modulus adder, method and related device

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
CB02 Change of applicant information
CB02 Change of applicant information

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

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

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

Applicant before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI

GR01 Patent grant
GR01 Patent grant