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

Quantum division operation method and device with precision Download PDF

Info

Publication number
CN112162724A
CN112162724A CN202011059513.1A CN202011059513A CN112162724A CN 112162724 A CN112162724 A CN 112162724A CN 202011059513 A CN202011059513 A CN 202011059513A CN 112162724 A CN112162724 A CN 112162724A
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.)
Granted
Application number
CN202011059513.1A
Other languages
Chinese (zh)
Other versions
CN112162724B (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.)
Origin Quantum Computing Technology Co Ltd
Original Assignee
Origin Quantum Computing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Origin Quantum Computing Technology Co Ltd filed Critical Origin Quantum Computing Technology Co Ltd
Priority to CN202011059513.1A priority Critical patent/CN112162724B/en
Publication of CN112162724A publication Critical patent/CN112162724A/en
Priority to US18/029,558 priority patent/US20230376276A1/en
Priority to PCT/CN2021/119125 priority patent/WO2022068618A1/en
Priority to EP21874279.9A priority patent/EP4224308A1/en
Application granted granted Critical
Publication of CN112162724B publication Critical patent/CN112162724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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

Abstract

The invention belongs to the field of quantum computation, in particular to a quantum division operation method with precision and a device thereof, 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 reduced to a negative number, outputting a finally obtained counting result as an integer number of a quotient obtained by dividing the dividend data and 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, and outputting the finally obtained quantum state on a quantum bit of a preset precision. The invention can be used for basic arithmetic operation in quantum circuit, and fills the blank of 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 take advantage of the quantum's superposition, theoretically having the ability to accelerate exponentially in some cases. For example, the RSA key is decrypted in hundreds of years in a classical computer, whereas the quantum algorithm is executed in a quantum computer in hours. However, the current quantum computer is limited in the number of controllable bits due to the development of quantum chip hardware, so that the computing power is limited, and quantum algorithms cannot be generally operated. The common practice of quantum algorithms generally requires simulation via quantum computation.
In the simulation implementation process of the quantum algorithm, various quantum logic gates are usually needed to construct the quantum algorithm, but when the quantum algorithm is constructed only by the various quantum logic gates, the quantum logic gates corresponding to the basic arithmetic operation operations of classical operations such as addition, subtraction, multiplication and division are not provided. Therefore, it is desirable to provide a technique capable of performing basic arithmetic operations in quantum wires to fill the gap in the related art.
Disclosure of Invention
The invention aims to provide a quantum division operation method with precision and a device thereof, which are used for solving the defects in the prior art, filling the blank of the related technology and realizing the 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:
obtaining dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state, counting the execution times of the subtraction until the dividend data is reduced to a negative number, and outputting a finally obtained counting result as an integer number of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
iteratively executing quantum state evolution corresponding to 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and outputting the finally obtained quantum state on the preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal place of the quotient.
Optionally, the iteratively executing quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state, and counting the number of times of execution of the subtraction operation until the dividend data is reduced to a negative number includes:
performing quantum state evolution corresponding to subtraction on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction 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 the sign bit sub-quantum state of the first target quantum state currently containing the 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.
Optionally, the outputting the finally obtained counting result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data includes:
and outputting the finally obtained third target quantum state, wherein the third target quantum state comprises an integer bit binary value of the quotient of the dividend data and the divisor data.
Optionally, the iteratively executing the 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 includes:
negating the sign bit sub-quantum state of the current second target quantum state, and performing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the sign bit-negated second target quantum state so as to evolve the current first target quantum state into a quantum state containing a remainder binary value of the dividend data divided by the divisor data;
shifting each sub quantum state of the current first target quantum state by one bit to the left, re-inverting the sign bit sub quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state shifted by one bit to the left and the second target quantum state re-inverted, and counting the execution times of the subtraction until the first target quantum state shifted by one bit to the left is reduced to a negative number, and obtaining a small bit quantum state containing a binary value of a counting result on a preset intermediate bit quantum bit;
exchanging the last quantum state of the decimal quantum state with the initial quantum state |0> state of the corresponding quantum bit with the preset precision, and outputting the quantum state on the exchanged quantum bit with the preset precision;
and 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 current first target quantum state and the second target quantum state after inverting the sign bit until the preset iteration frequency required by iteratively executing the quantum state evolution corresponding to the decimal place operation of the quotient is reached, wherein the preset iteration frequency is consistent with the digit of the decimal place precision to be calculated.
Optionally, the method further includes:
and acquiring a preset sign bit qubit, and executing preset quantum logic gate operation on the qubit corresponding to the sign bit sub-quantum state of the first target quantum state, the qubit corresponding to the sign bit sub-quantum state of the second target quantum state, the first preset auxiliary bit and the preset sign bit qubit so as to finally obtain a sign value represented by the sign bit sub-quantum state in the third target quantum state.
Optionally, the performing of 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 complementary code operation according to a sign bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to obtain a first complementary code quantum state; wherein the first complement quantum state is a quantum state that comprises a complement of the subtrahend data;
executing quantum state evolution corresponding to sign bit negation on the sign bit sub-quantum state in the reduced quantum state, and controlling the current reduced quantum state to execute quantum state evolution corresponding to complementary code operation according to the sign bit sub-quantum state after negation and the quantum state of the third preset auxiliary bit to obtain a second complementary code quantum state; wherein the second complement quantum state is a quantum state that comprises a complement of the subtrahend data;
performing quantum state evolution corresponding to an 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 comprising a sum of the complement of the subtrahend data and the complement of the subtrahend data;
controlling the fifth target quantum state to execute quantum state evolution corresponding to complementary code operation according to the sign bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit to obtain an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction operation 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 complements;
and controlling the current reduction quantum state to execute quantum state evolution corresponding to the complementing code 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 negation on the sign bit sub-quantum state in the current reduction quantum state so as to restore the current reduction quantum state.
Optionally, the controlling, according to the sign bit sub-quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit, the reduced quantum state to execute the quantum state evolution corresponding to the complementing code operation includes:
performing a CNOT gate operation on a first sign bit qubit and a third preset auxiliary bit corresponding to a sign bit qubit in the subtracted quantum states, wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit;
controlling whether the current subtracted quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current reduced quantum state, and performing quantum state evolution corresponding to addition operation on the negated reduced quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved first complementary code quantum state, otherwise, taking the reduced quantum state as the first complementary code quantum state;
performing a CNOT gate operation on the current first sign bit qubit and a third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Optionally, the performing, by the sign bit sub-quantum state in the reduced quantum state, quantum state evolution corresponding to sign bit negation, and controlling, according to the sign bit sub-quantum state after negation and the quantum state of the third preset auxiliary bit, the current reduced quantum state to perform quantum state evolution corresponding to complement code operation, includes:
executing X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the decrement quantum state to obtain a negated sign bit sub-quantum state;
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;
controlling whether the current subtraction quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current subtractive quantum state, and performing quantum state evolution corresponding to addition operation on the negated subtractive quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved second complementary code quantum state, otherwise, taking the current subtractive quantum state as the second complementary code quantum state;
performing a CNOT gate operation on the current second sign bit qubit and a third preset auxiliary bit to restore a current quantum state of the third preset auxiliary bit; wherein the second sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Optionally, the performing of quantum state evolution corresponding to the addition operation includes:
determining the number of target modules of a pre-cascaded module MAJ module to be cascaded and a post-cascaded module UMA module to be cascaded according to the number of bits of quantum bits corresponding to two quantum states to be operated, wherein the number of modules of the MAJ module is the same as that of the UMA module;
according to the addition instruction, the MAJ modules and the UMA modules with the number of the target modules are cascaded to generate a target quantum circuit corresponding to the adder;
and performing addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit to generate and output a target quantum state result.
Optionally, the MAJ module is an MAJ quantum wire, the UMA module is an UMA quantum wire, the MAJ quantum wire and the UMA quantum wire each include two CNOT quantum logic gates and one toffil quantum logic gate,
before the step of cascading the MAJ modules and the UMA modules, the number of which is equal to the number of the target modules, according to the addition instruction to generate the target quantum line corresponding to the adder, the method further includes:
acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and the TOFFOLI quantum logic gate, a control relation between the operation quantum bits, and a time sequence relation between the two CNOT quantum logic gates and the TOFFOLI quantum logic gate;
and constructing and generating the MAJ quantum circuit or the UMA quantum circuit by using the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation, wherein the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate are used as corresponding MAJ modules or UMA modules.
Optionally, the MAJ module and the UMA module each include three input items and three output items,
the step of cascading the MAJ modules and the UMA modules, the number of which is equal to the number of the target modules, according to the addition instruction to generate the target quantum line corresponding to the adder specifically includes:
and according to an addition instruction, taking three output items of an MAJ cascade module as three input items of a corresponding UMA cascade module, and cascading 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 MAJ modules in the number of target modules, and the UMA cascade module is determined by cascading UMA modules in the number of the target modules.
Optionally, the three input items of the MAJ module include a carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module include a carry output item and two intermediate result output items, the three input items of the UMA module include a carry output item and two intermediate result output items corresponding to the MAJ module, the three output items of the UMA module include a result carry output item, an accumulation sum output item and a sub-quantum state input item to be calculated,
the step of using three output items of an MAJ cascade module as three input items of a corresponding UMA cascade module according to an addition instruction to cascade the MAJ cascade module and the corresponding UMA cascade module to generate a target quantum line corresponding to the adder specifically includes:
according to an addition instruction, taking a carry output item output by a previous MAJ module and the two sub-quantum state input items to be calculated as three input items of a next MAJ module so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of an MAJ module as two input items of a corresponding UMA module, acquiring a previous UMA module of the corresponding UMA module, and taking a result carry output item of the previous UMA module as one input item of the corresponding UMA module, so as to cascade the MAJ modules with the number of the target modules and the UAM modules with the number of the target modules, and generate the initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
and 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.
Another embodiment of the present invention provides a quantum division operation apparatus with precision, including:
the conversion module is used for acquiring dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
a first quantum state evolution module, configured to iteratively perform quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state, count the number of times of performing the subtraction operation until the dividend data is reduced to a negative number, and output a finally obtained count result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
the second quantum state evolution module is used for iteratively executing the 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and the output module is used for outputting the finally obtained quantum state on the preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal place 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 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 steps when running.
Compared with the prior art, the quantum division operation method with precision provided by the invention obtains dividend data and divisor data to be operated, converts the dividend data into a first target quantum state, converts the divisor data into a 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 reduced to a negative number, outputs the finally obtained counting result as an integer number of quotient of dividend data and divisor data, iteratively executes quantum state corresponding to decimal place operation of the quotient on the current first target quantum state and the current second target quantum state, and outputs the finally obtained quantum state on the quantum bit with preset evolution precision, thereby realizing basic arithmetic operation in a quantum circuit, fills the blank of the related technology.
Drawings
FIG. 1 is a block diagram of a hardware structure of a computer terminal of a quantum division operation method with precision according to an embodiment of the present invention;
FIG. 2 is a flow chart of a quantum division operation method with precision according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a quantum circuit of a quantum division operation with precision according to an embodiment of the present invention;
FIG. 4 is a diagram of a quantum circuit of a quantum division method with precision according to another embodiment of the present invention;
FIG. 5 is a diagram of a quantum circuit for complementary code operation according to an embodiment of the present invention;
FIG. 6 is a diagram of the first half sub-circuit corresponding to the subtractor according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a second half quantum circuit corresponding to the subtractor according to an embodiment of the present invention;
FIG. 8 is a 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 diagram of an adder quantum circuit according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of a MAJ module according to an embodiment of the present invention;
FIG. 12 is a schematic diagram of a MAJ module quantum wire assembly process according to an embodiment of the present invention;
fig. 13 is a schematic diagram of a UMA module according to 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 operation device with precision according to an embodiment of the present invention.
Detailed Description
The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
It is noted that the terms first, second and the like in the description and in the claims of the present invention are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The embodiment of the invention provides a quantum division operation method with precision and a device thereof, which are used for realizing the basic arithmetic operation of quantum bits in a quantum circuit, and can be applied to electronic equipment, such as a mobile terminal, in particular to a mobile phone and a tablet computer; such as a computer terminal, specifically a general computer, a quantum computer, etc.
This will be described in detail below by way of example as it would run on a computer terminal. Fig. 1 is a block diagram of a hardware structure of a computer terminal of 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 shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or 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 understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. 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 embodiment of the present application, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over 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 device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
It should be noted that a true quantum computer is a hybrid structure, which includes two major components: one part is a classic computer which is responsible for executing classic calculation and control; the other part is quantum equipment which is responsible for running a quantum program to further realize quantum computation. The quantum program is a string of instruction sequences which can run on a quantum computer and are written by a quantum language such as a Qrunes language, so that the support of the operation of the quantum logic gate is realized, and the quantum computation is finally realized. In particular, a quantum program is a sequence of instructions that operate quantum logic gates in a time sequence.
In practical applications, due to the limited development of quantum device hardware, quantum computation simulation is usually required to verify quantum algorithms, quantum applications, and the like. The quantum computing simulation is a process of realizing the simulation 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 build quantum programs for a particular problem. The quantum program referred in the embodiment of the invention is a program written in a classical language for representing quantum bits and evolution thereof, wherein the quantum bits, quantum logic gates and the like related to quantum computation are all represented by corresponding classical codes.
A quantum circuit, which is an embodiment of a quantum program and also a weighing sub-logic circuit, is the most common general quantum computation model, and represents a circuit that operates on a quantum bit under an abstract concept, and the circuit includes the quantum bit, a circuit (timeline), and various quantum logic gates, and finally, a result is often read through a quantum measurement operation.
Unlike conventional circuits that are connected by metal lines to pass either voltage or current signals, in quantum circuits, the lines can be viewed as being connected by time, i.e., the state of a qubit evolves naturally over time, in the process being operated on as indicated by the hamiltonian until a logic gate is encountered.
The quantum program refers to the total quantum circuit, wherein the total number of the quantum bits in the total quantum circuit is the same as the total number of the quantum bits of the quantum program. It can be understood that: a quantum program may consist of quantum wires, measurement operations for quantum bits in the quantum wires, registers to hold measurement results, and control flow nodes (jump instructions), and a quantum wire may contain tens to hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process executed for all the quantum logic gates according to a certain time sequence. It should be noted that timing is the time sequence in which the single quantum logic gate is executed.
It should be noted that in the classical calculation, 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 through the combination of the logic gates. Similarly, the way qubits are handled is quantum logic gates. The quantum logic gate is used for enabling the quantum state to evolve and is the basis for forming a quantum circuit, and comprises single-bit quantum logic gates such as a Hadamard gate (H gate), a Pauli-X gate, a Pauli-Y gate, a Pauli-Z gate, an RX gate, a RY gate and an RZ gate; and multi-bit quantum logic gates such as CNOT gate, CR gate, iSWAP gate, and Toffoli gate. Quantum logic gates are typically represented using unitary matrices, which are not only matrix-form but also an operation and transformation.
At present, some classical operations such as four arithmetic functions can not be realized, and the following operations are exemplary: the addition, subtraction, multiplication and division operation of the quantum logic gate needs to construct a quantum circuit to realize the functional operation of any four operations, and further promotes 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 dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
specifically, the decimal data to be operated can be converted into binary quantum state representation by using the existing amplitude encoding mode. For example, dividend data is 7, signed binary representation 0111, most significant bit 0 representing a positive number, 1 representing a negative number; the divisor data is 4, signed binary representation 011. It should be noted that 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.
5-bit quantum bits a.sign, a3, a2, a1, a0 may be obtained, 7 is encoded onto the first target quantum state |00111> of a.sign, a3, a2, a1, a0, and the amplitude of the quantum state is set to 1. Wherein, |00111> |0> |1> |1>, |0>, |1> are called sub-quantum states of |00111>, a sub-quantum state corresponds to a qubit and represents from high to low from right to left, the highest bit corresponds to a.sign, the fourth bit corresponds to a3, the third bit corresponds to a2, the second bit corresponds to a1, the lowest bit corresponds to a0, |0> of the highest bit represents a symbol bit sub-quantum state, and the rest represent numerical value sub-quantum states. In order to unify the operation dimension, 5-bit quantum bits b.sign, b3, b2, b1 and b0 are additionally acquired, and 4 is encoded into a second target quantum state |00100> of b.sign, b3, b2, b1 and b0, and the amplitude of the second target quantum state |00100> is equal to 1.
S202, iteratively executing quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state, and counting the number of times of execution of the subtraction operation until the dividend data is reduced to a negative number, and outputting a finally obtained counting result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
specifically, the number of times of performing the 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, the quantum state evolution corresponding to the subtraction operation may 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 the sign bit sub-quantum state of the first target quantum state currently containing the 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.
Illustratively, the current first and second target quantum states are |00111> and |00100 >. Performing quantum state evolution corresponding to subtraction operation on |00111> and |00100> to subtract the value 00100 contained in |00100> from the value 00111 contained in |00111> to obtain a first target quantum state |00011> containing a subtraction operation result 00011, wherein the second target quantum state |00100> is unchanged;
acquiring 4 first preset auxiliary bits r.sign, r2, r1, r0, and current third target quantum states of r.sign, r2, r1, and r0 as initial states, which can be set to |1001>, that is, an initial value included is-1, and acquiring 4 second preset auxiliary bits d.sign, d2, d1, d0, and current fourth target quantum states of d.sign, d2, d1, and d0 as |1001 >;
wherein, usually, the quantum state of the initialized qubit is |0>, and |1> state can be obtained by applying quantum logic gate operation such as X gate to the corresponding qubit and inverting |0> state;
then, performing quantum state evolution corresponding to subtraction operation on a current third target quantum state |1001> and a current fourth target quantum state |1001> to subtract the value 1001 included in |1001> from the value 1001 included in |1001> to obtain a third target quantum state |0000> including a subtraction operation result 0, wherein the fourth target quantum state |1001> is unchanged, and the value-1 of the original third target quantum state |1001> is added by 1;
measuring the sign bit sub-quantum state of the first target quantum state |00011> containing the subtraction result to be |0> by applying a measurement operation to the qubit a3 corresponding to the sign bit sub-quantum state of the first target quantum state, that is, the value of the sign bit is 0, and returning to execute the step of executing the quantum state evolution corresponding to the subtraction operation on the current first target quantum state and the current second target quantum state:
at this time, when the current first target quantum state is |00011>, and the current second target quantum state is |00100>, the quantum state evolution corresponding to the subtraction operation is continuously executed, so as to obtain: a first target quantum state |10001>, a second target quantum state |00100 >;
and continuing to execute the quantum state evolution corresponding to the subtraction operation in the current third target quantum state |0000> and the current fourth target quantum state |1001>, so as to obtain: a third target quantum state |0001> and a fourth target quantum state |1001>, so that the value 0 of the original third target quantum state |0000> is continuously added by 1;
measuring that the sign bit sub-quantum state of the current first target quantum state |10001> is |1>, that is, the value of the sign bit is 1, which means that the dividend 7 is subtracted to a negative number through two times of subtraction, and ending the iteration. It can be seen that the final number of iterations is 1, and the third target quantum state plays a role of counting.
Specifically, a finally obtained third target quantum state may be output, where the third target quantum state includes a quotient obtained by dividing the dividend data by the divisor data.
Continuing with the above example, the third target quantum state finally obtained after the iteration is finished is |0001>, and the value included therein is 0001, and the value included in the third target quantum state is used as the integer bit of the quotient of the dividend 7 and the divisor 4, so that the third target quantum state |0001> can be directly output, and the value included in the third target quantum state can be further converted into the decimal value 1 and output.
S203, iteratively executing quantum state evolution corresponding to 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
specifically, for the current first target quantum state and the current second target quantum state, iteratively executing the quantum state evolution corresponding to the decimal place operation of the quotient may include:
s2031, inverting the sign bit sub-quantum state of the current second target quantum state, and performing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the second target quantum state after the sign bit is inverted, so as to evolve the current first target quantum state into a quantum state containing a remainder binary value of the dividend data divided by the divisor data;
s2032, shifting each bit quantum state of the current first target quantum state to the left by one bit, re-negating the symbol bit quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state shifted to the left by one bit and the second target quantum state re-negated, and counting the execution times of the subtraction until the first target quantum state shifted to the left by one bit is reduced to a negative number, and obtaining a small bit quantum state containing a binary value of a counting result on a preset intermediate bit quantum bit;
s2033, exchanging the last quantum state of the decimal quantum state with the initial quantum state |0> state of the corresponding preset precision bit quantum bit, and outputting the exchanged quantum state on the preset precision bit quantum bit;
s2034, the sign bit sub-quantum state of the current second target quantum state is inverted, the step of quantum state evolution corresponding to subtraction operation is executed for the current first target quantum state and the second target quantum state after sign bit inversion, until the preset iteration frequency required by the iteration execution of the quantum state evolution corresponding to decimal place operation of the quotient is reached, wherein the preset iteration frequency is consistent with the digit of decimal place precision to be calculated.
For example, the decimal place of the quotient of the current first target quantum state |10001>, the second target quantum state |00100>, the third target quantum state |0001>, and the fourth target quantum state |1001> retains 3-bit precision.
The first iteration: step 1: negating the sign bit sub-quantum state |0> of the second target quantum state, wherein the negated second target quantum state is |10100>, and performing quantum state evolution corresponding to subtraction operation on the current first target quantum state |10001> and the negated second target quantum state |10100>, wherein the evolved first target quantum state becomes |00011> and the evolved second target quantum state is |10100 >; in fact, |00011> contains the binary value 00011 (decimal value 3), which is the remainder of the division of dividend 7 by divisor 4.
Step 2: shifting the first target quantum state |00011> left by one bit as a whole to |00110>, inverting the sign bit of the second target quantum state |10100> to restore to |00100>, then iteratively executing quantum state evolution corresponding to subtraction operation on |00110> and |00100> and counting the iteration number of the quantum state evolution until |00110> is reduced to a negative number, and storing the counting result to the small-bit quantum states of the preset median quantum bits cc.sign, cc2, cc1 and cc0, and finally obtaining: a first target quantum state |10010>, a second target quantum state |00100>, a small digital quantum state |0001 >;
it should be noted that the principle of the method is the same as the above-mentioned implementation principle of iteratively executing the quantum state evolution corresponding to the 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 reduced to a negative number, and in fact, the division operation is performed on |00110> and |00100 >.
And step 3: exchanging the last sub-quantum state |1> of the decimal quantum state |0001> with the initial quantum state |0> of the corresponding preset precision bit qubit f2 by using a SWAP gate, outputting the exchanged quantum state |1> of f2, and changing the decimal quantum state into |0000 >; the preset precision bit qubits can be set to have 3 bits f2, f1 and f0, in the first iteration, the last bit 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.
And (3) second iteration: and (3) returning to execute the steps 1-3 by the current first target quantum state |10010>, the current second target quantum state |00100> and the current decimal place quantum state |0000>, exchanging the last decimal place quantum state of the decimal place quantum state with the initial quantum state |0> of f1, outputting the exchanged quantum state of f1, and finally obtaining: current first target quantum state |10100>, current second target quantum state |00100>, quantum state |1> of f2, and decimal quantum state |0000 >.
And a third iteration: and (3) returning to execute the steps 1-3, exchanging the last bit quantum state of the decimal place quantum state with the initial quantum state |0> of f0, outputting the exchanged quantum state of f0, and finally obtaining the following result: current first target quantum state |10100>, current second target quantum state |00100>, quantum state |0> of f0, and decimal quantum state |0000 >.
Illustratively, FIG. 3 is a schematic diagram of a quantum circuit for performing quantum division with precision. As shown in fig. 3, t is a classical bit for storing a measurement result, and a.sign, a are quantum bits for encoding symbols and values of dividend data, corresponding to a first target quantum state;
sign and b are quantum bits of the symbols and numerical values of the coded divisor data, and correspond to a second target quantum state;
sign, r0 form the first preset auxiliary bit, wherein, sign is the quantum bit of the code quotient symbol, r0 are the quantum bit of the code quotient value, r0 is the lowest bit;
sign, d0 form the second preset auxiliary bit, sign encodes sign bit, d encodes numerical bit, where d0 is the lowest bit; the second preset auxiliary bit corresponds to a fourth target quantum state with the initial state being 0 state, the sign bit sub-quantum state corresponding to d.sign and the numerical value 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 auxiliary qubit needed by the subtractor module on the upper half part of the line, and is n +3 bits, k is auxiliary qubit needed by the subtractor module on the lower half part of the line, and is n +2 bits, and the n +2 bits share the front (n +2) auxiliary qubit in kk, which is shown in the figure differently, and actually kk contains k; f [ cnt-1], f [ i ] and f [0] represent preset precision bit quantum bits;
the subtractor 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 the quantum circuit is from the first layer to the fifth layer in sequence:
a first layer: measuring operation in Qwhile is used for measuring the value of a.sign and storing the value on a classical bit t, when t is less than 1, executing iteration operation in Qwhile and sum + +, storing the sum value on a corresponding classical bit (the initial value of sum is 0), and ending iteration when t reaches 1;
a second layer: the iteration number of the second layer is cnt, cnt is the decimal precision position of the required quotient, in each iteration of the second layer, the layer Qwhile is required to be subjected to corresponding iteration, and the t-0 module represents that t is set to be 0; sign, cc [0] represents a preset middle bit qubit, wherein the sign represents a sign bit; the measurement operation in the layer Qwhile is used for measuring the value of a.sign and storing the value on a classical bit t, when t is less than 1, the iteration operation in the layer Qwhile is executed, s [ i ] + +, the value of s [ i ] is stored on the corresponding classical bit (the initial value of s [ i ] is 0, i is 0,1,2 … … represents the ith iteration of the second layer), and the iteration in the layer Qwhile is ended until t reaches 1; a solid vertical line and two virtual vertical lines on the lower right of the second layer represent a quantum logic gate SWAP gate;
and a third layer: the iteration number of the third layer is cnt, when s [ cnt-i-1] >0, the iteration operation of the subtracter in the Qwhile layer is executed, and s [ cnt-i-1] - -, the iteration in the Qwhile is finished until s [ cnt-i-1] is less than or equal to 0; the reverse left shift operation is a reverse operation of left shift by one;
a fourth layer: when sum is greater than 0, executing the iterative operation of the subtractors in the Qwhile layer, and executing sum- - -until sum is less than or equal to 0, and ending the iteration in the Qwhile layer; and two X gates at the lower left of the fourth layer are used for performing secondary negation on the quantum states of d.sign and d [0] to realize reduction to the initial state.
Furthermore, through the third and fourth layer operations, s [ i ] and sum can be restored to an initial value of 0, a.sign, a, b.sign, b, d.sign and d [0] are restored to an initial state, an integer number of the quotient is obtained on r, a preset small-precision number of the quotient is obtained on f, and the quantum state of the auxiliary quantum bit can be restored, so that the auxiliary quantum bit can be reused.
And S204, outputting the finally obtained quantum state on the preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal place of the quotient.
Continuing with the above example, through three iterations, the finally obtained 3-bit preset precision bit qubits f2, f1, and f0 have quantum states of |1> |1> |0> |110>, that is, the decimal binary value of the quotient is 110 (decimal 0.75). The integer 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, for a situation that a negative number exists in the dividend and/or the divisor, a preset sign bit qubit may also be obtained, and a preset quantum logic gate operation is performed on the qubit corresponding to the sign bit qubit state of the first target quantum state, the qubit corresponding to the sign bit qubit state of the second target quantum state, the first preset auxiliary bit, and the preset sign bit qubit, so as to finally obtain a sign value represented by the sign bit qubit state in the third target quantum state.
Illustratively, fig. 4 is a quantum circuit 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 adds sign bit quantum bit u 0, u 1; circle icons connected with vertical lines represent a quantum logic gate CNOT gate, the quantum bit corresponding to the time line where the large circle is located is a controlled bit, and the quantum bit corresponding to the time line where the solid point is located is a control bit; the classical bits total cnt +2 bits, including in fig. 3: 1-position sum, cnt-position s [ i ], 1-position t; v is the auxiliary qubit with 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, the final sign bit sub-quantum state containing the sign value of the quotient can be obtained at r.sign.
The following describes in detail a specific implementation of the quantum state evolution corresponding to the subtraction operation.
Specifically, the performing, by the subtractor, the quantum state evolution corresponding to the subtraction operation may include:
s301, 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 complementary code operation according to a sign bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to obtain a first complementary code quantum state; wherein the first complement quantum state is a quantum state that comprises a complement of the subtrahend data;
as can be seen from the foregoing embodiments, the two quantum states to be operated on are of 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; the first target quantum state and the sign bit inverted second target quantum state. The former may be referred to as a reduced quantum state, and the included data is a reduced number in the subtraction operation, and the latter may be referred to as a reduced quantum state, and the included data is a reduced number.
In this embodiment, the present invention is mainly used to implement the function of a subtractor, and the greatest difference between the subtractor and an adder described below is that a negative number is generated, so that a binary processing method is adopted, a sign bit is added to both a subtrahend and a subtrahend to represent the positive and negative of a numerical value, and a complementary code is used to perform an operation. The positive number is not changed in complement, and the negative number except the sign bit is inverted according to the bit and then added with 1. Corresponding to the quantum circuit, namely, whether the sign bit controls the complement operation or not, and the inverse X gate is taken out and 1 is added, which can be realized by an adder. And after the operation is completed under the condition of complement, performing one complement operation on the result to obtain a target numerical value. The method comprises the steps of obtaining the to-be-operated reduced data and the reduction data, and respectively converting the reduced data and the reduction 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 symbol and a value-bit sub-quantum state representing the data value.
Specifically, according to the sign bit sub-quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit, controlling the reduced quantum state to execute quantum state evolution corresponding to the complementary code operation, and executing a CNOT gate operation on a first sign bit quantum bit and a third preset auxiliary bit corresponding to the sign bit sub-quantum state in the reduced quantum state, where 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, and is also reasonable and feasible;
controlling whether the current subtracted quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current reduced quantum state, and performing quantum state evolution corresponding to addition operation on the negated reduced quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved first complementary code quantum state, otherwise, taking the reduced quantum state as the first complementary code quantum state; when the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed can be in a state |1>, the quantum state evolution corresponding to the complementary code operation is controlled to be executed, and otherwise, the quantum state evolution is not executed;
performing a CNOT gate operation on the current first sign bit qubit and a third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Illustratively, the decremented quantum state is assumed to be |0011 >. The sign bit sub-quantum state of |0011> is the highest sub-quantum state, i.e., |0> state, the value of the bit is 0, the corresponding first sign bit qubit is set to g.sign, the third predetermined auxiliary bit is the predetermined qubit q1, and the initial state is |0> state.
And performing CNOT gate operation on g.sign and q1, wherein g.sign is used as a control bit, q1 is used as a controlled bit, the quantum state of the g.sign bit is in a state of |0>, and the quantum state |0> of the controlled bit q1 is unchanged after the CNOT gate operation.
Since the quantum state of q1 after the CNOT gate operation is performed is the |0> state, the quantum state evolution corresponding to the complement code operation is not performed on the decremented quantum state. In principle, when the subtrahend is a positive number, the complement code is not required in the subtraction operation, or the complement code is itself, and |0011> can be directly used as the first complement quantum state.
Finally, CNOT gate may be performed again on the current g.sign and q1, the quantum state of g.sign bit is |0> state, and after CNOT gate operation, the quantum state |0> of controlled bit q1 is unchanged to restore q1 to |0> state, thereby releasing the information stored by the third auxiliary bit. It can be seen that the first complement quantum state contains a value 0011 that is the complement of the decremented number 0011.
As shown in FIG. 5, q1A third preset auxiliary bit for controlling whether to perform a complement operation, where the first target quantum state is g, g.sign is a symbol bit sub-quantum state in the first target quantum state, the remaining g is a numerical bit sub-quantum state representing the data value, j is a fourth preset auxiliary bit, that is, an auxiliary bit set to a value of 1, and p is an auxiliary bit used by the adder (hereinafter, referred to as a fifth preset auxiliary bit). Corresponding to fig. 3, k is n +2 bits, which includes: n bit j, 1 bit p, 1 bit q 1.
The quantum wire shown in fig. 5 implements the operation of complementing g, first g.sign and q.1Performing a CNOT gate operation so that q1Sign in g.temporarily, and using q1Controlling whether to carry out complement code solving, and after the complement code is solved, then q is carried out1And (4) reducing. Therefore, the reduced quantum state is controlled to execute the quantum state evolution corresponding to the complementary code operation, and the first complementary quantum state is obtained.
In particular, according to the sign-bitwise quantum state of g, with a first preset auxiliary bit q1To control whether to make the complement operation. If g is negative, the complement operation of negative number is performed. The complement of negative number is that adding 1 after inverting according to bit except sign bit, and the operation of inverting according to bit except sign bit is realized by logic gate, it only needs to do X gate to all the numerical value bit, and adding 1 after inverting, therefore, by adding j and g, the value of j is set to 1, p is auxiliary bit of adder, after adding g and j after inverting the numerical value bit, the value stored on g is the value after completing complement, and then q is added1Reducing for the next use.
Example (c): sign is 1 when g is negative, so q1Also 1, an operation such as negation is required, and when g is a positive number, sign is 0, so q1Also 0, no further complementary code is needed.
S302, sign bit sub-quantum states in the reduced quantum states execute quantum state evolution corresponding to sign bit negation, and according to the sign bit sub-quantum states after negation and the quantum states of the third preset auxiliary bits, the current reduced quantum states are controlled to execute quantum state evolution corresponding to complementary code operation, and second complementary code quantum states are obtained; wherein the second complement quantum state is a quantum state that comprises a complement of the subtrahend data;
specifically, an X-gate operation may be performed on a second sign bit qubit corresponding to a sign bit sub-quantum state in the subtrahend quantum state to obtain an inverted sign bit sub-quantum state; wherein, the X gate can be replaced by other equivalent existing quantum logic gates or quantum logic gate combinations, and is also reasonable and feasible;
similarly, continuing to perform 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;
controlling whether the current subtraction quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current subtractive quantum state, and performing quantum state evolution corresponding to addition operation on the negated subtractive quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved second complementary code quantum state, otherwise, taking the current subtractive quantum state as the second complementary code quantum state;
performing a CNOT gate operation on the current second sign bit qubit and a third preset auxiliary bit to restore a current quantum state of the third preset auxiliary bit; wherein the second sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Illustratively, the subtractive quantum states are assumed to be |0100 >. The sub-quantum state of the sign bit of |0100> is the highest sub-quantum state, i.e., |0> state, the value of the bit is 0, the corresponding second sign bit is set to h.sign, and the current third auxiliary bit is reduced to |0> state.
First, an X-gate may be performed on h.sign, inverting the corresponding sign bit sub-quantum state |0> to |1>, and the subtractive quantum state to |1100 >.
And continuing to execute CNOT gate operation on h.sign and q1, taking h.sign as a control bit and q1 as a controlled bit, wherein the current quantum state of the h.sign bit is |1> state, and after the CNOT gate operation, the quantum state |0> of the controlled bit q1 is inverted to |1> state.
The quantum state of q1 after the CNOT gate operation is performed is the |1> state, so the corresponding quantum state evolution of the complement operation is performed on the current subtrahend quantum state |1100 >. One implementation of performing the quantum state evolution corresponding to the complementary code operation is as follows:
and negating the unsigned bit sub-quantum state of the current subtractive quantum state |1100>, and performing quantum state evolution corresponding to addition operation on the negated subtractive quantum state |1011> and the quantum state |1> state of the fourth preset auxiliary bit to obtain the evolved second complementary code quantum state |1100 >.
Wherein, the unsigned bit sub-quantum state |100> of |1100> can be inverted by performing an X gate; to keep dimensions consistent, the fourth predetermined auxiliary bit is a predetermined 4-bit qubit j3, j2, j1, j0, and the quantum state |1> of the fourth predetermined auxiliary bit is actually written as |0001>, which are equivalent.
Finally, CNOT gate can be performed again on the current h.sign and q1, the quantum state of h.sign bit is |1> state, after CNOT gate operation, the quantum state |1> of controlled bit q1 is inverted to |0>, thereby restoring q1 to initial |0> state again and releasing the storage space of q 1. It can be seen that the second complement quantum state contains a value 1100 that is the complement of the decrement 1100 after X-gating on h.sign.
In this embodiment, the second target quantum state h is also the same, and the initial pair j[0]The X-gating is done to set the value to 1 and the X-gating is done to sign the sign bit sub-quantum state h.sign in the second target quantum state to change the subtraction into an addition. As shown in fig. 6, fig. 6 is a schematic diagram of a quantum circuit for performing the quantum state evolution corresponding to the complementary code operation on g and h, and the complementary code operation is performed on the second target quantum state h by referring to the above similar method to obtain the quantum state evolution corresponding to the complementary code operationThe second complement quantum state.
S303, performing quantum state evolution corresponding to an 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 including a sum of the complements of the decremented data and the complements of the decremented data;
illustratively, for the first complementary quantum state |0011> and the second complementary quantum state |1100>, the quantum state evolution corresponding to the addition operation is performed to evolve the first complementary quantum state |0011> into a fifth target quantum state |1111 >.
In this embodiment, after the complementary code is obtained, the g and the h are added, and after the addition is completed, the previous operation is restored, and the result stored in the g is the obtained result. Substituting the first and second complement quantum states into a quantum line of an adder, and performing quantum state evolution corresponding to an addition operation, thereby evolving the first complement quantum state into a third target quantum state comprising a sum of the complement of the subtrahend data and the complement of the subtrahend data.
S304, controlling the fifth target quantum state to execute quantum state evolution corresponding to complementary code operation according to the sign bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit to obtain an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction operation 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 complements;
illustratively, according to the sign bit sub-quantum state |1> in the current fifth target quantum state |1111> and the quantum state |0> of the current third preset auxiliary bit, controlling the fifth target quantum state |1111> to perform quantum state evolution corresponding to the complementary code operation, so as to obtain an evolved sixth target quantum state |1001> containing a value of 1001 (decimal-1), which is a subtraction result of a subtracted number 0011 (decimal 3) contained in the subtracted quantum state |0011> and a subtracted number 0100 (decimal 4) contained in the subtracted quantum state |0100 >.
It should be noted that, the evolution of the quantum state corresponding to the complementary code operation can be the same as the foregoing, and after the evolution, the quantum state of the third predetermined auxiliary bit is still reduced to |0> for the use of the subsequent calculation.
S305, controlling the current decrement quantum state to execute quantum state evolution corresponding to the complementing code operation according to the sign bit sub quantum state in the current decrement quantum state and the quantum state of the current third preset auxiliary bit, and executing quantum state evolution corresponding to sign bit negation on of the sign bit sub quantum state in the current decrement quantum state to restore the current decrement quantum state.
Illustratively, the current decrement quantum state is a second complementary quantum state |1100>, and the current quantum state of the third predetermined auxiliary bit is |0 >. Continuing to control |1100> to execute the quantum state evolution corresponding to the complementary code operation in the same manner as the above to obtain |1100> after evolution, and then negating the sign bit sub-quantum state through X gate operation to restore the sign bit sub-quantum state to the initial reduced quantum state |0100 >.
In this embodiment, after the addition operation is performed, 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 subtree data and the complement of the subtree data. As shown in FIG. 7, first, j is coupled[0]The purpose of making an X gate is to make j[0]The value of (1) is set to be 1, so that the +1 operation in the complementary code is convenient. The reason for the operation of the X gate on the sign bit of h is to convert g-h to g + (-h). Then, the g and h are both subjected to complementary code processing, after the processing is finished, the complementary codes of the g and h are added to obtain a result, the g and h are subjected to complementary code solving operation once to restore the result to a normal numerical value, and finally the initial operation is restored, namely the auxiliary bit is restored and 2X gates are performed. This constitutes a quantum wire diagram of the entire subtractor as shown in fig. 8, which is a functionally simple example.
The following describes in detail a specific implementation of the quantum state evolution corresponding to the execution of the addition operation.
Specifically, the quantum state evolution corresponding to the addition operation may be performed by the adder, and may include:
s401, determining the number of target modules of a pre-cascaded module MAJ module to be cascaded and a post-cascaded module UMA module to be cascaded according to the number of bits of quantum bits corresponding to two quantum states to be operated, wherein the number of modules of the MAJ module is the same as that of the UMA module;
as can be seen from the foregoing, the two quantum states to be operated on may be: a first complement quantum state and a second complement quantum state; the inverted subtracted quantum state and the quantum state |1> state of the fourth predetermined auxiliary bit.
Illustratively, as shown in fig. 9, the first qubit in the line is a fifth predetermined auxiliary bit, which is initially in the state of |0> and is finally restored to the state of |0>, and e and f are corresponding qubits of the data to be added, each corresponding to a group of qubits. c represents the final carry term, corresponding to the preset carry auxiliary bit, s is the output bit without carry. Generally, the quantum bit numbers corresponding to e and f are the same, and the bit numbers of s, e and f are the same.
Exemplary, as shown in FIG. 10, e[i]And f[i]Respectively, the i-th bit, c, of two addends corresponding to quantum states[i]Is the previous stage 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 qubit is the fifth predetermined auxiliary bit corresponding to c in the quantum circuit0. The first MAJ module includes three input quantum states and corresponding three output quantum states, where the three input quantum states are c0、e0、f0,e0The 0 th quantum state being the first quantum state to be operated on, f0A0 th quantum state being a second quantum state to be operated on, c0For the quantum state of the fifth predetermined auxiliary bit, the initial value is 0, i.e. no carry. Three output quantum states are respectively e0⊕c0、e0⊕f0、c1,c1Is e0And f0The added carry bit, similarly, the three input quantum states of the next MAJ module are c1、e1、f1The three output quantum states are each e1⊕c1、e1⊕f1、c2And so on to the last MAJ module.
For the first UMA module, three input quantum states and corresponding three output quantum states are included, 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 c0、s0、e0,s0Is e0And f0The result of the addition without carry. For the same reason, s1 is e1And f1The result of the addition without carry, and so on, c4 is the final carry term. In practical applications, the qubit corresponding to c4 may not be provided in the quantum wire without the need to calculate the final carry.
And the number of modules of the MAJ module and the number of UMA modules can be determined according to the number of sub-quantum states included in any quantum state to be operated, wherein one sub-quantum state corresponds to one quantum bit, and the number of modules of the MAJ module and the number of UMA modules are equal. For example only, e and f are encoded by 4 qubits, and the number of MAJ modules and UMA modules is 4. The MAJ module and the UMA module form a front cascade unit and a rear cascade unit of the adder. The MAJ module may be configured to extract the carry term of any step and pass it to the next stage, so as to calculate the final carry term. The UMA module extracts the information of c and transmits the information to the upper-level UMA, calculates s (result item) of each level, and recovers the information of e.
The following are exemplary: when 4 (represented by 100 for a quantum state corresponding to a code in 3 qubits) +2 (represented by 010 for a quantum state corresponding to a code in 3 qubits) is 6 (represented by 110 for a quantum state corresponding to a code in 3 qubits). 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 MAJ modules and the number of the UMA modules are both 3.
The following are exemplary: when 4 (corresponding to the quantum state encoded in 3 qubits denoted 100) +7 (corresponding to the quantum state encoded in 3 qubits denoted 111) ═ 11 (corresponding to the quantum state encoded in 3 qubits denoted 011), it is understood that 11 corresponds to a binary number 1011, and the leftmost bit 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 qubits of the encoding e or the qubits used for the encoding f is large, and the number of the MAJ modules and the number of the UMA modules are both 3.
Illustratively, when 2 (quantum state corresponding to code at 2 qubits is denoted 10) +4 (quantum state corresponding to code at 3 qubits is denoted 100) is 6 (quantum state corresponding to code at 3 qubits is denoted 110). At this time, the number term "3" of the code "6" is consistent with the number of quantum states of the qubit of the code b, and the number of modules of the MAJ module and the number of the UMA module are both 3.
S402, according to an addition instruction, the MAJ modules and the UMA modules with the number of the target modules are cascaded to generate a target quantum circuit corresponding to the adder;
the MAJ module and the UMA module each include three input items and three output items, and the three output items of an MAJ cascade module may be used as three input items of a corresponding UMA cascade module according to an addition instruction, so as to cascade the MAJ cascade module and the corresponding UMA cascade module, and generate a target quantum line corresponding to the adder, where the MAJ cascade module is determined by cascading MAJ modules of the number of target modules, and the UMA cascade module is determined by cascading UMA modules of the number of target modules.
Specifically, the three input items of the MAJ module include a carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module include a carry output item and two intermediate result output items, the three input items of the UMA module include a carry output item and two intermediate result output items corresponding to the MAJ module, the three output items of the UMA module include a result carry output item, an accumulation sum output item and a sub-quantum state input item to be calculated,
then, according to an addition instruction, taking a carry output item output by a previous MAJ module and the two to-be-calculated sub-quantum state input items as three input items of a next MAJ module, so as to cascade MAJ modules of the number of the target modules;
taking two intermediate result output items of an MAJ module as two input items of a corresponding UMA module, acquiring a previous UMA module of the corresponding UMA module, and taking a result carry output item of the previous UMA module as one input item of the corresponding UMA module, so as to cascade the MAJ modules with the number of the target modules and the UAM modules with the number of the target modules, and generate the initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
and 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. The CNOT gate and carry assist bit may not be set in the case where a carry term is not required.
In the present embodiment, as shown in fig. 10, three output bits of the MAJ module are taken as 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 corresponding qubits of the open circles are control bits, and the corresponding qubits of the solid circles are controlled bits.
Wherein, the MAJ module is an MAJ quantum line, the UMA module is an UMA quantum line, the MAJ quantum line and the UMA quantum line both include two CNOT quantum logic gates and one toffil quantum logic gate, and the step of cascading the MAJ modules and the UMA modules of the number of the target modules according to an addition instruction to generate the target quantum line corresponding to the adder further includes: acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and the TOFFOLI quantum logic gate, a control relation between the operation quantum bits, and a time sequence relation between the two CNOT quantum logic gates and the TOFFOLI quantum logic gate; and constructing and generating the MAJ quantum circuit or the UMA quantum circuit by using the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation, wherein the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate are used as corresponding MAJ modules or UMA modules.
In this embodiment, the MAJ module and the UMA module constitute 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, so as to calculate the final carry term. As shown in fig. 12, the MAJ module may mainly include three logic gates, i.e., two CNOT gates and one Toffoli gate. The CNOT gates (first and second logic gates from left to right in fig. 12) function as: adding the control bit to the target bit to form a modulo-2 addition, i.e., an XOR operation, to obtain (e)i+ci)%2、(ei+fi) % 2, the order of the two CNOT gates can be swapped. The function of the toffee gate (the third logic gate from left to right in fig. 12) is: adding both control bits to the target bit to obtain the carry term c[i+1]=(e[i]AND f[i])XOR(e[i]AND f[i])XOR(e[i]AND f[i]). I.e. e is implemented by the first CNOT gate from left to right in fig. 12i⊕ciE is implemented by the second CNOT gate from left to right in FIG. 12i⊕fiC is implemented by the third TOFFOLI gate from left to right in FIG. 12i+1Therefore, a preceding stage cascade unit of the quantum adder is formed by 2 CNOT gates and 1 TOFFOLI gate.
Example 1: e.g. of the typeiIs 1, fiIs 1, ciIs 1.
MAJ Module StartiTo c is added toiUpper, ciChange the value of (d) to 0, and then change e toiIs added to fiUpper, fiThe value of (3) also becomes 0 and finally fiAnd ciTo eiUpper, eiBecomes 1, i.e. ci+1Carry of (1).
Example 2: e.g. of the typeiIs 0, fiIs 1, ciIs 1.
MAJ Module StartiTo c is added toiUpper, ciChange the value of (d) to 1, and then change eiIs added to fiUpper, fiThe value of (3) also becomes 1, finally using fiAnd ciTo eiUpper, eiBecomes 1, i.e. ci+1Carry of (1).
As shown in fig. 13, the UMA module is used in the next stage of the cascaded adder, and the UMA module is implemented similarly to the MAJ module, as shown in fig. 14, c is first input to the toffee gate (the first logic gate from left to right in fig. 14)i+1Reduction to eiReuse ei(e + c)% 2 is restored once by using CNOT gate (the second logic gate from left to right in FIG. 14) to convert (e)i+ci) % 2 reduction to ciAnd finally, reuse ciTo (e)i+fi) % 2 makes a CNOT gate (the third 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+ci) % 2 is 0, (e)i+fi) % 2 is 0, ci+1Is 1.
Start handle (e)i+ci) % 2 and (e)i+fi) % 2 to ci+1Upper, ci+1Becomes 1, and the meaning of the expression becomes eiReuse eiIs added to (e)i+ci) % 2 of (e)i+ci) The value of% 2 is 1, and the meaning of expression is ciReuse ciIs added to (e)i+fi) % 2 of (e)i+fi) The value of% 2 becomes 1 and the meaning becomes si
Example 2: (e)i+ci) % 2 is 1, (e)i+fi) % 2 is 1, ci+1Is 1.
Start handle (e)i+ci) % 2 and (e)i+fi) % 2 to ci+1Upper, ci+1Becomes 0 and the meaning becomes eiReuse eiIs added to (e)i+ci) % 2 of (e)i+ci) The value of% 2 becomes 1, and the meaning becomes ciReuse ciIs added to (e)i+fi) % 2 of (e)i+fi) The value of% 2 becomes 0 and the meaning becomes si
The last CNOT gate from top to bottom in FIG. 10, i.e., the CNOT gate in the middle between the entire adder MAJ module and UMA module, is used to save ci+1The result of (1).
And S403, performing addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum line to generate and output a target quantum state result.
In this embodiment, two quantum states to be operated, such as |111> and |111>, are input into an adder (i.e., the target quantum circuit), so as to obtain a corresponding binary representation target quantum state calculation result (including a carry term and a result term obtained by directly adding each sub-quantum state). And then directly outputting the target quantum state result |1110> in binary representation, or further converting the target quantum state result |1110> into a decimal result 14 and outputting the decimal result, thereby completing the addition operation of the two target data.
It can be seen that by 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 performing quantum state evolution corresponding to the subtraction on the first target quantum state and the second target quantum state, and counting the number of times of performing the subtraction until the dividend data is reduced to a negative number, outputting a finally obtained counting result as an integer number of a quotient obtained by dividing the dividend data by the divisor data, iteratively performing quantum state evolution corresponding to decimal place operation on the current first target quantum state and the current second target quantum state, and outputting a finally obtained quantum state on a preset precision place quantum bit, a basic arithmetic operation that can be used in a quantum line is realized, and a blank of related technologies is filled.
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 value-bit sub-quantum state representing the data value;
a first quantum state evolution module 1502, configured to iteratively perform quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state, count the number of times of performing the subtraction operation until the dividend data is reduced to a negative number, and output a finally obtained count result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
a second quantum state evolution module 1503, configured to iteratively perform quantum state evolution corresponding to the decimal operation of the quotient for a current first target quantum state and a current second target quantum state; the preset iteration times of the iteration are consistent with the digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
an output module 1504, configured to output a finally obtained quantum state on the preset precision bit qubit, where the quantum state includes a binary value of the decimal place of the quotient.
Specifically, the first quantum state evolution module is specifically configured to:
performing quantum state evolution corresponding to subtraction on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction 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 the sign bit sub-quantum state of the first target quantum state currently containing the 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.
Specifically, the output module is specifically configured to:
and outputting the finally obtained third target quantum state, wherein the third target quantum state comprises an integer bit binary value of the quotient of the dividend data and the divisor data.
Specifically, the second quantum state evolution module is specifically configured to:
negating the sign bit sub-quantum state of the current second target quantum state, and performing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the sign bit-negated second target quantum state so as to evolve the current first target quantum state into a quantum state containing a remainder binary value of the dividend data divided by the divisor data;
shifting each sub quantum state of the current first target quantum state by one bit to the left, re-inverting the sign bit sub quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state shifted by one bit to the left and the second target quantum state re-inverted, and counting the execution times of the subtraction until the first target quantum state shifted by one bit to the left is reduced to a negative number, and obtaining a small bit quantum state containing a binary value of a counting result on a preset intermediate bit quantum bit;
exchanging the last quantum state of the decimal quantum state with the initial quantum state |0> state of the corresponding quantum bit with the preset precision, and outputting the quantum state on the exchanged quantum bit with the preset precision;
and 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 current first target quantum state and the second target quantum state after inverting the sign bit until the preset iteration frequency required by iteratively executing the quantum state evolution corresponding to the decimal place operation of the quotient is reached, wherein the preset iteration frequency is consistent with the digit of the decimal place precision to be calculated.
Specifically, the apparatus further comprises:
and the execution module is configured to acquire a preset sign bit qubit, and execute a preset quantum logic gate operation on the qubit corresponding to the sign bit sub-quantum state of the first target quantum state, the qubit corresponding to the sign bit sub-quantum state of the second target quantum state, the first preset auxiliary bit, and the preset sign bit qubit, so as to finally obtain a sign value represented by the sign bit sub-quantum state in the third target quantum state.
Specifically, the operation module includes:
the first complement operation unit is used for acquiring a quantum state of a third preset auxiliary bit for two quantum states to be operated respectively as a reduced quantum state containing reduced data and a reduced quantum state containing reduced data, and controlling the reduced quantum state to execute quantum state evolution corresponding to complement operation according to a sign bit sub-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 that comprises a complement of the subtrahend data;
the second complement operation unit is used for executing quantum state evolution corresponding to sign bit negation on the sign bit sub-quantum state in the reduced quantum state, and controlling the current reduced quantum state to execute quantum state evolution corresponding to complement operation according to the sign bit sub-quantum state after negation and the quantum state of the third preset auxiliary bit, so as to obtain a second complement quantum state; wherein the second complement quantum state is a quantum state that comprises a complement of the subtrahend data;
an addition operation unit, configured to perform quantum state evolution corresponding to an 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 including a sum of a complement of the reduced data and a complement of the reduced data;
a third complementary code operation unit, configured to control, according to a sign bit sub-quantum state in the fifth target quantum state and a quantum state of the third preset auxiliary bit, the fifth target quantum state to perform quantum state evolution corresponding to complementary code operation, so as to obtain an evolved sixth target quantum state, and output the sixth target quantum state as a subtraction operation 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 complements;
and the fourth complement operation unit is used for controlling the current decrement quantum state to execute quantum state evolution corresponding to complement operation according to the sign bit sub-quantum state in the current decrement quantum state and the current quantum state of the third preset auxiliary bit, and executing quantum state evolution corresponding to sign bit negation on the sign bit sub-quantum state in the current decrement quantum state so as to restore the current decrement quantum state.
Specifically, the first complement arithmetic unit is specifically configured to:
performing a CNOT gate operation on a first sign bit qubit and a third preset auxiliary bit corresponding to a sign bit qubit in the subtracted quantum states, wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit;
controlling whether the current subtracted quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current reduced quantum state, and performing quantum state evolution corresponding to addition operation on the negated reduced quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved first complementary code quantum state, otherwise, taking the reduced quantum state as the first complementary code quantum state;
performing a CNOT gate operation on the current first sign bit qubit and a third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Specifically, the second complement arithmetic unit is specifically configured to:
executing X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the decrement quantum state to obtain a negated sign bit sub-quantum state;
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;
controlling whether the current subtraction quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current subtractive quantum state, and performing quantum state evolution corresponding to addition operation on the negated subtractive quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved second complementary code quantum state, otherwise, taking the current subtractive quantum state as the second complementary code quantum state;
performing a CNOT gate operation on the current second sign bit qubit and a third preset auxiliary bit to restore a current quantum state of the third preset auxiliary bit; wherein the second sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
Specifically, the addition unit includes:
the determining subunit is configured to determine, according to the number of bits of qubits corresponding to two quantum states to be operated, the number of target modules of a pre-cascaded module MAJ module to be cascaded and a post-cascaded module UMA module to be cascaded, where the number of modules of the MAJ module is the same as the number of modules of the UMA module;
the cascade subunit is used for cascading the MAJ modules and the 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 performing addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit to generate and output a target quantum state 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 each include two CNOT quantum logic gates and one toffil quantum logic gate,
the addition unit further includes:
the obtaining subunit is configured to obtain operation qubits and a control relationship between the operation qubits corresponding to the two CNOT quantum logic gates and the toffil quantum logic gate, and a timing relationship between the two CNOT quantum logic gates and the toffil quantum logic gate;
and the construction subunit is used for constructing and generating the MAJ quantum circuit or the UMA quantum circuit by using the two CNOT quantum logic gates and the TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation, and using the MAJ quantum circuit or the UMA quantum circuit as a corresponding MAJ module or UMA module.
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:
and according to an addition instruction, taking three output items of an MAJ cascade module as three input items of a corresponding UMA cascade module, and cascading 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 MAJ modules in the number of target modules, and the UMA cascade module is determined by cascading UMA modules in the number of the target modules.
Specifically, the three input items of the MAJ module include a carry input item and two sub-quantum state input items to be calculated, the three output items of the MAJ module include a carry output item and two intermediate result output items, the three input items of the UMA module include a carry output item and two intermediate result output items corresponding to the MAJ module, and the three output items of the UMA module include a result carry output item, an accumulation sum output item and a sub-quantum state input item to be calculated; the cascade subunit is specifically configured to:
according to an addition instruction, taking a carry output item output by a previous MAJ module and the two sub-quantum state input items to be calculated as three input items of a next MAJ module so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of an MAJ module as two input items of a corresponding UMA module, acquiring a previous UMA module of the corresponding UMA module, and taking a result carry output item of the previous UMA module as one input item of the corresponding UMA module, so as to cascade the MAJ modules with the number of the target modules and the UAM modules with the number of the target modules, and generate the initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
and 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.
It can be seen that the present invention is implemented by obtaining dividend data and divisor data to be operated on, converting the dividend data into a first target quantum state, converting the divisor data into a second target quantum state, iteratively executing the quantum state evolution corresponding to the subtraction operation for the first target quantum state and the second target quantum state, counting the number of times of the subtraction operation until the dividend data is subtracted to a negative number, outputting the finally obtained counting result as an integer number of a quotient obtained by dividing the dividend data by the divisor data, iteratively executing quantum state evolution corresponding to decimal place operation of quotient for the current first target quantum state and the current second target quantum state, outputting the finally obtained quantum state on the preset precision place quantum bit, thereby realizing basic arithmetic operation which can be used in quantum lines and filling the blank of the related technology.
Yet another embodiment of the present invention provides an electronic device, including a memory and a processor, the memory having a computer program stored therein, the processor being configured to execute the computer program to perform the method as follows:
s1, obtaining dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
s2, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state, counting the number of times of execution of the subtraction until the dividend data is reduced to a negative number, and outputting a finally obtained counting result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
s3, iteratively executing the 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and S4, outputting the finally obtained quantum state on the preset precision bit qubit, wherein the quantum state comprises the binary value of the decimal place 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 arranged to perform the method as follows when executed:
s1, obtaining dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
s2, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state, counting the number of times of execution of the subtraction until the dividend data is reduced to a negative number, and outputting a finally obtained counting result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
s3, iteratively executing the 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and S4, outputting the finally obtained quantum state on the preset precision bit qubit, wherein the quantum state comprises the binary value of the decimal place of the quotient.
The construction, features and functions of the present invention are described in detail in the embodiments illustrated in the drawings, which are only preferred embodiments of the present invention, but the present invention is not limited by the drawings, and all equivalent embodiments modified or changed according to the idea of the present invention should fall within the protection scope of the present invention without departing from the spirit of the present invention covered by the description and the drawings.

Claims (15)

1. A method of quantum division with precision, the method comprising:
obtaining dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state and the second target quantum state, counting the execution times of the subtraction until the dividend data is reduced to a negative number, and outputting a finally obtained counting result as an integer number of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
iteratively executing quantum state evolution corresponding to 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and outputting the finally obtained quantum state on the preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal place of the quotient.
2. The method of claim 1, wherein iteratively performing a quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state and counting the number of times the subtraction operation is performed until the dividend data is reduced to a negative number comprises:
performing quantum state evolution corresponding to subtraction on the current first target quantum state and the second target quantum state to obtain a first target quantum state containing a subtraction 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 the sign bit sub-quantum state of the first target quantum state currently containing the 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.
3. The method of claim 2, wherein outputting the finally obtained count result as an integer bit of a quotient of the dividend data divided by the divisor data comprises:
and outputting the finally obtained third target quantum state, wherein the third target quantum state comprises an integer bit binary value of the quotient of the dividend data and the divisor data.
4. The method of claim 3, wherein iteratively performing the quantum state evolution corresponding to the decimal place operation of the quotient for the current first target quantum state and the current second target quantum state comprises:
negating the sign bit sub-quantum state of the current second target quantum state, and performing quantum state evolution corresponding to subtraction operation on the current first target quantum state and the sign bit-negated second target quantum state so as to evolve the current first target quantum state into a quantum state containing a remainder binary value of the dividend data divided by the divisor data;
shifting each sub quantum state of the current first target quantum state by one bit to the left, re-inverting the sign bit sub quantum state of the current second target quantum state, iteratively executing quantum state evolution corresponding to subtraction on the first target quantum state shifted by one bit to the left and the second target quantum state re-inverted, and counting the execution times of the subtraction until the first target quantum state shifted by one bit to the left is reduced to a negative number, and obtaining a small bit quantum state containing a binary value of a counting result on a preset intermediate bit quantum bit;
exchanging the last quantum state of the decimal quantum state with the initial quantum state |0> state of the corresponding quantum bit with the preset precision, and outputting the quantum state on the exchanged quantum bit with the preset precision;
and 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 current first target quantum state and the second target quantum state after inverting the sign bit until the preset iteration frequency required by iteratively executing the quantum state evolution corresponding to the decimal place operation of the quotient is reached, wherein the preset iteration frequency is consistent with the digit of the decimal place precision to be calculated.
5. The method of claim 4, further comprising:
and acquiring a preset sign bit qubit, and executing preset quantum logic gate operation on the qubit corresponding to the sign bit sub-quantum state of the first target quantum state, the qubit corresponding to the sign bit sub-quantum state of the second target quantum state, the first preset auxiliary bit and the preset sign bit qubit so as to finally obtain a sign value represented by the sign bit sub-quantum state in the third target quantum state.
6. The method of any one of claims 1-5, wherein the performing the quantum state evolution corresponding to the 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 complementary code operation according to a sign bit quantum state in the reduced quantum state and the quantum state of the third preset auxiliary bit to obtain a first complementary code quantum state; wherein the first complement quantum state is a quantum state that comprises a complement of the subtrahend data;
executing quantum state evolution corresponding to sign bit negation on the sign bit sub-quantum state in the reduced quantum state, and controlling the current reduced quantum state to execute quantum state evolution corresponding to complementary code operation according to the sign bit sub-quantum state after negation and the quantum state of the third preset auxiliary bit to obtain a second complementary code quantum state; wherein the second complement quantum state is a quantum state that comprises a complement of the subtrahend data;
performing quantum state evolution corresponding to an 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 comprising a sum of the complement of the subtrahend data and the complement of the subtrahend data;
controlling the fifth target quantum state to execute quantum state evolution corresponding to complementary code operation according to the sign bit quantum state in the fifth target quantum state and the quantum state of the third preset auxiliary bit to obtain an evolved sixth target quantum state, and outputting the sixth target quantum state as a subtraction operation 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 complements;
and controlling the current reduction quantum state to execute quantum state evolution corresponding to the complementing code 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 negation on the sign bit sub-quantum state in the current reduction quantum state so as to restore the current reduction quantum state.
7. The method of claim 6, wherein the controlling the sign bit sub-quantum state of the reduced quantum state to perform the quantum state evolution corresponding to the complementary code operation according to the sign bit sub-quantum state and the quantum state of the third predetermined auxiliary bit comprises:
performing a CNOT gate operation on a first sign bit qubit and a third preset auxiliary bit corresponding to a sign bit qubit in the subtracted quantum states, wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit;
controlling whether the current subtracted quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current reduced quantum state, and performing quantum state evolution corresponding to addition operation on the negated reduced quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved first complementary code quantum state, otherwise, taking the reduced quantum state as the first complementary code quantum state;
performing a CNOT gate operation on the current first sign bit qubit and a third preset auxiliary bit to restore the quantum state of the current third preset auxiliary bit; wherein the first sign bit qubit is a control bit and the third preset auxiliary bit is a controlled bit.
8. The method according to claim 6, wherein the performing quantum state evolution corresponding to sign bit inversion on the sign bit sub quantum state in the reduced quantum state, and controlling the current reduced quantum state to perform quantum state evolution corresponding to complement code operation according to the inverted sign bit sub quantum state and the quantum state of the third preset auxiliary bit comprises:
executing X gate operation on a second sign bit quantum bit corresponding to the sign bit sub-quantum state in the decrement quantum state to obtain a negated sign bit sub-quantum state;
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;
controlling whether the current subtraction quantum state executes the quantum state evolution corresponding to the complementing code operation or not according to the current quantum state of the third preset auxiliary bit after the CNOT gate operation is executed;
if so, negating the unsigned bit sub-quantum state of the current subtractive quantum state, and performing quantum state evolution corresponding to addition operation on the negated subtractive quantum state and the quantum state |1> state of a fourth preset auxiliary bit to obtain an evolved second complementary code quantum state, otherwise, taking the current subtractive quantum state as the second complementary code quantum state;
performing a CNOT gate operation on the current second sign bit qubit and a third preset auxiliary bit to restore a current quantum state of the third preset auxiliary bit; wherein the second sign bit qubit 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 pre-cascaded module MAJ module to be cascaded and a post-cascaded module UMA module to be cascaded according to the number of bits of quantum bits corresponding to two quantum states to be operated, wherein the number of modules of the MAJ module is the same as that of the UMA module;
according to the addition instruction, the MAJ modules and the UMA modules with the number of the target modules are cascaded to generate a target quantum circuit corresponding to the adder;
and performing addition operation on each sub-quantum state of the two quantum states to be operated through the target quantum circuit to generate and output a target quantum state 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,
before the step of cascading the MAJ modules and the UMA modules, the number of which is equal to the number of the target modules, according to the addition instruction to generate the target quantum line corresponding to the adder, the method further includes:
acquiring operation quantum bits corresponding to the two CNOT quantum logic gates and the TOFFOLI quantum logic gate, a control relation between the operation quantum bits, and a time sequence relation between the two CNOT quantum logic gates and the TOFFOLI quantum logic gate;
and constructing and generating the MAJ quantum circuit or the UMA quantum circuit by using the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate according to the operation quantum bit, the control relation and the time sequence relation, wherein the two CNOT quantum logic gates and the one TOFFOLI quantum logic gate are used as corresponding MAJ modules or UMA modules.
11. The method of claim 10, wherein the MAJ module and the UMA module each comprise three input items and three output items,
the step of cascading the MAJ modules and the UMA modules, the number of which is equal to the number of the target modules, according to the addition instruction to generate the target quantum line corresponding to the adder specifically includes:
and according to an addition instruction, taking three output items of an MAJ cascade module as three input items of a corresponding UMA cascade module, and cascading 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 MAJ modules in the number of target modules, and the UMA cascade module is determined by cascading UMA modules in the number of the 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 computed, 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 of the corresponding MAJ module, the three outputs of the UMA module include a result carry output, an accumulation sum output and a sub-quantum state input to be computed,
the step of using three output items of an MAJ cascade module as three input items of a corresponding UMA cascade module according to an addition instruction to cascade the MAJ cascade module and the corresponding UMA cascade module to generate a target quantum line corresponding to the adder specifically includes:
according to an addition instruction, taking a carry output item output by a previous MAJ module and the two sub-quantum state input items to be calculated as three input items of a next MAJ module so as to cascade the MAJ modules with the number of the target modules;
taking two intermediate result output items of an MAJ module as two input items of a corresponding UMA module, acquiring a previous UMA module of the corresponding UMA module, and taking a result carry output item of the previous UMA module as one input item of the corresponding UMA module, so as to cascade the MAJ modules with the number of the target modules and the UAM modules with the number of the target modules, and generate the initial quantum circuit; the carry output item of the last MAJ module is used as an input item of the corresponding first UMA module;
and 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 dividend data and divisor data to be operated, converting the dividend 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 value-bit sub-quantum state representing the data value;
a first quantum state evolution module, configured to iteratively perform quantum state evolution corresponding to a subtraction operation on the first target quantum state and the second target quantum state, count the number of times of performing the subtraction operation until the dividend data is reduced to a negative number, and output a finally obtained count result as an integer bit of a quotient obtained by dividing the dividend data by the divisor data; the subtracted number of each subtraction is the subtraction result of the last subtraction, and the subtracted number is the divisor data;
the second quantum state evolution module is used for iteratively executing the 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 digits of decimal precision to be calculated, and quantum states containing values of corresponding precision digits are obtained on corresponding preset precision digit quantum bits after each iteration;
and the output module is used for outputting the finally obtained quantum state on the preset precision bit quantum bit, wherein the quantum state comprises the binary value of the decimal place of the quotient.
14. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 12.
15. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 12 when executed.
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
US18/029,558 US20230376276A1 (en) 2020-09-30 2021-09-17 Quantum division operation method and apparatus with precision
PCT/CN2021/119125 WO2022068618A1 (en) 2020-09-30 2021-09-17 Quantum division operation method and apparatus with precision
EP21874279.9A EP4224308A1 (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 true CN112162724A (en) 2021-01-01
CN112162724B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022068618A1 (en) * 2020-09-30 2022-04-07 合肥本源量子计算科技有限责任公司 Quantum division operation method and apparatus with precision

Citations (9)

* 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
US20030093451A1 (en) * 2001-09-21 2003-05-15 International Business Machines Corporation Reversible arithmetic coding for quantum data compression
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

Patent Citations (9)

* 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
US20030093451A1 (en) * 2001-09-21 2003-05-15 International Business Machines Corporation Reversible arithmetic coding for quantum data compression
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
YONG ZHANG: "Four Arithmetic Operations on the Quantum Computer", 《JOURNAL OF PHYSICS: CONFERENCE SERIES》, vol. 1575, pages 1 - 7 *
蒋林智: "(全)同态加密及其在云计算中的应用研究", 《CNKI学位》, vol. 2018, no. 10 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022068618A1 (en) * 2020-09-30 2022-04-07 合肥本源量子计算科技有限责任公司 Quantum division operation method and apparatus with precision

Also Published As

Publication number Publication date
CN112162724B (en) 2024-02-09

Similar Documents

Publication Publication Date Title
CN112199707B (en) Data processing method, device and equipment in homomorphic encryption
CN112114776B (en) Quantum multiplication method, device, electronic device and storage medium
CN111582491A (en) Construction method and device of quantum line
CN111563599A (en) Quantum line decomposition method and device, storage medium and electronic device
CN112200713B (en) Business data processing method, device and equipment in federal learning
KR20060067874A (en) Division and square root arithmetic unit
CN112162723B (en) Quantum subtraction operation method, device, electronic device and storage medium
CN112214200B (en) Quantum subtraction operation method, device, electronic device and storage medium
CN113222155B (en) Quantum circuit construction method and device, electronic device and storage medium
JP2021517301A (en) Stochastic rounding logic
CN101295237B (en) High-speed divider for quotient and balance
CN112162724B (en) Quantum division operation method and device with precision
JP2000004169A (en) Crc operating method and crc arithmetic circuit
CN112162725B (en) Quantum division operation method, quantum division operation device, electronic device and storage medium
WO2022068618A1 (en) Quantum division operation method and apparatus with precision
CN115936127A (en) Quantum technology-based numerical comparison method and device and quantum computer
CN115809042A (en) Quantum modulus addition operation method and device, electronic device and modulus arithmetic assembly
CN115809706A (en) Quantum modulus multiplication operation method and device, electronic device and modulus arithmetic assembly
CN115879555A (en) Quantum modulus fast multiplication method and device and modulus arithmetic component
CN115879554A (en) Quantum modulus square operation method and device, electronic device and modulus arithmetic assembly
CN110598172B (en) Convolution operation method and circuit based on CSA adder
CN116049506A (en) Quantum calculation-based numerical value searching method, device, equipment and storage medium
CN115879553A (en) Quantum modulus complete multiplication method and device and modulus arithmetic component
CN115879556A (en) Quantum modulus operation method, device, medium and modulus arithmetic component
CN113222157B (en) Quantum simulation method, quantum simulation device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
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