CN115409186A - Construction method and device of quantum line corresponding to segmented linear function - Google Patents

Construction method and device of quantum line corresponding to segmented linear function Download PDF

Info

Publication number
CN115409186A
CN115409186A CN202110595106.0A CN202110595106A CN115409186A CN 115409186 A CN115409186 A CN 115409186A CN 202110595106 A CN202110595106 A CN 202110595106A CN 115409186 A CN115409186 A CN 115409186A
Authority
CN
China
Prior art keywords
quantum
linear function
sub
bit
piecewise linear
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.)
Pending
Application number
CN202110595106.0A
Other languages
Chinese (zh)
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 CN202110595106.0A priority Critical patent/CN115409186A/en
Priority to PCT/CN2022/095134 priority patent/WO2022247887A1/en
Priority to EP22810611.8A priority patent/EP4328808A1/en
Publication of CN115409186A publication Critical patent/CN115409186A/en
Priority to US18/515,886 priority patent/US11966815B2/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Algebra (AREA)
  • Evolutionary Biology (AREA)
  • Operations Research (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Databases & Information Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Complex Calculations (AREA)

Abstract

The invention discloses a construction method and a device of a quantum line corresponding to a segmented linear function, wherein the method comprises the following steps: preparing an argument of the target piecewise linear function on a first qubit; constructing a first sub-quantum wire for comparing the independent variable with the abscissa of the segment point based on the first quantum bit and the segment point of the piecewise linear function; constructing a segmented sub-quantum circuit corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum circuit and outputting a comparison result; and constructing the quantum wires corresponding to the piecewise linear functions according to the first sub-quantum wires and the piecewise sub-quantum wires. By utilizing the embodiment of the invention, the linear function can be expressed in the field of quantum computation, and the blank of the related technology is filled.

Description

Construction method and device of quantum line corresponding to segmented linear function
Technical Field
The invention belongs to the technical field of quantum computation, and particularly relates to a construction method and a device of a quantum line corresponding to a segmented linear function.
Background
Quantum computers are physical devices that perform high-speed mathematical and logical operations, store and process quantum information in compliance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, the device is a quantum computer. Quantum computers are a key technology under study because they have the ability to handle mathematical problems more efficiently than ordinary computers, for example, they can speed up the time to break RSA keys from hundreds of years to hours.
At present, piecewise linear functions in the classical field are widely applied in various scenes, but the realization of piecewise linear functions in quantum computation is still a problem to be solved urgently.
Disclosure of Invention
The invention aims to provide a method and a device for constructing a quantum wire corresponding to a piecewise linear function, so as to solve the technical problem of realizing the piecewise linear function in quantum computation.
One embodiment of the present application provides a method for constructing a quantum wire corresponding to a piecewise linear function, where the method includes:
preparing an argument of a target piecewise linear function onto a first qubit;
constructing a first sub-quantum wire for comparing the argument with the abscissa of the segment point based on the first qubit and the segment point of the piecewise linear function;
constructing a segmented sub-quantum wire corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum wire and outputting a comparison result;
and constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
Optionally, the preparing the argument of the target piecewise linear function to the first qubit includes:
for the probability distribution of the arguments of the target piecewise linear function, deriving 2 from said probability distribution N A sampling point of 2 N The corresponding argument values and probabilities of the sampling points are prepared to the N first qubits.
Optionally, the constructing a first sub-quantum wire for comparing the argument with the abscissa of the segment point based on the first qubit and the segment point of the piecewise linear function includes:
acquiring an auxiliary bit corresponding to the first qubit and a comparison bit for outputting a comparison result;
and according to the sectional point abscissa, determining a quantum logic gate of a first sub-quantum line to be constructed for comparing the independent variable with the sectional point abscissa, and combining the first quantum bit, the auxiliary bit and the comparison bit to construct the first sub-quantum line.
Optionally, the constructing a segmented sub-quantum wire corresponding to each segment of the linear function in the piecewise linear function based on the first quantum bit and the comparison bit included in the first sub-quantum wire and outputting the comparison result includes:
obtaining a second qubit for outputting the piecewise linear function;
correspondingly adding a parameter-containing sub-logic gate acting on the second qubit according to each section of the piecewise linear function, and determining a parameter value of the parameter-containing sub-logic gate;
and controlling the parameter-containing sub-logic gate through the first quantum bit and the comparison bit to obtain a sub-quantum circuit corresponding to each section of linear function in the piecewise linear function.
Optionally, the target piecewise linear function is a gain function of the target option; the method further comprises the following steps:
and operating the quantum circuit, and calculating the benefit of the target option according to the operation result of the quantum circuit.
Optionally, the operating the quantum wire and calculating the benefit of the target option according to the operation result of the quantum wire include:
operating a current quantum circuit, and measuring a second quantum bit of the quantum circuit to obtain the amplitude of the second quantum bit;
and carrying out amplitude estimation on the amplitude of the second qubit to obtain an expected value of the benefit function as the benefit of the target option.
Optionally, the method further includes: and converting the income of the target option into the present value.
Another embodiment of the present application provides an apparatus for constructing a quantum wire corresponding to a piecewise linear function, the apparatus including:
the preparation module is used for preparing the independent variable of the target piecewise linear function to the first quantum bit;
a first construction module for constructing a first sub-quantum wire for comparing the argument with the piecewise point abscissa, based on the first qubit and the piecewise point of the piecewise linear function;
a second constructing module, configured to construct a sub-quantum wire segment corresponding to each linear function in the piecewise linear function based on the first quantum bit and a comparison bit included in the first sub-quantum wire segment and outputting a comparison result;
and the third constructing module is used for constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
A further embodiment of the application provides a storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the method of any of the above when executed.
Yet another embodiment of the present application provides an electronic device comprising a memory having a computer program stored therein and a processor configured to execute the computer program to perform the method of any of the above.
Compared with the prior art, the construction method of the quantum circuit corresponding to the piecewise linear function, provided by the invention, is characterized in that the independent variable of the target piecewise linear function is prepared on the first quantum bit; constructing a first sub-quantum line for comparing the argument with the abscissa of the segment point based on the first qubit and the segment point of the piecewise linear function; constructing a segmented sub-quantum circuit corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum circuit and outputting a comparison result; and constructing the quantum lines corresponding to the piecewise linear function according to the first sub-quantum lines and the sub-quantum lines, thereby realizing the representation of the piecewise linear function in the field of quantum computation and filling the blank of the related technology.
Drawings
Fig. 1 is a block diagram of a hardware structure of a computer terminal of a method for constructing a quantum line corresponding to a piecewise linear function according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for constructing a quantum wire corresponding to a piecewise linear function according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a quantum circuit comparator according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a logic OR gate according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a segmented quantum wire according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a quantum wire constructing apparatus corresponding to a piecewise linear function 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.
The embodiment of the invention firstly provides a construction method of a quantum circuit corresponding to a segmented linear function, and the method can be applied to electronic equipment, such as a computer terminal, specifically a common computer, a quantum computer and the like.
The following description will be made in detail by taking the example of the operation on a computer terminal. Fig. 1 is a block diagram of a hardware structure of a computer terminal of a method for constructing a quantum wire corresponding to a segmented linear function according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more processors 102 (only one is shown in fig. 1) (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing option estimation methods based on quantum wires, and optionally may further include 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 wire constructing method corresponding to the piecewise linear function in the embodiment of the present application, and the processor 102 executes various functional applications and data processing by executing 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 to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of 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 so as 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 quantum programs so as to 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 Qrun 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 a commonly used general quantum computing model, represents a circuit that operates on a quantum bit under an abstract concept, and includes the quantum bit, the 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 wire, wherein the total number of quantum bits in the total quantum wire is the same as the total number of 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 state can be evolved by using quantum logic gates, which are the basis for forming quantum circuits, including single-bit quantum logic gates, such as Hadamard gates (H gates, hadamard gates), pauli-X gates (X gates), pauli-Y gates (Y gates), pauli-Z gates (Z gates), RX gates, RY gates, RZ gates, and the like; multi-bit quantum logic gates such as CNOT gates, CR gates, iSWAP gates, toffoli gates, and the like. Quantum logic gates are typically represented using unitary matrices, which are not only matrix-form but also an operation and transformation. The function of a general quantum logic gate on a quantum state is calculated by multiplying a unitary matrix by a matrix corresponding to a quantum state right vector.
Referring to fig. 2, fig. 2 is a schematic flow chart of a method for constructing a quantum wire corresponding to a piecewise linear function according to an embodiment of the present invention, which may include the following steps:
s201, preparing an independent variable of a target piecewise linear function to a first quantum bit;
specifically, the argument value may correspond to different probabilities. The probability distribution of the independent variables from which 2 can be derived N A sampling point of 2 N The corresponding argument values and probabilities of the sampling points are prepared to N first qubits (or sampling bits).
Taking a financial scenario as an example, the target piecewise linear function may be a yield function of options of the target object, and the argument may be a value of the target object.
Wherein the target object includes but is not limited to: financial products, financial derivatives, targeted assets, and the like. Value probability distribution data of the target object is obtained in advance, and the value of the target object (such as stock) after the time t can be determined based on an option pricing Model (such as Black-Scholes-Merton Model, leke-Schles Model). The specific calculation formula is as follows:
Figure BDA0003090577340000061
where t is the expiration time, st is the value of the target object at t, S 0 To initial value, σ is the fluctuation rate parameter, W t The asset value of the target object at t is in accordance with Geometric Brownian Motion (GBM) and r is a yield parameter (i.e., risk-free interest rate).
Due to Brownian motion W t Is normally distributed, and thus S t Is lognormal distribution, the value s of the target object after the expiration time t t Instead of a single point value, successive points follow a continuous probability distribution, i.e. for each point there is a value and a corresponding distribution probability (called value probability), so s is obtained t Corresponding value probability distribution data is obtained
Figure BDA0003090577340000062
Wherein, t i For each of the points in time, there is,
Figure BDA0003090577340000063
for the value corresponding to each point in time,
Figure BDA0003090577340000064
is the corresponding distribution probability. In a lognormal distribution S t Are uniformly sampled in successive points of (2) to obtain N Discrete probability density distribution points, e.g.
Figure BDA0003090577340000065
Wherein i is 0,1, 8230 \ 8230:, 2 N-1
Consider 2 N The sum of individual distribution probabilities is uncertain to be 1 and can be paired with 2 N Normalization operation is carried out on discrete probability density distribution pointsI.e. each
Figure BDA0003090577340000071
Corresponding probability with 2 N An
Figure BDA0003090577340000072
The ratio of the evolution of the corresponding sum of the squares of the probabilities is taken as each
Figure BDA0003090577340000073
Normalizing the probabilities after normalization and thus obtaining 2 N Discrete sampling points, each sampling point comprising a value and a value probability corresponding to the value, i.e.
Figure BDA0003090577340000074
By distributing lognormal S as described above t Is uniformly sampled to 2 N And (4) point setting, namely normalizing after the value of the probability density function of each sampling point is obtained. Thus, the discrete distribution of sampling points can be used to represent the original continuous distribution, and the more sampling points, the larger sampling interval and the larger distribution interval can represent the original distribution pattern.
Then, can be according to 2 N Determining each eigenstate corresponding to the N first qubits according to the corresponding value of each sampling point, and determining the eigenstates according to 2 N And determining the amplitude value of each eigenstate by the value probability corresponding to each sampling point so as to complete the preparation of each qubit in the N first qubits.
Illustratively, first, according to 8 values corresponding to 8 sampling points, 8 eigenstates corresponding to 3 sampling bits are determined, which are |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>, and each eigenstate corresponds to 1 value, such as |000> corresponding to value 1, |001> corresponding to value 2 \8230 | 8230 |111> corresponding to value 8. And then, determining the amplitude of the corresponding eigen state according to the value probability of each value to realize quantum amplitude coding (namely preparation), wherein the coded 3-sampling-bit quantum state represents the distribution information when the target asset is due.
S202, constructing a first sub-quantum line for comparing the independent variable with the abscissa of the segmented point based on the first quantum bit and the segmented point of the piecewise linear function;
specifically, an auxiliary bit corresponding to the first qubit and a comparison bit for outputting a comparison result may be obtained; for example, the number of the auxiliary bits is the same as that of the first qubit, and is N, and the comparison bit is set to 1 bit;
and determining a quantum logic gate of a first sub-quantum circuit to be constructed for comparing the independent variable with the abscissa of the segment point according to the abscissa of the segment point, and constructing the first sub-quantum circuit by combining the first quantum bit, the auxiliary bit and the comparison bit. The segmentation point of the piecewise linear function refers to an intersection point between each piece of the linear function.
For example, as shown in fig. 3, fig. 3 is a schematic circuit diagram of a quantum comparator according to an embodiment of the present invention. The sampling bit to be acted on each prepared corresponding bit and the quantum logic gate on the corresponding auxiliary bit can be sequentially determined according to each bit coding value of the binary complement of the abscissa of the segment point. When the coded value of one bit of the two complementary codes is 0, the corresponding quantum logic gate is a toffil gate, and when the coded value of one bit of the two complementary codes is 1, the corresponding quantum logic gate is a logic or gate. It should be noted that, only when the first bit code value of the two's complement is 0, the corresponding operation without quantum logic gate is performed; when the first bit code value of the two's complement is 1, it corresponds to the operation of the CNOT gate.
In a specific implementation, the OR gate (OR gate) can be constructed by toffsol gate and X gate, and other quantum logic gates equivalent to toffsol gate and logic OR gate are reasonably feasible. As shown in the left-hand line of fig. 4, one configuration of the or gate may include three NOT gates, one toffil gate, and two NOT gates in sequence.
As shown in FIG. 3, | i 1 >、|i 2 >……|i n >For N sample bits, | i 1 >Is the lowest bit, | i n >Is the highest bit, | a 1 >、|a 2 >……|a n >To assist the bit, | a 1 >Is the lowest bit, | a n >Is the most significant bit and C is the compare bit. Through t [1, n ]]A set of n-bit two's complement, t [1 ], representing the abscissa of the segmentation point]Is the lowest order, t [ n ]]Is the highest order bit. The binary code-complementing number of the horizontal coordinate of the segmentation point, the bit number of the auxiliary bit and the bit number of the sampling bit are the same and are in one-to-one correspondence, and the binary code-complementing number and the bit number of the auxiliary bit are both N.
Illustratively, as shown in FIG. 3, t [1 ]]=1, it is determined that the first bit sample bit | i is to be acted on 1 >And a first auxiliary bit | a 1 >The quantum logic gate of (1) is a CNOT gate; t 1]=0, then no action needs to be performed on the first auxiliary bit.
The concept of determining the quantum logic gate aiming at t [2] and t [3]. T [ n ] is the same. Illustratively, as shown by the dashed box in fig. 3, when t [2] =1, the quantum logic gate to be acted on the second bit sampling bit, the first bit auxiliary bit, and the second bit auxiliary bit is determined to be a logic or gate; and when t [2] =0, determining that the quantum logic gate to be acted on the second bit sampling bit, the first bit auxiliary bit and the second bit auxiliary bit is a Toffoli gate.
And so on until the nth auxiliary bit | a is determined n >After the last quantum logic gate to be acted on, | a is then gated through the last CNOT gate n >And preparing the comparison bit, namely preparing the comparison result of the independent variable and the size of the abscissa of the segmentation point on the comparison bit c. For example, by measuring the comparison bit c, |0 is obtained>State, meaning independent variable is smaller than horizontal coordinate of segment point, otherwise, |1 is obtained>And the state indicates that the independent variable is greater than or equal to the abscissa of the segmentation point.
S203, constructing a segmented sub-quantum line corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum line and outputting a comparison result;
specifically, a second qubit for outputting the piecewise linear function may be obtained; the second qubit may be a preset one-bit qubit, which may be called a result bit;
correspondingly adding a parameter-containing sub-logic gate acting on the second qubit according to each section of the piecewise linear function, and determining a parameter value of the parameter-containing sub-logic gate;
wherein, each linear function corresponds to a group of sub-logic gates containing parameters, such as a rotary logic gate; the parameter value (rotation angle) of the sub-logic gate containing the parameter can be determined according to the intercept and the slope of each linear function;
and controlling the parameter-containing sub-logic gate through the first quantum bit and the comparison bit to obtain a sub-quantum circuit corresponding to each section of linear function in the piecewise linear function.
And each group of parametric sub-logic gates comprises logic gates related to intercept, which are not controlled by a first quantum bit, logic gates related to slope, which are controlled by the first quantum bit, and selectively controlled by comparison bits according to the specific conditions of each section of linear function.
Illustratively, the target piecewise linear function consists of two pieces of linear functions. As shown in fig. 5, fig. 5 is a schematic structural diagram of a corresponding segmented sub-quantum wire, which includes: prepared sampling bit i 1 ……i n Compare bit c, result bit res, still include two sets of quantum logic gate RY gates, wherein, first group includes: RY (a) 0 ) Door, quilt i 1 RY (a) controlled in practice 1 ) Door 8230, door 8230and quilt n RY (a) controlled in practice n ) The gate, the real control (solid dots) represents that the quantum logic gate is executed when the quantum state of the control bit before execution is | 1> state, and the first segment of linear function corresponding to the segmented linear function is the first segment of segmented sub-quantum circuit; the second group includes: RY (b) 0 ) Door, receiver i 1 And c actually controlled RY (b) 1 ) Door 8230, door 8230and quilt n And c a real controlled RY (bn) gate corresponding to a second segment of the piecewise linear function, i.e., a second segment of the piecewise sub-quantum wire. This is because: the independent variable is smaller than the horizontal coordinate of the sectional point at first, so that a first group of logic gates corresponding to the first section of linear function is irrelevant to comparison bits; after the independent variable is greater than the abscissa of the segment point, the second segment linear function corresponding to the second group of logic gates is executed, and at this time, the second group of logic gates needs to compare with the comparison bitAnd (4) associating.
For the first set of logic gates, RY (a) 0 ) Parameter a in the door 0 Mapping the intercept of the first linear function (left end-point function value of the domain), RY (a) 1 ) Door to RY (a) n ) Parameter a in a door 1 To a n The slope of the first linear function is mapped. The parameters of the second set of logic gates are determined similarly, and b is 0 The mapping is as follows: a function value obtained by subtracting the left end point function value of the previous segment function from the segment point function value between the second segment function and the first segment function, b 1 To b n The mapping is as follows: the slope value of the second segment of the function minus the slope of the previous segment of the function. If the function is a multi-segment linear function with more than two segments, the comparison bits corresponding to the more segment points are correspondingly added, and the like. As can be understood by those skilled in the art, in practical application, because the range of the parameter of the RY gate, that is, the range of the rotation angle, is 0 to 2, the mapped value can be noticed the property of the trigonometric function itself, and a one-to-one mapping can be constructed on a monotone interval of pi/4.
By sequentially operating the quantum comparator circuit and the segmented sub-quantum circuit, the quantum state and amplitude of the corresponding result bit are obtained by measuring the result bit res.
And S204, constructing quantum wires corresponding to the piecewise linear function according to the first sub quantum wires and the sub quantum wires.
Specifically, the target piecewise linear function may be a yield function f (S) of the target option T ). In practical applications, the quantum wire may be operated, and the benefit of the target option may be calculated according to the operation result of the quantum wire.
Taking the European option as an example, there are four basic options, the yield function f (S) t ) The formula is as follows:
buying the European option call gain: f (S) t )=max{0,S t -K}-C;
Buying the European option fall income: f (S) t )=max{K-S t ,0}-C;
Put European style option expanding income:f(S t )=C-max{0,S t -K};
Sell european option fall gains: f (S) t )=C-max{K-S t ,0};
Wherein S is t Is the option value, K is the right price, and C is the option cost. It can be seen that an option corresponds to a gain function and is a piecewise linear function.
Illustratively, a revenue function for buying an option call is:
Figure BDA0003090577340000101
wherein, the right price K 0 =1, option cost C 0 The left endpoint is 0, the left endpoint function value is-1, and the horizontal coordinate of the segmentation point is the row weight price 1;
the revenue function for selling call options is:
Figure BDA0003090577340000111
wherein, the right price K 1 =2, option cost C 1 And =2, the left endpoint is 0, the left endpoint function value is 2, and the abscissa of the segmentation point is the row weight value 2.
Specifically, a current quantum wire may be operated, and a second qubit of the quantum wire is measured to obtain an amplitude of the second qubit; performing amplitude estimation on the amplitude of the second qubit to obtain an expected value E [ f (S) of the gain function T ) As a benefit of the target option.
The amplitude estimation can be realized by a quantum amplitude estimation algorithm QAE and an improved or modified version thereof, and one preferred mode is specifically as follows:
acquiring a current argument upper bound value and a current argument lower bound value corresponding to the amplitude value of the result bit, and calculating a first difference value of the current argument upper bound value and the current argument lower bound value as a target difference value;
when the target difference value is larger than a preset precision threshold value, determining a next argument amplification factor and a next mark parameter corresponding to the next iteration step according to a preset intermediate variable parameter, a current argument upper bound value and a current argument lower bound value;
controlling a following angle amplification factor of a preset amplification quantum circuit to amplify the quantum circuit in which the result bit is positioned, and measuring the quantum state of the result bit in the quantum circuit in which the amplified result bit is positioned according to the preset total observation times;
calculating a second difference value of a next argument upper bound value and a next argument lower bound value of an amplitude value of a result bit as a target difference value according to a current argument upper bound value, a current argument lower bound value, a next argument amplification factor, a next marker parameter and a measurement result of a quantum state of the result bit until the target difference value is not greater than a precision threshold;
the amplitude value of the resulting bit is determined from the measurement of the quantum state of the resulting bit.
The amplitude value estimation method of the quantum bit (namely the result bit) adopted in the steps determines the amplification parameters of the amplification quantum circuit in each iteration step to continuously iterate to enable the difference value of the upper boundary value and the lower boundary value of the amplitude angle to be within the precision threshold, so that the problem that the amplitude value cannot be converged is avoided, and the accuracy of the amplitude value is improved. The principle and more detailed implementation of the method are disclosed in chinese patent application No. 202011591351.6, application No. 20201229, entitled "method, apparatus, storage medium and electronic apparatus for amplitude estimation of quantum wires", which is not described herein again. Specifically, in practical applications, the benefit of the target option may also be converted into a present value. One of the conversion formulas may be: e [ f (S) T )]*e -rt
It can be seen that by preparing the argument of the target piecewise linear function onto the first qubit; constructing a first sub-quantum wire for comparing the independent variable with the abscissa of the segment point based on the first quantum bit and the segment point of the piecewise linear function; constructing a segmented sub-quantum circuit corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum circuit and outputting a comparison result; and constructing the quantum lines corresponding to the piecewise linear function according to the first sub-quantum lines and the sub-quantum lines, thereby realizing the representation of the linear function in the field of quantum computation and filling the blank of the related technology.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an option combination profit calculation apparatus based on quantum wires according to an embodiment of the present invention, corresponding to the flow shown in fig. 2, the apparatus includes:
a preparation module 601, configured to prepare an argument of a target piecewise linear function onto a first qubit;
a first construction module 602 for constructing a first sub-quantum wire for comparing the argument with the piecewise point abscissa, based on the first qubit and the piecewise point of the piecewise linear function;
a second constructing module 603, configured to construct a segmented sub-quantum wire corresponding to each segment of the piecewise linear function based on the first quantum bit and a comparison bit included in the first sub-quantum wire and outputting a comparison result;
a third constructing module 604, configured to construct a quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each of the segmented sub-quantum wires.
Specifically, the preparation module is specifically configured to:
for the probability distribution of the arguments of the target linear function, deriving 2 from said probability distribution N A sampling point of 2 N The corresponding argument values and probabilities of the sampling points are prepared to the N first qubits.
Specifically, the first building module is specifically configured to:
acquiring an auxiliary bit corresponding to the first qubit and a comparison bit for outputting a comparison result;
and determining a quantum logic gate of a first sub-quantum circuit to be constructed for comparing the independent variable with the abscissa of the segment point according to the abscissa of the segment point, and constructing the first sub-quantum circuit by combining the first quantum bit, the auxiliary bit and the comparison bit.
Specifically, the second building module is specifically configured to:
obtaining a second qubit for outputting the piecewise linear function;
correspondingly adding a parameter-containing sub-logic gate acting on the second qubit according to each section of the piecewise linear function, and determining the parameter value of the parameter-containing sub-logic gate;
and controlling the parameter-containing sub-logic gate through the first quantum bit and the comparison bit to obtain a sub-quantum circuit corresponding to each section of linear function in the piecewise linear function.
Specifically, the target piecewise linear function is a gain function of the target option; the device further comprises:
and the calculation module is used for operating the quantum line and calculating the gain of the target option according to the operation result of the quantum line.
Specifically, the calculation module is specifically configured to:
operating a current quantum circuit, and measuring a second quantum bit of the quantum circuit to obtain the amplitude of the second quantum bit;
and carrying out amplitude estimation on the amplitude of the second qubit to obtain an expected value of the benefit function as the benefit of the target option.
Specifically, the apparatus further comprises: and the conversion module is used for converting the income of the target option into the present value.
It can be seen that by preparing the argument of the target piecewise linear function onto the first qubit; constructing a first sub-quantum wire for comparing the independent variable with the abscissa of the segment point based on the first quantum bit and the segment point of the piecewise linear function; constructing a segmented sub-quantum circuit corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum circuit and outputting a comparison result; and constructing the quantum lines corresponding to the piecewise linear function according to the first sub-quantum lines and the sub-quantum lines, thereby realizing the representation of the linear function in the field of quantum computation and filling the blank of the related technology.
A further embodiment of the invention provides a storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps in any of the above method embodiments when executed.
Specifically, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, preparing an independent variable of a target piecewise linear function on a first quantum bit;
s2, constructing a first sub-quantum line for comparing the independent variable with the abscissa of the segmented point based on the first quantum bit and the segmented point of the piecewise linear function;
s3, constructing a segmented sub-quantum circuit corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum circuit and outputting a comparison result;
and S4, constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
Specifically, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Yet another embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any one of the above method embodiments.
Specifically, the electronic apparatus 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.
Specifically, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, preparing an independent variable of a target piecewise linear function on a first quantum bit;
s2, constructing a first sub-quantum line for comparing the independent variable with the abscissa of the segmented point based on the first quantum bit and the segmented point of the piecewise linear function;
s3, constructing a segmented sub-quantum line corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum line and outputting a comparison result;
and S4, constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
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 (10)

1. A method for constructing a quantum wire corresponding to a piecewise linear function, the method comprising:
preparing an argument of a target piecewise linear function onto a first qubit;
constructing a first sub-quantum wire for comparing the argument with the piecewise point abscissa based on the first qubit and the piecewise point of the piecewise linear function;
constructing a segmented sub-quantum wire corresponding to each segment of linear function in the segmented linear function based on the first quantum bit and a comparison bit contained in the first sub-quantum wire and outputting a comparison result;
and constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
2. The method of claim 1, wherein preparing the argument of the target piecewise linear function onto the first qubit comprises:
for the probability distribution of the arguments of the target piecewise linear function, deriving 2 from said probability distribution N A sampling point of 2 N And preparing the argument values and the probabilities corresponding to the sampling points to the N first qubits.
3. The method of claim 1, wherein constructing a first sub-quantum wire for comparing the argument with the abscissa of the segment point based on the first qubit and the segment point of the piecewise linear function comprises:
acquiring an auxiliary bit corresponding to the first qubit and a comparison bit for outputting a comparison result;
and according to the sectional point abscissa, determining a quantum logic gate of a first sub-quantum line to be constructed for comparing the independent variable with the sectional point abscissa, and combining the first quantum bit, the auxiliary bit and the comparison bit to construct the first sub-quantum line.
4. The method of claim 1, wherein the constructing the segmented sub-quantum wire corresponding to each piece of the piecewise linear function based on the comparison bits included in the first quantum bit and the first sub-quantum wire that output the comparison result comprises:
obtaining a second qubit for outputting the piecewise linear function;
correspondingly adding a parameter-containing sub-logic gate acting on the second qubit according to each section of the piecewise linear function, and determining a parameter value of the parameter-containing sub-logic gate;
and controlling the sub-logic gate containing parameters through the first quantum bit and the comparison bit to obtain a sub-quantum circuit corresponding to each linear function in the piecewise linear function.
5. The method according to any of claims 1-4, wherein the target piecewise linear function is a yield function of a target option; the method further comprises the following steps:
and operating the quantum circuit, and calculating the benefit of the target option according to the operation result of the quantum circuit.
6. The method of claim 5, wherein the operating the quantum wire and calculating the benefit of the target option according to the operation result of the quantum wire comprises:
operating a current quantum circuit, and measuring a second quantum bit of the quantum circuit to obtain the amplitude of the second quantum bit;
and carrying out amplitude estimation on the amplitude of the second qubit to obtain an expected value of the benefit function as the benefit of the target option.
7. The method of claim 5, further comprising:
and converting the income of the target option into the present value.
8. An apparatus for constructing a quantum wire corresponding to a piecewise linear function, the apparatus comprising:
the preparation module is used for preparing the independent variable of the target piecewise linear function on the first quantum bit;
a first construction module for constructing a first sub-quantum wire for comparing the argument with the abscissa of the segment point based on the first qubit and the segment point of the piecewise linear function;
a second constructing module, configured to construct a sub-quantum wire segment corresponding to each linear function in the piecewise linear function based on the first quantum bit and a comparison bit included in the first sub-quantum wire segment and outputting a comparison result;
and the third constructing module is used for constructing the quantum wire corresponding to the piecewise linear function according to the first sub-quantum wire and each subsection sub-quantum wire.
9. 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 7 when executed.
10. 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 7.
CN202110595106.0A 2021-05-28 2021-05-28 Construction method and device of quantum line corresponding to segmented linear function Pending CN115409186A (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202110595106.0A CN115409186A (en) 2021-05-28 2021-05-28 Construction method and device of quantum line corresponding to segmented linear function
PCT/CN2022/095134 WO2022247887A1 (en) 2021-05-28 2022-05-26 Method and apparatus for constructing quantum circuit corresponding to linear function
EP22810611.8A EP4328808A1 (en) 2021-05-28 2022-05-26 Method and apparatus for constructing quantum circuit corresponding to linear function
US18/515,886 US11966815B2 (en) 2021-05-28 2023-11-21 Method and apparatus for constructing quantum circuit corresponding to linear function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110595106.0A CN115409186A (en) 2021-05-28 2021-05-28 Construction method and device of quantum line corresponding to segmented linear function

Publications (1)

Publication Number Publication Date
CN115409186A true CN115409186A (en) 2022-11-29

Family

ID=84156421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110595106.0A Pending CN115409186A (en) 2021-05-28 2021-05-28 Construction method and device of quantum line corresponding to segmented linear function

Country Status (1)

Country Link
CN (1) CN115409186A (en)

Similar Documents

Publication Publication Date Title
US11966815B2 (en) Method and apparatus for constructing quantum circuit corresponding to linear function
CN115144934B (en) Meteorological prediction method based on variable component sub-line and related equipment
US20240095563A1 (en) Quantum convolution operator
CN113222155B (en) Quantum circuit construction method and device, electronic device and storage medium
CN112232513A (en) Quantum state preparation method and device
CN112633507A (en) Method and device for encoding complex vector to quantum circuit
CN114358216B (en) Quantum clustering method based on machine learning framework and related device
CN115545947A (en) Optimal investment portfolio determination method based on variational quantum circuit and related device
CN114358318B (en) Machine learning framework-based classification method and related device
CN115293254A (en) Quantum multilayer perceptron-based classification method and related equipment
CN114764619B (en) Convolution operation method and device based on quantum circuit
CN115409620A (en) Method and device for calculating option combination yield based on quantum circuit
CN114819170A (en) Method, apparatus, medium, and electronic apparatus for estimating options based on quantum line
CN115409185A (en) Construction method and device of quantum line corresponding to linear function
CN114819163B (en) Training method and device for quantum generation countermeasure network, medium and electronic device
CN115409186A (en) Construction method and device of quantum line corresponding to segmented linear function
WO2022166850A1 (en) Quantum circuit-based value-at-risk estimation method and apparatus, medium, and electronic device
CN116011681A (en) Meteorological data prediction method and device, storage medium and electronic device
CN115809707A (en) Quantum comparison operation method and device, electronic device and basic arithmetic assembly
CN116167407B (en) Quantum circulation neural network-based data prediction method and related equipment
CN115147167A (en) Snowball option quantum estimation method, snowball option quantum estimation device, snowball option quantum estimation medium, and electronic device
CN115730670B (en) Method and device for generating mode file, medium and electronic device
CN116049506B (en) Quantum calculation-based numerical value searching method, device, equipment and storage medium
CN115775029B (en) Quantum circuit conversion method, quantum circuit conversion device, quantum circuit conversion medium and electronic device
CN115775028B (en) Quantum circuit optimization method, quantum circuit optimization device, quantum circuit optimization medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, Hefei 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, Hefei high tech Zone, Hefei City, Anhui Province

Applicant before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI

CB02 Change of applicant information