A method and device for constructing a quantum circuit corresponding to a linear function
By preparing the independent variables and quantum bits of the target linear function in quantum computing, adding and controlling quantum logic gates, determining parameter values, and constructing quantum circuits, the implementation problem of linear functions in quantum computing was solved, and the linear function representation in quantum computing was realized.
Patent Information
- Application Number
- CN202110595092.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-28
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2041-05-28
AI Technical Summary
In quantum computing, existing technologies have not yet effectively implemented methods for constructing linear functions.
By preparing the independent variable of the target linear function onto the first quantum bit, obtaining the second quantum bit for outputting the target linear function, adding a parameter-containing quantum logic gate, using the first quantum bit to control the parameter-containing quantum logic gate, determining the parameter value of the quantum logic gate, and constructing the quantum circuit corresponding to the target linear function.
It realizes the representation of linear functions in the field of quantum computing, fills the gap in related technologies, and provides an effective method for constructing quantum circuits.
Smart Images

Figure CN115409185B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of quantum computing, and particularly relates to a construction method and device of a quantum circuit corresponding to a linear function. BACKGROUND
[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Quantum computers have the ability to process mathematical problems more efficiently than ordinary computers, for example, they can accelerate the time for cracking RSA keys from hundreds of years to a few hours, so they have become a key technology under research.
[0003] At present, linear functions in the classical field are widely used in various scenarios, but the implementation of linear functions in quantum computing is still a problem to be solved. SUMMARY
[0004] The purpose of the application is to provide a construction method and device of a quantum circuit corresponding to a linear function, to solve the technical problem of implementing linear functions in quantum computing.
[0005] One embodiment of the present application provides a construction method of a quantum circuit corresponding to a linear function, the method comprising:
[0006] Preparation of the independent variable of the target linear function on the first quantum bit;
[0007] Obtaining a second quantum bit for outputting the target linear function, adding a parameterized quantum logic gate acting on the second quantum bit, and controlling the parameterized quantum logic gate through the first quantum bit;
[0008] According to the target linear function, determining the parameter value of the parameterized quantum logic gate to obtain the quantum circuit corresponding to the target linear function.
[0009] Optionally, the preparation of the independent variable of the target linear function on the first quantum bit comprises:
[0010] According to the probability distribution of the independent variable of the target linear function, obtaining 2 N sampling points from the probability distribution, and preparing the independent variable values and probabilities corresponding to the 2 N sampling points on N first quantum bits.
[0011] Optionally, the addition of the parameterized quantum logic gate acting on the second quantum bit and the control of the parameterized quantum logic gate through the first quantum bit comprises:
[0012] add a first parameter quantum logic gate corresponding to an intercept of the target linear function, the first parameter quantum logic gate acting on the second quantum bit;
[0013] add a second parameter quantum logic gate corresponding to a slope of the target linear function respectively, wherein a first quantum bit corresponds to a second parameter quantum logic gate, the second parameter quantum logic gate acting on the second quantum bit and being controlled by the corresponding first quantum bit.
[0014] Optionally, the parameter value of the parameter quantum logic gate is determined according to the target linear function, comprising:
[0015] the parameter value of the first parameter quantum logic gate is determined according to the intercept of the target linear function;
[0016] the parameter value of the second parameter quantum logic gate is determined according to the slope of the target linear function.
[0017] Optionally, the parameter quantum logic gate is an RY gate.
[0018] Another embodiment of the present application provides a construction device of a quantum circuit corresponding to a linear function, the device comprising:
[0019] a preparation module for preparing an independent variable of a target linear function on a first quantum bit;
[0020] an adding module for obtaining a second quantum bit for outputting the target linear function, adding a parameter quantum logic gate acting on the second quantum bit, and controlling the parameter quantum logic gate through the first quantum bit;
[0021] a determination module for determining a parameter value of the parameter quantum logic gate according to the target linear function, to obtain a quantum circuit corresponding to the target linear function.
[0022] Another embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and the computer program is set to execute the method described in any one of the above embodiments when running.
[0023] Another embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is set to run the computer program to execute the method described in any one of the above embodiments.
[0024] Compared with the prior art, the present invention provides a method for constructing a quantum circuit corresponding to a linear function, which comprises preparing the independent variable of the target linear function onto a first quantum bit; obtaining a second quantum bit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second quantum bit, and controlling the parameter-containing quantum logic gate through the first quantum bit; determining the parameter value of the parameter-containing quantum logic gate according to the target linear function, and obtaining the quantum circuit corresponding to the target linear function, thereby realizing the representation of linear functions in the field of quantum computing and filling the gap in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A hardware structure block diagram of a computer terminal for a method for constructing a quantum circuit corresponding to a linear function provided by an embodiment of the present invention;
[0026] Figure 2 A schematic flow chart of a method for constructing a quantum circuit corresponding to a linear function provided in an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of a quantum circuit corresponding to a linear function provided by an embodiment of the present invention;
[0028] Figure 4 A schematic diagram of the structure of a device for constructing a quantum circuit corresponding to a linear function provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limiting the present invention.
[0030] The embodiment of the present invention first provides a method for constructing a quantum circuit corresponding to a linear function. The method can be applied to electronic devices such as computer terminals, specifically ordinary computers, quantum computers, etc.
[0031] The following describes it in detail by taking running on a computer terminal as an example. Figure 1 The hardware structure block diagram of a computer terminal for a method of constructing a quantum circuit corresponding to a linear function provided by an embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing the option estimation method based on quantum circuits. Optionally, the computer terminal may also include a transmission device 106 for communication functions and an input and output device 108. It will be understood by those skilled in the art that Figure 1The illustrated structure is merely schematic and does not limit the structure of the computer terminal described above. For example, the computer terminal can further include more or fewer components than those shown, or have a different configuration of components than those shown. Figure 1 The illustrated structure is merely schematic and does not limit the structure of the computer terminal described above. For example, the computer terminal can further include more or fewer components than those shown, or have a different configuration of components than those shown. Figure 1 The illustrated structure is merely schematic and does not limit the structure of the computer terminal described above. For example, the computer terminal can further include more or fewer components than those shown, or have a different configuration of components than those shown.
[0032] The memory 104 can be used to store software programs of application software and modules, such as program instructions / modules corresponding to the construction method of the quantum circuit corresponding to the linear function in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e., implements the method described above. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the computer terminal through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0033] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
[0034] It should be noted that a real quantum computer is a hybrid structure, which includes two parts: one part is a classical computer responsible for performing classical computation and control; the other part is a quantum device responsible for running a quantum program to implement quantum computation. The quantum program is a sequence of instructions written in a quantum language such as QRunes language that can run on a quantum computer, which supports quantum logic gate operations and finally realizes quantum computation. Specifically, the quantum program is a sequence of instructions for operating quantum logic gates in a certain time sequence.
[0035] In practical applications, due to the limitation of the development of quantum device hardware, quantum computation simulation is usually needed to verify quantum algorithms, quantum applications, and the like. Quantum computation simulation is a process of simulating the running of a quantum program corresponding to a specific problem by means of a virtual architecture (i.e., a quantum virtual machine) of an ordinary computer. Generally, a quantum program corresponding to a specific problem needs to be constructed. The quantum program referred to in the embodiments of the present application is a program written in a classical language representing quantum bits and their evolution, wherein quantum bits, quantum logic gates, and the like related to quantum computation are represented by corresponding classical codes.
[0036] As an embodiment of a quantum program, a quantum circuit, also referred to as a quantum logic circuit, is the most commonly used general quantum computation model, representing a circuit for operating on quantum bits in an abstract concept, the composition of which includes quantum bits, a circuit (a time line), and various quantum logic gates, and finally the result needs to be read out by a quantum measurement operation.
[0037] Unlike a traditional circuit connected by metal wires to transmit voltage signals or current signals, in a quantum circuit, the circuit can be regarded as being connected by time, that is, the state of a quantum bit naturally evolves with time, and in this process, the quantum bit is operated according to the instruction of a Hamiltonian operator until it encounters a logic gate.
[0038] A quantum program as a whole corresponds to a total quantum circuit, and the quantum program described in the present application refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that: a quantum program can be composed of a quantum circuit, a measurement operation for quantum bits in the quantum circuit, a register for storing measurement results, and a control flow node (a jump instruction), and a quantum circuit can include tens, hundreds, or even thousands or ten thousands of quantum logic gate operations. The execution process of a quantum program is a process of executing all quantum logic gates according to a certain timing sequence. It needs to be noted that the timing sequence is the time sequence in which a single quantum logic gate is executed.
[0039] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, quantum logic gates are used to manipulate qubits. Quantum logic gates enable quantum states to evolve. They form the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates such as the Hadamard gate (H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, and RZ gate; and multi-bit quantum logic gates such as the CNOT gate, CR gate, iSWAP gate, and Toffoli gate. Quantum logic gates are generally represented using unitary matrices. Unitary matrices are not only a matrix form but also a type of operation and transformation. A typical quantum logic gate operates on a quantum state by multiplying the unitary matrix on the left by the matrix corresponding to the quantum state's right vector.
[0040] See also Figure 2 , Figure 2 A schematic flow chart of a method for constructing a quantum circuit corresponding to a linear function provided in an embodiment of the present invention may include the following steps:
[0041] S201, preparing the independent variable of the target linear function onto the first quantum bit;
[0042] Specifically, the values of the independent variables can correspond to different probabilities. The probability distribution of the independent variables of the target linear function can be obtained from the probability distribution. N sampling points, 2 N The independent variable values and probabilities corresponding to the sampling points are prepared on N first quantum bits (or sampling bits).
[0043] Taking the financial scenario as an example, the target linear function can be the payoff function of the option of the target object, and the independent variable is the value of the target object.
[0044] The target objects include but are not limited to: financial products, financial derivatives, underlying assets, etc. By obtaining the value probability distribution data of the target object in advance, the value of the target object (such as stock) after time t can be determined based on the option pricing model (such as Black-Scholes-Merton Model, Lake-Scholes Model). The specific calculation formula is:
[0045]
[0046] Where t is the expiration time, S t is the value of the target object at time t, S0 is the initial value, σ is the volatility parameter, W t The asset value of the target object at time t conforms to the geometric Brownian motion (GBM), and r is the yield parameter (i.e., the risk-free interest rate).
[0047] Due to the Brownian motion W t The distribution of is normal, so S t The distribution is lognormal distribution, and the value of the target object after the expiration time t is S t It is not a single point value, but a continuous point that conforms to the continuous probability distribution. That is, for each point, there is a value and a corresponding distribution probability (also called value probability), so to obtain S t The corresponding value probability distribution data is obtained Among them, t i For each time point, is the value corresponding to each time point, is the corresponding distribution probability. In the log-normal distribution S t We uniformly sample the continuous points of N discrete probability density distribution points, such as Where i is 0, 1...2 N-1 .
[0048] Considering 2 N The sum of the distribution probabilities is not necessarily 1, so 2 N The discrete probability density distribution points are normalized, that is, each The corresponding probability is 2 N indivual The ratio of the square root of the corresponding probability sum squared is used as the The normalized probability is obtained from this 2 N discrete sampling points, each sampling point includes the value and the value probability corresponding to the value, that is,
[0049] By converting the lognormal distribution S t The probability distribution is uniformly sampled to 2 N The probability density function of each sampling point is obtained and then normalized. In this way, the discrete sampling point distribution can be used to represent the original continuous distribution. The more sampling points, the larger the sampling interval, and the better it can represent the original distribution pattern.
[0050] Then, according to the 2 N The values corresponding to the sampling points determine the eigenstates corresponding to the N first quantum bits, and according to 2 N The value probability corresponding to the sampling points determines the amplitude value of each eigenstate to complete the preparation of each quantum bit in the N first quantum bits.
[0051] For example, based on the eight values corresponding to the eight sampling points, the eight eigenstates corresponding to the three sampling bits are determined: |000>, |001>, |010>, |011>, |100>, |101>, |110>, and |111>. Each eigenstate corresponds to a value, for example, |000> corresponds to value 1, |001> corresponds to value 2, and so on, and |111> corresponds to value 8. Then, based on the value probabilities of each value, the amplitude of the corresponding eigenstate is determined to implement quantum amplitude encoding (i.e., preparation). The encoded quantum state of the three sampling bits represents the distribution information of the underlying asset at maturity.
[0052] S202, obtaining a second qubit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second qubit, and controlling the parameter-containing quantum logic gate through the first qubit;
[0053] The second quantum bit may be a preset quantum bit, which may be called a result bit, and the parameter-containing quantum logic gate may be a rotational logic gate, such as an RY gate, etc.
[0054] Specifically, a first parameter-containing quantum logic gate corresponding to the intercept of the target linear function may be added, and the first parameter-containing quantum logic gate acts on the second quantum bit;
[0055] Second parameter-containing quantum logic gates corresponding to the slopes of the target linear functions are added respectively, wherein a first quantum bit corresponds to a second parameter-containing quantum logic gate, and the second parameter-containing quantum logic gate acts on the second quantum bit and is controlled by the corresponding first quantum bit.
[0056] Taking the RY gate as an example, the first parameterized quantum logic gate can be set to one and uncontrolled. The second parameterized quantum logic gate can have the same number as the sampling bits, that is, N, and is controlled by the sampling bits. This is because the function value corresponding to the intercept is independent of the independent variable, and the corresponding first parameterized quantum logic gate is also independent of the sampling bits. However, the slope requires the independent variable to calculate the corresponding function value, so the corresponding second parameterized quantum logic gate must be associated with the sampling bits.
[0057] S203 , determining parameter values of the parameter-containing quantum logic gate according to the target linear function, and obtaining a quantum circuit corresponding to the target linear function.
[0058] Specifically, the parameter values of the first parameterized quantum logic gate can be determined based on the intercept of the target linear function, and the parameter values of the second parameterized quantum logic gate can be determined based on the slope of the target linear function. For example, for a rotational logic gate, the parameter values are the rotation angle values in the unitary matrix of the rotational logic gate.
[0059] For example, Figure 3 As shown, Figure 3This is a schematic diagram of a quantum circuit corresponding to a target linear function, which is used to implement the linear function f(x) = offset + slope * x, where x is the independent variable, offset is the intercept, and slope is the slope. Specifically, it includes: preparing the sampling bits i1...i n , the result bit res, also includes the first parameter-containing quantum logic gate RY(a0) gate, and the second parameter-containing quantum logic gate: RY(a1) gate controlled by i1... controlled by i n RY(a n ) gate, the actual control (solid circle) indicates that the quantum logic gate is executed only when the quantum state of the control bit before execution is |1>state.
[0060] For the first parameter-containing quantum logic gate, the parameter a0 in the RY(a0) gate maps the intercept of the first linear function (the left endpoint function value of the domain), and the RY(a1) gate to the RY(a n ) The parameters a1 to a in the gate n Map the slope of the first linear function. Those skilled in the art will appreciate that, in practical applications, since the RY gate parameter, i.e., the rotation angle, ranges from 0 to 2π, the mapped value can take into account the properties of trigonometric functions, and a one-to-one mapping can typically be constructed on a monotonic interval of π / 4.
[0061] Finally, by running the quantum circuit, we can get the quantum state of the result bit res:
[0062] cos[f(x)]|0>+sin[f(x)]|1>
[0063] By measuring the amplitude of the resulting bit's |0> state and / or |1> state, we can obtain the linear function value f(x). Through quantum circuits in quantum computing, the functionality of linear functions can be realized, and specific function values can be output for specific independent variable values.
[0064] It can be seen that by preparing the independent variable of the target linear function onto the first quantum bit; obtaining the second quantum bit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second quantum bit, and controlling the parameter-containing quantum logic gate through the first quantum bit; determining the parameter value of the parameter-containing quantum logic gate according to the target linear function, and obtaining the quantum circuit corresponding to the target linear function, the representation of linear functions in the field of quantum computing is realized, filling the gap in related technologies.
[0065] See also Figure 4 , Figure 4 A schematic diagram of a quantum circuit-based option combination profit calculation device provided by an embodiment of the present invention, Figure 2 Corresponding to the process shown, the device includes:
[0066] A preparation module 401 is configured to prepare an independent variable of a target linear function on a first quantum bit;
[0067] An adding module 402 is configured to obtain a second quantum bit for outputting the target linear function, add a parameterized quantum logic gate acting on the second quantum bit, and control the parameterized quantum logic gate by the first quantum bit;
[0068] A determination module 403 is configured to determine a parameter value of the parameterized quantum logic gate according to the target linear function, to obtain a quantum circuit corresponding to the target linear function.
[0069] Specifically, the preparation module is specifically configured to:
[0070] obtain, from a probability distribution of an independent variable of a target linear function, two N sampling points from the probability distribution, and prepare independent variable values and probabilities of the two N sampling points on N first quantum bits.
[0071] Specifically, the adding module is specifically configured to:
[0072] add a first parameterized quantum logic gate corresponding to an intercept of the target linear function, the first parameterized quantum logic gate acting on the second quantum bit;
[0073] add a second parameterized quantum logic gate corresponding to a slope of the target linear function, respectively, wherein a first quantum bit corresponds to a second parameterized quantum logic gate, the second parameterized quantum logic gate acting on the second quantum bit and being controlled by the corresponding first quantum bit.
[0074] Specifically, the determination module is specifically configured to:
[0075] determine a parameter value of the first parameterized quantum logic gate according to an intercept of the target linear function;
[0076] determine a parameter value of the second parameterized quantum logic gate according to a slope of the target linear function.
[0077] Specifically, the parameterized quantum logic gate is an RY gate.
[0078] It can be seen that by preparing the independent variable of the target linear function onto the first quantum bit; obtaining the second quantum bit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second quantum bit, and controlling the parameter-containing quantum logic gate through the first quantum bit; determining the parameter value of the parameter-containing quantum logic gate according to the target linear function, and obtaining the quantum circuit corresponding to the target linear function, the representation of linear functions in the field of quantum computing is realized, filling the gap in related technologies.
[0079] Yet another embodiment of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0080] Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
[0081] S1, prepare the independent variable of the target linear function onto the first qubit;
[0082] S2, obtaining a second qubit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second qubit, and controlling the parameter-containing quantum logic gate through the first qubit;
[0083] S3, determining parameter values of the parameter-containing quantum logic gate according to the target linear function, and obtaining a quantum circuit corresponding to the target linear function.
[0084] Specifically, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0085] Yet another embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0086] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0087] Specifically, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0088] S1, prepare the independent variable of the target linear function onto the first qubit;
[0089] S2, obtaining a second qubit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second qubit, and controlling the parameter-containing quantum logic gate through the first qubit;
[0090] S3, determining parameter values of the parameter-containing quantum logic gate according to the target linear function, and obtaining a quantum circuit corresponding to the target linear function.
[0091] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings. The above is only a preferred embodiment of the present invention, but the scope of implementation of the present invention is not limited to what is shown in the drawings. Any changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which do not exceed the spirit covered by the description and drawings, should be within the scope of protection of the present invention.
Claims
1. A method for constructing a quantum circuit corresponding to a linear function, characterized in that: The method comprises: Prepare the independent variable of the target linear function onto the first quantum bit; Obtaining a second qubit for outputting the target linear function, adding a parameter-containing quantum logic gate acting on the second qubit, and controlling the parameter-containing quantum logic gate through the first qubit; wherein adding the parameter-containing quantum logic gate acting on the second qubit and controlling the parameter-containing quantum logic gate through the first qubit includes: adding a first parameter-containing quantum logic gate corresponding to the intercept of the target linear function, the first parameter-containing quantum logic gate acting on the second qubit; and respectively adding second parameter-containing quantum logic gates corresponding to the slope of the target linear function, wherein one first qubit corresponds to one second parameter-containing quantum logic gate, the second parameter-containing quantum logic gate acting on the second qubit and being controlled by the corresponding first qubit; According to the target linear function, the parameter value of the parameter-containing quantum logic gate is determined to obtain the quantum circuit corresponding to the target linear function.
2. The method according to claim 1, characterized in that The step of preparing the independent variable of the target linear function onto the first quantum bit includes: For the probability distribution of the independent variable of the target linear function, obtain 2 from the probability distribution N sampling points, the 2 N The independent variable values and probabilities corresponding to the sampling points are prepared on the N first quantum bits.
3. The method according to claim 1, characterized in that Determining the parameter value of the parameter-containing quantum logic gate according to the target linear function includes: determining a parameter value of the first parameter-containing quantum logic gate according to the intercept of the target linear function; Determine a parameter value of the second parameter-containing quantum logic gate according to the slope of the target linear function.
4. The method according to any one of claims 1 to 3, characterized in that: The parameter-containing quantum logic gate is an RY gate.
5. A device for constructing a quantum circuit corresponding to a linear function, characterized in that: The device comprises: A preparation module, used for preparing the independent variable of the target linear function onto the first quantum bit; an adding module, configured to obtain a second qubit for outputting the target linear function, add a parameter-containing quantum logic gate acting on the second qubit, and control the parameter-containing quantum logic gate through the first qubit; wherein the adding of the parameter-containing quantum logic gate acting on the second qubit and the controlling of the parameter-containing quantum logic gate through the first qubit include: adding a first parameter-containing quantum logic gate corresponding to the intercept of the target linear function, the first parameter-containing quantum logic gate acting on the second qubit; and respectively adding second parameter-containing quantum logic gates corresponding to the slope of the target linear function, wherein one first qubit corresponds to one second parameter-containing quantum logic gate, the second parameter-containing quantum logic gate acting on the second qubit and being controlled by the corresponding first qubit; A determination module is used to determine the parameter values of the parameter-containing quantum logic gate according to the target linear function, and obtain the quantum circuit corresponding to the target linear function.
6. The device according to claim 5, characterized in that The preparation module is specifically used for: For the probability distribution of the independent variable of the target linear function, obtain 2 from the probability distribution N sampling points, the 2 N The independent variable values and probabilities corresponding to the sampling points are prepared on the N first quantum bits.
7. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 4 when executed.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Quantum circuit construction method and device
CN112016691A