Data processing method, device and server
By constructing quantum circuits and inverse quantum circuits to efficiently convert single-hot encoded data into binary encoded data, the problem of high resource and time consumption in the prior art is solved, and efficient quantum state data conversion is achieved.
Patent Information
- Application Number
- CN202210705452.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-06-21
AI Technical Summary
When the prior art converts single-hot encoded quantum state data into binary encoded quantum state data, more quantum gates are used, and the time complexity is high, resulting in more processing resources and longer time, and lack of effective solutions. plan.
By obtaining the quantum state data to be converted, determining its state number, and constructing corresponding quantum lines and inverse quantum lines to perform data conversion to reduce processing resources and time consumption. Specific steps include obtaining the data to be converted, determining the number of states, constructing quantum circuits and inverse quantum circuits, and processing the data to achieve efficient conversion.
It realizes efficiently and accurately converting single-hot coded equal quantum state data into binary coded equal quantum state data at a lower cost, significantly reducing processing resources and time consumption.
Smart Images

Figure CN115049064B_ABST
Abstract
Description
Technical Field
[0001] This specification belongs to the field of quantum computing technology, and in particular to data processing methods, devices and servers. Background Art
[0002] In some data processing scenarios involving quantum computing, it is sometimes necessary to convert one-hot encoded quantum state data into binary encoded quantum state data in order to better perform subsequent data processing.
[0003] However, based on the existing data processing methods, when converting one-hot encoded quantum state data into binary encoded quantum state data, relatively more quantum gates are used and the time complexity is relatively slow, which leads to the conversion process occupying more processing resources and longer processing time.
[0004] Currently, no effective solution has been proposed to the above problems. Summary of the invention
[0005] The data processing method, device and server provided in this specification can efficiently and accurately convert first target data of quantum state data belonging to a first coding type such as one-hot coding into second target data of quantum state data belonging to a second coding type such as binary coding at a relatively low data processing cost, thereby effectively reducing the consumption of processing resources and processing time in the coding conversion process involving quantum computing.
[0006] The embodiment of this specification provides a data processing method, including:
[0007] Acquire first target data to be converted; wherein the first target data includes quantum state data of a first encoding type;
[0008] Determining the state number of the first target data;
[0009] According to the state number of the first target data, a first quantum circuit and a second quantum circuit about the first target data are constructed; wherein the first quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the first coding type; and the second quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the second coding type;
[0010] According to the first quantum circuit, generating a reverse circuit of the first quantum circuit;
[0011] Based on the inverse circuit of the first quantum circuit, the first target data is processed to obtain target data of a transition state type;
[0012] Based on the second quantum circuit, target data of the transition state type is processed to obtain second target data; wherein the second target data includes quantum state data of the second coding type.
[0013] In one embodiment, after obtaining the second target data, the method further includes:
[0014] Processing the second target data according to the target algorithm rules to obtain a target processing result; wherein the target algorithm rules include algorithm rules suitable for processing quantum state data of the second encoding type;
[0015] Determining a target business object combination suitable for the target user according to the target processing result;
[0016] The target business object combination is pushed to the target user.
[0017] In one embodiment, the first encoding type includes: one-hot encoding; the second encoding type includes: binary encoding.
[0018] In one embodiment, the target algorithm rule comprises: an algorithm based on a quantum Fourier circuit.
[0019] In one embodiment, the first quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into one-hot encoded quantum state data;
[0020] Correspondingly, according to the state number of the first target data, a first quantum circuit about the first target data is constructed, including:
[0021] Determining whether the state number of the first target data is an even number;
[0022] When it is determined that the number of states of the first target data is an even number, a current first auxiliary quantum circuit is obtained; wherein the number of states of the current first auxiliary quantum circuit is half of the number of states of the first target data; and the current first auxiliary quantum circuit is constructed based on a recursive rule and a preset construction rule;
[0023] According to the preset construction rules, a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain a corresponding first quantum circuit.
[0024] In one embodiment, after determining whether the state number of the first target data is an even number, the method further includes:
[0025] When it is determined that the state number of the first target data is an odd number, a current first auxiliary quantum circuit is obtained; wherein the state number of the current first auxiliary quantum circuit is a difference value obtained by subtracting one from the state number of the first target data; and the current first auxiliary quantum circuit is constructed based on a recursive rule and a preset construction rule;
[0026] According to the preset construction rules, quantum bits representing the state are added, and corresponding construction is performed using the control NOT gate and the current first auxiliary quantum circuit to obtain the corresponding first quantum circuit.
[0027] In one embodiment, the second quantum circuit comprises a quantum circuit for converting quantum state data of a transition state type into binary-coded quantum state data;
[0028] Correspondingly, according to the state number of the first target data, a second quantum circuit related to the first target data is constructed, including:
[0029] Determine the value type of the state number of the first target data;
[0030] According to the numerical type of the state number of the first target data, a matching preset circuit is determined from a plurality of preset circuits as an intermediate circuit; wherein the preset circuit includes a preset first template circuit, a preset second template circuit and a preset third template circuit;
[0031] A corresponding structure is performed according to the intermediate circuit to obtain a second quantum circuit.
[0032] In one embodiment, the numerical value type includes at least one of the following: an even number, an odd number that does not conform to a preset numerical value relationship, and an odd number that conforms to a preset numerical value relationship.
[0033] In one embodiment, constructing a second quantum circuit about the first target data according to the state number of the first target data further includes:
[0034] Determine the type of method for preparing binary states that meets the target user's requirements based on the target user's requirements for the use of quantum bits and / or auxiliary quantum bits;
[0035] According to the type of method for preparing the binary state and the value type of the state number of the first target data, a matching preset circuit is determined from a plurality of preset circuits as an intermediate circuit.
[0036] In one embodiment, the method types for preparing binary states include: recursive method, expanded to N+1 method, expanded to 2 k Law.
[0037] In one embodiment, the preset first template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, which can act on Use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th quantum bit, the target bit is the i+l-th quantum bit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1-th and i-th quantum bits, respectively, the target bit is the il-th quantum bit, and i is an integer in the interval [Nm,N-1]; use 3 controlled NOT gates, where the control bit of the first controlled NOT gate is the lm-th quantum bit, and the target bit is the Nm-2-th quantum bit; the control bit of the second controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the lm-th quantum bit; the control bit of the third controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the Nm-1-th quantum bit; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0038] In one embodiment, the preset second template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, which can act on Use Adder-Plus-d gates on the last m+1 qubits; use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th qubit, the target bit is the i+l-th qubit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1th and i-th qubits, respectively, the target bit is the il-th qubit, and i is an integer in the interval [Nm,N-1]; use an inverse gate of an Adder-Plus-d gate; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0039] In one embodiment, the preset third template circuit is constructed in the following manner: Act on the last N-2 quantum bits of the transition state; calculate the binary of N-1 and N-2, perform bitwise XOR on them, and obtain the XOR binary sequence, recorded as c; if the i-th bit of c from left to right is 1, use C to control the NOT gate at the 1st and 2nd bits. qubits; prepared according to the binary of N-1 Toffoli gate of quantum bit; if the i-th bit is 1, the i-th bit state of the corresponding Toffoli gate is on, otherwise the state is off; where N is the state number of the first target data, A quantum circuit having a state number of N-1 and used for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0040] In one embodiment, the first encoding type includes: binary encoding; the second encoding type includes: one-hot encoding.
[0041] In one embodiment, the target algorithm rule includes: a quantum approximate optimization algorithm.
[0042] This specification also provides a data processing device, including:
[0043] An acquisition module, used to acquire first target data to be converted; wherein the first target data includes quantum state data of a first coding type;
[0044] A determination module, used for determining the state number of the first target data;
[0045] A construction module, configured to construct a first quantum circuit and a second quantum circuit related to the first target data according to the state number of the first target data; wherein the first quantum circuit is configured to convert quantum state data of a transition state type into quantum state data of a first coding type; and the second quantum circuit is configured to convert quantum state data of a transition state type into quantum state data of a second coding type;
[0046] A generation module, used for generating a reverse circuit of the first quantum circuit according to the first quantum circuit;
[0047] A first processing module is used to process the first target data based on the inverse circuit of the first quantum circuit to obtain target data of a transition state type;
[0048] The second processing module is used to process the target data of the transition state type based on the second quantum circuit to obtain the second target data; wherein the second target data includes the quantum state data of the second coding type.
[0049] The present specification also provides a server, comprising a processor and a memory for storing processor executable instructions, wherein the processor implements relevant steps of the data processing method when executing the instructions.
[0050] The present specification also provides a computer program product, comprising a computer program, wherein the computer program implements the relevant steps of the data processing method when executed by a processor.
[0051] Based on the data processing method, device and server provided in this specification, when it is necessary to convert quantum state data of a first coding type into quantum state data of a second coding type, the state number of the first target data to be converted can be determined first; then, according to the state number of the first target data, a first quantum circuit and a second quantum circuit about the first target data are constructed; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type; and according to the first quantum circuit, an inverse circuit of the first quantum circuit (or an inverse gate of the first quantum circuit) is generated; and then, based on the inverse circuit of the first quantum circuit, the first target data can be processed first to obtain target data of a transition state type based on the inverse circuit of the first quantum circuit; and then, based on the second quantum circuit, the target data of the transition state type can be processed to obtain the second target data. Thus, the first target data of quantum state data of a first coding type such as one-hot coding can be efficiently and accurately converted into second target data of quantum state data of a second coding type such as binary coding with a relatively low data processing cost, effectively reducing the consumption of processing resources and processing time in the coding conversion process involving quantum computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 is a flowchart of a data processing method provided by an embodiment of this specification;
[0054] Figure 2 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0055] Figure 3 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0056] Figure 4 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0057] Figure 5 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0058] Figure 6It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0059] Figure 7 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example;
[0060] Figure 8 It is a schematic diagram of the structure of a server provided by an embodiment of this specification;
[0061] Fig. 9 is a schematic diagram of the structure of a data processing device provided by an embodiment of this specification;
[0062] Fig.10 It is a schematic diagram of an embodiment of applying the data processing method provided by the embodiments of this specification in a scenario example. DETAILED DESCRIPTION
[0063] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0064] See also Figure 1 As shown, the embodiment of this specification provides a data processing method, wherein the method can be specifically applied to the server side. When implemented specifically, the method may include the following contents:
[0065] S101: Acquire first target data to be converted; wherein the first target data includes quantum state data of a first coding type;
[0066] S102: Determine the state number of the first target data;
[0067] S103: constructing a first quantum circuit and a second quantum circuit about the first target data according to the state number of the first target data; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; and the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type;
[0068] S104: generating a reverse circuit of the first quantum circuit according to the first quantum circuit;
[0069] S105: processing the first target data based on the reverse circuit of the first quantum circuit to obtain target data of a transition state type;
[0070] S106: Based on the second quantum circuit, process the target data of the transition state type to obtain second target data; wherein the second target data includes quantum state data of the second coding type.
[0071] Based on the above embodiment, firstly, quantum data of transition state type is introduced, and a first quantum circuit for converting quantum state data of transition state type into quantum state data of first coding type and a second quantum circuit for converting quantum state data of transition state type into quantum state data of second coding type are respectively constructed; then, the first target data is processed through the inverse circuit based on the first quantum circuit to obtain target data of transition state type; based on the second quantum circuit, the target data of transition state type is processed to obtain second target data. Thus, the first target data of quantum state data of first coding type such as one-hot coding can be efficiently and accurately converted into the second target data of quantum state data of second coding type such as binary coding at a relatively low data processing cost, which effectively reduces the consumption of processing resources and processing time in the data processing process.
[0072] In some embodiments, the above-mentioned data processing method can be specifically applied to the server side. Among them, the above-mentioned server can specifically include a background server applied to the data processing system side, which can realize functions such as data transmission and data processing. Specifically, the server can be, for example, an electronic device with data calculation, storage and network interaction functions. Alternatively, the server can also be a software program running in the electronic device to provide support for data processing, storage and network interaction. In this embodiment, the number of the servers is not specifically limited. The server can specifically be one server, or several servers, or a server cluster formed by several servers.
[0073] In some embodiments, in price analysis scenarios involving quantum computing (e.g., option pricing scenarios), or business object promotion scenarios involving quantum computing (e.g., financial management service promotion scenarios) and other related business scenarios, the conversion of quantum state data of different encoding types is often involved.
[0074] For example, in a price analysis scenario, it is relatively easy to directly generate one-hot encoded quantum state data. However, when further processing is performed using the Monte Carlo model to generate normally distributed random variables, it is often more appropriate to use binary-coded quantum state data. At this time, the data processing method provided in this specification can be used to convert the above-mentioned one-hot encoded quantum state data into corresponding binary-coded quantum state data. Then, the Monte Carlo model can be used to process the binary-coded quantum state data to obtain the corresponding normally distributed random variables; then the normally distributed random variables can be used to perform corresponding price analysis (for example, option pricing), etc.
[0075] For another example, in other data processing scenarios involving quantum computing, binary-coded quantum state data is obtained at the beginning. However, further data processing is required using a quantum approximate optimization algorithm. At this time, the data processing method provided in this specification can be used to convert the above binary-coded quantum state data into corresponding one-hot-coded quantum state data; then the quantum approximate optimization algorithm is called to process the one-hot-coded quantum state data to continue subsequent data processing.
[0076] Of course, it should be noted that the application scenarios listed above are only illustrative. In specific implementation, according to specific circumstances and processing requirements, the data processing method provided in this specification can also be applied to other suitable application scenarios. This specification does not limit this.
[0077] In some embodiments, in a price analysis scenario involving quantum computing, the first target data may specifically be multiple possible prices of a business object. In a business object promotion scenario involving quantum computing, the first target data may specifically be multiple possible revenue values of a business object. In a data processing scenario involving quantum computing, the first target object may specifically be multiple possible values of a data object, and so on.
[0078] In some embodiments, the first target data may be specifically understood as quantum state data of a coding type to be converted. The first target data may include quantum state data of a first coding type. The first coding type may be specifically an initial coding type.
[0079] The second target data may be specifically understood as quantum state data of a coding type to be converted into the first target data. The second target data may include quantum state data of a second coding type. The second coding type may specifically be a target coding type.
[0080] In some embodiments, the first encoding type may specifically include: one-hot encoding; the second encoding type may specifically include: binary encoding.
[0081] In contrast, the first encoding type may specifically include: binary encoding; the second encoding type may specifically include: one-hot encoding.
[0082] Among them, the above-mentioned one-hot encoding is also called one-bit valid encoding. Its encoding rule is to use an N-bit state register to encode N states. Each state has its own independent register bit, and at any time, only one of them is valid. That is, only one bit is 1, and the rest are zero values. One-hot encoding can use 0 and 1 to represent some parameters, and use an N-bit state register to encode N states. Using one-hot encoding can expand the values of discrete features to Euclidean space, which makes the distance calculation between features more reasonable. It has the advantages of being suitable for processing non-continuous numerical features and being able to expand features to a certain extent.
[0083] The above binary code is a code composed of two basic characters 0 and 1. Among them, a code element is a binary code. A code word is a different combination of N code elements, and any combination is called a code word.
[0084] The above quantum state data is used to describe the state of an isolated system and contains all the information of the system. Usually, the state contained in a quantum state data includes one or more superposition states.
[0085] The above-mentioned transition state (Edick state), also called intermediate state, or Edick state, can be understood as the intermediate connection type that needs to be experienced in the process of converting data from quantum state data of one encoding type to quantum state data of another encoding type.
[0086] Specifically, in the embodiments of this specification, the above-mentioned one-hot encoded quantum state data (or one-hot encoded state) can be recorded as: Where N is the number of states, O is the type identifier of the one-hot encoding, and α i is a related parameter. The above one-hot encoded quantum state data may include N quantum bits. Among them, the quantum bit can be specifically understood as the characteristics of the possible state.
[0087] The quantum state data of the above transition state type (or Edick state) can be recorded as: Wherein, E is the type identifier of the transition state. The quantum state data of the above transition state type may include A quantum bit.
[0088] The above binary-coded quantum state data (or binary state) can be recorded as: Wherein, B is a binary coded type identifier. The above binary coded quantum state data may contain N-1 quantum bits.
[0089] Specifically, for example, when N=4 and the superposition state of the four states |0>, |1>, |2>, and |3> is required, the one-hot encoded quantum state data can be specifically expressed as: α0|0001>+α1|0010>+α2|0100>+α3|1000>, using 4 quantum bits.
[0090] The binary-coded quantum state data can be specifically expressed as: α0|00>+α1|01>+α2|10>+α3|11>, using 2 quantum bits.
[0091] The quantum state data of the transition state type can be specifically expressed as: α0|000>+α1|001>+α2|011>+α3|111>, using 3 quantum bits.
[0092] In some embodiments, during specific implementation, the corresponding first quantum circuit (or first code converter) and second quantum circuit (or second code converter) can be determined according to the first coding type and the second coding type, as well as preset construction rules.
[0093] In some embodiments, when the first encoding type includes one-hot encoding and the second encoding type includes binary encoding, it is required to convert the quantum state data of the one-hot encoding type into quantum state data of the binary encoding type. Accordingly, the first quantum circuit may specifically include a quantum circuit for converting the quantum state data of the transition state type into the quantum state data of the one-hot encoding, which can be recorded as: The second quantum circuit may specifically include a quantum circuit for converting quantum state data of a transition state type into binary-coded quantum state data, which can be expressed as:
[0094] Among them, the above-mentioned quantum circuit can be specifically understood as an execution sequence of a quantum logic gate, which is executed from left to right. The above-mentioned quantum circuit, which can also be called a quantum logic circuit, is a universal quantum computing model, which represents the circuit for operating quantum bits in an abstract concept. Specifically, it can include quantum bits, circuits (timelines), and various logic gates. The above-mentioned logic gate (or quantum gate, quantum logic gate, Quantum gate) can be a basic quantum circuit in a quantum circuit that operates a small number of quantum bits. Unlike most traditional logic gates, quantum gates are reversible. Specifically, quantum gates can be represented using unitary matrices.
[0095] In some embodiments, when the first quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into quantum state data of a one-hot encoding, correspondingly, the above-mentioned construction of the first quantum circuit regarding the first target data according to the state number of the first target data may include the following contents during specific implementation:
[0096] S1: Determine whether the state number of the first target data is an even number;
[0097] S2: when it is determined that the state number (for example, N) of the first target data is an even number, obtaining a current first auxiliary quantum circuit; wherein the state number (for example, N / 2) of the current first auxiliary quantum circuit is half of the state number of the first target data; and the current first auxiliary quantum circuit is constructed based on a recursive rule and a preset construction rule;
[0098] S3: According to a preset construction rule, a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain a corresponding first quantum circuit.
[0099] In some embodiments, after determining whether the state number of the first target data is an even number, the method may further include the following when implemented:
[0100] S1: when it is determined that the state number (for example, N) of the first target data is an odd number, obtaining a current first auxiliary quantum circuit; wherein the state number (for example, N-1) of the current first auxiliary quantum circuit is a difference value obtained by subtracting one from the state number of the first target data; the current first auxiliary quantum circuit is constructed based on a recursive rule and a preset construction rule;
[0101] S2: According to the preset construction rules, quantum bits representing the state are added, and the control NOT gate and the current first auxiliary quantum circuit are used for corresponding construction to obtain the corresponding first quantum circuit.
[0102] When specifically obtaining the current first auxiliary quantum circuit of the first quantum circuit, you can first distinguish whether the state number of the current first auxiliary quantum circuit is an even number according to the above method, and then determine the current first auxiliary quantum circuit of the current first auxiliary quantum circuit. Recursively downward in the above method until the quantum circuit with a state number of 2 is determined to stop; then take the quantum circuit with a state number of 2 as the starting circuit, and continuously transform it upward in reverse order based on the recursive rule according to the preset construction rule to obtain the current first auxiliary quantum circuit. Then, according to the preset construction rule, the current first auxiliary quantum circuit and the control NOT gate can be used to finally construct the required first quantum circuit.
[0103] Specifically, the state number of the first target data is determined to be N, where N is an integer greater than or equal to 2.
[0104] When N is determined to be an even number, for the case of N = 2, the controlled NOT gate (CNOT gate) can be directly used as the corresponding first quantum circuit, which is recorded as Among them, the Control-NOT (CNOT) gate specifically involves two quantum bit gates, including a control bit and a target bit.
[0105] In the specific construction of the first quantum circuit Before, we can construct The first auxiliary quantum circuit According to the preset construction rules, the first auxiliary quantum circuit is correspondingly transformed by using a controlled NOT gate to obtain the first quantum circuit.
[0106] According to the preset construction rules, the first auxiliary quantum circuit is controlled by the control NOT gate. Make corresponding modifications, see Figure 2 As shown, the following may be included:
[0107] S1: The input end first uses N / 2 controlled NOT gates, where the control bit of each controlled NOT gate is the i-th bit, the target bit is the i+1-th bit, and i is all odd numbers in the interval [1,N].
[0108] S2: Acts on all odd-numbered bits.
[0109] S3: Use N / 2-1 controlled NOT gates, where the control bit of each controlled NOT gate is the i-th bit, the target bit is the i+1-th bit, and i is all even numbers in the interval [1, N-1].
[0110] When N is determined to be an odd number, N-1 is an even number.
[0111] Referring to the embodiment where N is an even number, As a starting point, based on the recursive rule, using the control NOT gate, we gradually construct The first auxiliary quantum circuit
[0112] After obtaining the first auxiliary quantum circuit Afterwards, see Figure 3 As shown, according to the preset construction rules, we can first add a quantum bit representing the state |1> and act on the first auxiliary quantum circuit. To the last N-2 quantum bits of the transition state and the quantum bit in the state of |1>; then use the control NOT gate, the control bit is the first quantum bit, and the target bit is the second quantum bit. Thus, the transformation is completed and the required first quantum circuit is obtained.
[0113] By the above method, for any even number N, Always find and pass a Constructed; for any odd number N, we can always find and pass a Based on the recursive rule, any of the above Always pass It is constructed using a controlled NOT gate.
[0114] Specifically, for example, N = 15, the first time, from top to bottom, based on the recursive rule, determine the The current first auxiliary quantum circuit is The current first auxiliary quantum circuit is The current first auxiliary quantum circuit is The current first auxiliary quantum circuit is The current first auxiliary quantum circuit is Stop and determine the recursive order of the following recursive chain: 15→14→7→6→3→2. Then we can reverse the order (i.e., 2→3→6→7→14→15), from bottom to top, based on the recursive rule, first according to the preset construction rules, use the control NOT gate and Construct and obtain Then according to the preset construction rules, use the control NOT gate and Construct and obtain Then according to the preset construction rules, use the control NOT gate and Construct and obtain Then according to the preset construction rules, use the control NOT gate and Construct and obtain Finally, according to the preset construction rules, the control NOT gate and Construct and obtain the first quantum circuit required
[0115] Through the above embodiments, a first quantum circuit matching the first target data can be constructed efficiently and accurately.
[0116] In some embodiments, when the second quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into binary-coded quantum state data, correspondingly, the above-mentioned construction of the second quantum circuit regarding the first target data according to the state number of the first target data may include the following contents during specific implementation:
[0117] S1: Determine the value type of the state number of the first target data;
[0118] S2: According to the numerical type of the state number of the first target data, determine a matching preset circuit from a plurality of preset circuits as an intermediate circuit; wherein the preset circuit includes a preset first template circuit, a preset second template circuit and a preset third template circuit;
[0119] S3: Perform corresponding construction according to the intermediate circuit to obtain a second quantum circuit.
[0120] In some embodiments, the numerical value type includes at least one of the following: an even number, an odd number that does not conform to a preset numerical relationship, and an odd number that conforms to a preset numerical relationship. The preset numerical relationship can be specifically expressed as: N=2 k +1. Wherein, N is the state number of the first target data, and k is any integer greater than 1.
[0121] In some embodiments, the preset circuit can be specifically understood as a pre-designed and constructed template circuit, which does not need to be temporarily prepared from scratch like constructing the first quantum circuit. The preset circuit can specifically include a preset template circuit A1 (or a preset first template circuit), a preset template circuit A2 (or a preset second template circuit) and a preset template circuit A3 (or a preset third template circuit).
[0122] During specific implementation, different numerical types may be distinguished according to the divide-and-conquer concept, so as to select a matching preset circuit from multiple preset circuits as the intermediate circuit.
[0123] In some embodiments, see Figure 4 As shown, the preset template circuit A1 matches the odd number that complies with the preset numerical relationship.
[0124] Specifically, N = 2 k +1. According to the state number of the first target data, the first parameter l and the second parameter m can be calculated respectively: l = (N-1) / 2, Specifically, the preset template circuit A1 (or the preset first template circuit) may be constructed according to the following steps:
[0125] S1: The number of quantum bits can be divided into two parts, where the first half and the second half are l quantum bits respectively, which can act on
[0126] S2: m controlled NOT gates can be used, where the control bit of each controlled NOT gate is the i-th quantum bit, the target bit is the i+l-th quantum bit, and i is an integer in the interval [l-m+1,l].
[0127] S3: Use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1th and i-th quantum bits, the target bit is the il-th quantum bit, and i is an integer in the interval [Nm,N-1].
[0128] S4: Use 3 controlled NOT gates, where the control bit of the first controlled NOT gate is the lmth quantum bit, and the target bit is the Nm-2th quantum bit; the control bit of the second controlled NOT gate is the Nm-2th quantum bit, and the target bit is the lmth quantum bit; the control bit of the third controlled NOT gate is the Nm-2th quantum bit, and the target bit is the Nm-1th quantum bit.
[0129] Among them, the above-mentioned Toffoli gate is also called CCNOT gate, which involves three quantum bits, including two control bits and one target bit.
[0130] In some embodiments, see Figure 5 As shown, the preset template circuit A2 matches the odd number that does not conform to the preset numerical relationship.
[0131] Specifically, N is not satisfied with the following numerical relationship N = 2 k +1 is an odd number. According to the state number of the first target data, the first parameter l and the second parameter m can be calculated respectively: l = (N-1) / 2, Specifically, the preset template circuit A2 (or the preset second template circuit) may be constructed according to the following steps:
[0132] S1: The number of quantum bits can be divided into two parts, where the first half and the second half are l quantum bits respectively, which can act on
[0133] S2: Use the Adder-Plus-d gate on the last m+1 qubits. For details about the Adder-Plus-d gate, please refer to Figure 6 The Adder-plus-d is first composed of m+1 qubit Fourier gates; then it is composed of m+1 phase gates, and the angle acting on the i-th qubit is Finally, the inverse gate of the Fourier gate is applied.
[0134] S3: Use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th quantum bit, the target bit is the i+l-th quantum bit, and i is an integer in the interval [l-m+1,l].
[0135] S4: Use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1th and i-th quantum bits, the target bit is the il-th quantum bit, and i is an integer in the interval [Nm,N-1].
[0136] S5: Inverse gate using an Adder-Plus-d gate.
[0137] In some embodiments, see Figure 7 As shown, the preset template circuit A3 matches any value type. The preset template circuit A3 can also be obtained based on a recursive rule.
[0138] Specifically, the preset template circuit A3 (or the preset third template circuit) may be constructed according to the following steps:
[0139] S1: Acts on the last N-2 quantum bits of the transition state.
[0140] S2: Calculate the binary of N-1 and N-2, and then perform bitwise XOR on them to obtain the XOR binary sequence, denoted as c.
[0141] S3: If the i-th bit of c from left to right is 1, use C to control the NOT gate between the 1st (control bit) and the 2nd bit. qubits (target bits).
[0142] S4: Binary preparation based on N-1 Toffoli gate of quantum bits. If the i-th bit is 1, the i-th bit state of the corresponding Toffoli gate is on, otherwise it is off. The Toffoli gate is a basic quantum gate. When all control bits that are on are |1> and all control bits that are off are |0>, the target bit is flipped.
[0143] In some embodiments, according to the numerical type of the state number of the first target data, a matching preset circuit is determined from a plurality of preset circuits as an intermediate circuit. In specific implementation, preferably, when it is determined that the numerical type of the state number of the first target data is an odd number that meets the preset numerical relationship, a preset first template circuit can be screened out from a plurality of preset circuits as a matching intermediate circuit; when it is determined that the numerical type of the state number of the first target data is an odd number that does not meet the preset numerical relationship, a preset second template circuit can be screened out from a plurality of preset circuits as a matching intermediate circuit; when it is determined that the numerical type of the state number of the first target data is an even number, a preset third template circuit can be screened out from a plurality of preset circuits as a matching intermediate circuit.
[0144] Of course, in some cases, if the value type of the state number of the first target data is of any type, the preset third template circuit can also be uniformly used as the matching intermediate circuit.
[0145] In some embodiments, in order to more accurately and efficiently construct a second quantum circuit suitable for the first target data, the user's consideration of the type of method for preparing the binary state can be further introduced, and then combined with the number of states of the first target data, to better determine the matching intermediate circuit to construct the second quantum circuit.
[0146] In some embodiments, the method types for preparing binary states include: recursive method, expansion to N+1 method, expansion to 2 k The method for preparing the binary state may specifically refer to a method for converting quantum state data of a transition state type into quantum state data of a second coding type.
[0147] In this embodiment, the method type for preparing the binary state can be recorded as parameter y; and different method types for preparing the binary state can be distinguished and corresponding identification values can be set. For example, when the method type for preparing the binary state is the recursive method, the identification value of y can be set to 1; when the method type for preparing the binary state is the expansion to N+1 method, the identification value of y can be set to 2; when the method type for preparing the binary state is the expansion to 2 k When the method is used, the identification value of y can be set to 3.
[0148] Among them, when using the recursive method, no auxiliary bits are required. When using the expansion to N+1 method, at most N / 3 auxiliary bits are required. When using the expansion to 2 k At most N quantum bits are required for the proposed method.
[0149] Accordingly, the target user can select an appropriate method type for preparing binary states that meets the target user's requirements based on the use requirements of quantum bits and / or auxiliary quantum bits and actual business conditions; or can flexibly customize the method type for preparing binary states based on actual business conditions.
[0150] In some embodiments, the above-mentioned construction of the second quantum circuit related to the first target data according to the state number of the first target data may further include the following contents during specific implementation:
[0151] S1: According to the target user's requirements for the use of quantum bits and / or auxiliary quantum bits, determine the type of method for preparing binary states that meets the target user's requirements;
[0152] S2: According to the type of the method for preparing the binary state and the numerical type of the state number of the first target data, a matching preset circuit is determined from a plurality of preset circuits as the intermediate circuit.
[0153] In specific implementation, based on the divide-and-conquer concept, we can distinguish different combinations of the number of states (N) of the first target data and the type of method (y) for preparing the binary state, select a matching preset circuit from multiple preset circuits as an intermediate circuit, and then construct the corresponding second quantum circuit based on the intermediate circuit. The specific implementation process can be referred to in the following content.
[0154] Specifically, for example, 1), when it is determined that N=3, the controlled NOT gate can be directly used as the intermediate circuit to construct the corresponding second quantum circuit
[0155] 2), otherwise, check whether N is less than 7. When determining that N<7, the control NOT gate representing n=3 (i.e. The intermediate circuit) starts with the preset template circuit A3 and the prepared manufacture The method is recursively constructed step by step until n+1=N, and then the required
[0156] 3), otherwise, when N meets the preset numerical relationship (N=2 k +1) is an odd number, you can first use the method in 2) to prepare (as an intermediate circuit); then As the starting point, according to d = 2 Start by using the preset template circuit A1 and the prepared manufacture The recursive construction is performed step by step until d+1=k. Then the output can be obtained Right now
[0157] 4), otherwise, when y=3, the method in 3) can be used to prepare Then output.
[0158] 5), otherwise, when y=2 is determined, the recursive order of the recursive chain about N can be determined: if N is an odd number, the next state is (N+1) / 2. If N is an even number, the next state is N / 2+1. Until the number of states is less than 7 or equal to 2 k +1. For example, if N=25, the recursive order of the recursive chain is: 26→14→8→5. Then the methods in 1), 2), and 3) can be used to prepare the state circuit represented by the chain at the end, and then the state circuit represented by the preset template circuit A1 (the number of states is 2 k +1), or the preset template circuit A2 (the number of states is not 2 k +1), and then recursively construct the next line in reverse order (i.e., 5→8→14→26). The final output is (N is an odd number) or (N is an even number).
[0159] 6), otherwise, when it is determined that if y=1, the recursive order of the recursive chain about N can be determined: if N is an odd number, the next state is (N+1) / 2. If N is an even number, the next state is N-1. Until the number of states is less than 7 or equal to 2 k +1. For example, N = 25, then the recursive chain is 25→13→7→4. Then you can use the methods in 1), 2), and 3) to prepare the circuit diagram of the state represented by the chain at the end, and then use the preset template circuit A1 (the number of states is 2) to generate the circuit diagram of the state represented by the chain at the end. k +1 and the previous state is an odd number), or the preset template circuit A2 (the state number is not 2 k +1 and the previous state is an odd number), or the preset template circuit A3 (the previous state is an even number) reverses the order (i.e., 4→7→13→25) and recursively constructs the next circuit step by step. The final output
[0160] Through the above embodiments, a second quantum circuit matching the first target data can be constructed efficiently and accurately.
[0161] In some embodiments, since the quantum gate is reversible, the inverse circuit of the first quantum circuit can be generated more efficiently based on the first quantum circuit, thereby obtaining a quantum circuit for converting quantum state data of the first coding type into quantum state data of the transition state type.
[0162] Furthermore, the first target data can be input into the inverse circuit of the first quantum circuit for processing, and the target data of the corresponding transition state type can be output; and then the target data of the transition state type can be input into the second quantum circuit for processing, and the quantum state data of the corresponding second coding type can be output.
[0163] After obtaining the second target data, the method may further include the following contents when implemented:
[0164] S1: Processing the second target data according to the target algorithm rules to obtain a target processing result; wherein the target algorithm rules include algorithm rules suitable for processing quantum state data of the second coding type;
[0165] S2: Determine a target business object combination suitable for the target user according to the target processing result;
[0166] S3: Pushing the target business object combination to the target user.
[0167] Among them, when the first encoding type can also include: one-hot encoding; the second encoding type can also include: binary encoding, the above-mentioned target algorithm rules can specifically include: algorithm rules suitable for processing quantum state data of binary encoding type such as algorithms based on quantum Fourier circuits.
[0168] The above business objects may specifically include: commodity objects, investment objects, financial management business objects, etc. In specific implementation, according to specific business scenarios, the above business objects may also include other types of business objects. This specification does not limit this.
[0169] In some embodiments, the first encoding type may also include: binary encoding; the second encoding type may also include: one-hot encoding. In this case, it is required to convert the quantum state data of the binary encoding type into quantum station data of the one-hot encoding type. Accordingly, the first quantum circuit may specifically include a quantum circuit for converting the quantum state data of the transition state type into the quantum state data of the binary encoding, which can be recorded as: The second quantum circuit may specifically include a quantum circuit for converting quantum state data of a transition state type into quantum state data of a one-hot encoding, which can be expressed as: How to generate As for how to use quantum routes to convert binary coded quantum state data into one-hot coded quantum state data, reference can be made to the above-mentioned first coding type may also include binary coding; the second coding type may also include one-hot coding embodiments, which will not be elaborated in this specification.
[0170] In some embodiments, when the first encoding type includes: binary encoding; the second encoding type includes: one-hot encoding, the target algorithm rules may specifically include: algorithm rules such as quantum approximate optimization algorithm suitable for processing quantum state data of one-hot encoding type.
[0171] As can be seen from the above, based on the data processing method provided by the embodiment of this specification, when it is necessary to convert the quantum state data of the first coding type into the quantum state data of the second coding type, the state number of the first target data to be converted can be determined first; then, according to the state number of the first target data, the first quantum circuit and the second quantum circuit about the first target data are constructed; wherein, the first quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the first coding type; the second quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the second coding type; and according to the first quantum circuit, the inverse circuit of the first quantum circuit is generated; then, based on the inverse circuit of the first quantum circuit, the first target data is processed to obtain the target data of the transition state type; and then, based on the second quantum circuit, the target data of the transition state type is processed to obtain the second target data. Thus, the first target data of the quantum state data of the first coding type such as one-hot coding can be efficiently and accurately converted into the second target data of the quantum state data of the second coding type such as binary coding with a relatively small data processing cost, which effectively reduces the consumption of processing resources and processing time in the data processing process.
[0172] The embodiment of the present specification also provides a server, including a processor and a memory for storing processor executable instructions, wherein the processor can perform the following steps according to the instructions when implemented: obtaining first target data to be converted; wherein the first target data includes quantum state data of a first coding type; determining the state number of the first target data; constructing a first quantum circuit and a second quantum circuit about the first target data according to the state number of the first target data; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type; generating an inverse circuit of the first quantum circuit according to the first quantum circuit; processing the first target data based on the inverse circuit of the first quantum circuit to obtain target data of a transition state type; processing the target data of the transition state type based on the second quantum circuit to obtain the second target data; wherein the second target data includes quantum state data of a second coding type.
[0173] In order to complete the above instructions more accurately, refer to Figure 8As shown, the embodiment of this specification also provides another specific server, wherein the server includes a network communication port 801, a processor 802 and a memory 803, and the above structures are connected through internal cables so that each structure can perform specific data interaction.
[0174] The network communication port 801 can be specifically used to obtain first target data to be converted; wherein the first target data includes quantum state data of a first coding type.
[0175] The processor 802 can be specifically used to determine the state number of first target data; construct a first quantum circuit and a second quantum circuit about the first target data according to the state number of the first target data; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type; according to the first quantum circuit, generate an inverse circuit of the first quantum circuit; based on the inverse circuit of the first quantum circuit, process the first target data to obtain target data of a transition state type; based on the second quantum circuit, process the target data of the transition state type to obtain second target data; wherein the second target data includes quantum state data of a second coding type.
[0176] The memory 803 may be specifically used to store corresponding instruction programs.
[0177] In this embodiment, the network communication port 801 can be a virtual port that is bound to different communication protocols so that different data can be sent or received. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. In addition, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM, CDMA, etc.; it can also be a Wifi chip; it can also be a Bluetooth chip.
[0178] In this embodiment, the processor 802 may be implemented in any appropriate manner. For example, the processor may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc. This specification does not limit this.
[0179] In this embodiment, the memory 803 may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function but no physical form is also called a memory, such as RAM, FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.
[0180] The embodiments of the present specification also provide a computer storage medium based on the above data processing method, wherein the computer storage medium stores computer program instructions, and when the computer program instructions are executed, the following are achieved: obtaining first target data to be converted; wherein the first target data includes quantum state data of a first coding type; determining the number of states of the first target data; constructing a first quantum circuit and a second quantum circuit about the first target data according to the number of states of the first target data; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type; generating an inverse circuit of the first quantum circuit according to the first quantum circuit; processing the first target data based on the inverse circuit of the first quantum circuit to obtain target data of a transition state type; processing the target data of the transition state type based on the second quantum circuit to obtain second target data; wherein the second target data includes quantum state data of a second coding type.
[0181] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0182] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other implementations and will not be described in detail here.
[0183] The embodiments of the present specification also provide a computer program product, comprising a computer program, which implements the following steps when executed by a processor: obtaining first target data to be converted; wherein the first target data includes quantum state data of a first coding type; determining the state number of the first target data; constructing a first quantum circuit and a second quantum circuit about the first target data according to the state number of the first target data; wherein the first quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a first coding type; the second quantum circuit is used to convert quantum state data of a transition state type into quantum state data of a second coding type; generating an inverse circuit of the first quantum circuit according to the first quantum circuit; processing the first target data based on the inverse circuit of the first quantum circuit to obtain target data of a transition state type; processing the target data of the transition state type based on the second quantum circuit to obtain second target data; wherein the second target data includes quantum state data of a second coding type.
[0184] See also Fig. 9 As shown, at the software level, the embodiment of this specification also provides a data processing device, which may specifically include the following structural modules:
[0185] The acquisition module 901 may be specifically used to acquire first target data to be converted; wherein the first target data includes quantum state data of a first coding type;
[0186] A determination module 902 may be specifically used to determine the state number of the first target data;
[0187] The construction module 903 may be specifically used to construct a first quantum circuit and a second quantum circuit about the first target data according to the state number of the first target data; wherein the first quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the first coding type; and the second quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the second coding type;
[0188] A generating module 904 may be specifically configured to generate a reverse circuit of the first quantum circuit according to the first quantum circuit;
[0189] The first processing module 905 may be specifically used to process the first target data based on the inverse circuit of the first quantum circuit to obtain target data of the transition state type;
[0190] The second processing module 906 can be specifically used to process the target data of the transition state type based on the second quantum circuit to obtain the second target data; wherein the second target data includes the quantum state data of the second coding type.
[0191] In some embodiments, after obtaining the second target data, the device can also be used to process the second target data according to the target algorithm rules to obtain the target processing result when it is implemented; wherein the target algorithm rules include algorithm rules suitable for processing quantum state data of the second coding type; based on the target processing result, determine the target business object combination suitable for the target user; and push the target business object combination to the target user.
[0192] In some embodiments, the first encoding type may specifically include: one-hot encoding; the second encoding type may specifically include: binary encoding.
[0193] In some embodiments, the target algorithm rules may specifically include: an algorithm based on a quantum Fourier circuit.
[0194] In some embodiments, the first quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into quantum state data of one-hot encoding; accordingly, when the above-mentioned construction module 903 is specifically implemented, the first quantum circuit about the first target data can be constructed according to the state number of the first target data in the following manner: determining whether the state number of the first target data is an even number; when determining that the state number of the first target data is an even number, obtaining the current first auxiliary quantum circuit; wherein the state number of the current first auxiliary quantum circuit is one-half of the state number of the first target data; the current first auxiliary quantum circuit is constructed based on a recursive rule according to a preset construction rule; according to the preset construction rule, a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain a corresponding first quantum circuit.
[0195] In some embodiments, after determining whether the state number of the first target data is an even number, the device can also be used to obtain the current first auxiliary quantum circuit when the state number of the first target data is determined to be an odd number; wherein the state number of the current first auxiliary quantum circuit is the difference obtained by subtracting one from the state number of the first target data; the current first auxiliary quantum circuit is constructed according to a preset construction rule based on a recursive rule; according to the preset construction rule, quantum bits representing the state are added, and a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain the corresponding first quantum circuit.
[0196] In some embodiments, the second quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into binary-coded quantum state data; accordingly, when the above-mentioned construction module 903 is specifically implemented, the second quantum circuit about the first target data can be constructed according to the state number of the first target data in the following manner: determining the numerical type of the state number of the first target data; according to the numerical type of the state number of the first target data, determining a matching preset circuit from multiple preset circuits as an intermediate circuit; wherein the preset circuit includes a preset first template circuit, a preset second template circuit and a preset third template circuit; and performing corresponding construction according to the intermediate circuit to obtain the second quantum circuit.
[0197] In some embodiments, the numerical value type may specifically include at least one of the following: an even number, an odd number that does not conform to a preset numerical relationship, an odd number that conforms to a preset numerical relationship, and the like.
[0198] In some embodiments, when the above-mentioned construction module 903 is specifically implemented, the second quantum circuit about the first target data can be constructed according to the state number of the first target data in the following manner: according to the target user's use requirements for quantum bits and / or auxiliary quantum bits, determine the type of method for preparing binary states that meets the requirements of the target user; according to the type of method for preparing binary states and the numerical type of the state number of the first target data, determine a matching preset circuit from multiple preset circuits as the intermediate circuit.
[0199] In some embodiments, the method types for preparing binary states may specifically include: recursive method, expansion to N+1 method, expansion to 2 k Law and so on.
[0200] In some embodiments, the preset first template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, which can act on Use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th quantum bit, the target bit is the i+l-th quantum bit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1-th and i-th quantum bits, respectively, the target bit is the il-th quantum bit, and i is an integer in the interval [Nm,N-1]; use 3 controlled NOT gates, where the control bit of the first controlled NOT gate is the lm-th quantum bit, and the target bit is the Nm-2-th quantum bit; the control bit of the second controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the lm-th quantum bit; the control bit of the third controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the Nm-1-th quantum bit; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0201] In some embodiments, the preset second template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, which can act on Use Adder-Plus-d gates on the last m+1 qubits; use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th qubit, the target bit is the i+l-th qubit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1th and i-th qubits, respectively, the target bit is the il-th qubit, and i is an integer in the interval [Nm,N-1]; use an inverse gate of an Adder-Plus-d gate; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0202] In some embodiments, the preset third template circuit is constructed in the following manner: Act on the last N-2 quantum bits of the transition state; calculate the binary of N-1 and N-2, perform bitwise XOR on them, and obtain the XOR binary sequence, recorded as c; if the i-th bit of c from left to right is 1, use C to control the NOT gate at the 1st and 2nd bits. qubits; prepared according to the binary of N-1 Toffoli gate of quantum bit; if the i-th bit is 1, the i-th bit state of the corresponding Toffoli gate is on, otherwise the state is off; where N is the state number of the first target data, A quantum circuit having a state number of N-1 and used for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
[0203] In some embodiments, the first encoding type may specifically include: binary encoding; the second encoding type may specifically include: one-hot encoding.
[0204] In some embodiments, the target algorithm rules may specifically include: quantum approximate optimization algorithm, etc.
[0205] It should be noted that the units, devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions divided into various modules. Of course, when implementing this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0206] As can be seen from the above, the data processing device provided based on the embodiments of this specification can efficiently and accurately convert first target data of quantum state data belonging to a first coding type such as one-hot coding into second target data of quantum state data belonging to a second coding type such as binary coding at a relatively low data processing cost, thereby effectively reducing the consumption of processing resources and processing time in the data processing process.
[0207] In a specific scenario example, the data processing method provided in the embodiments of this specification can be applied to use quantum circuits to realize the mutual conversion between one-hot coded states (for example, quantum state data of one-hot coded type) and binary coded states (quantum state data of binary coded type). For the specific implementation process, please refer to Fig.10 As shown, the specific implementation may include the following contents.
[0208] S1: Design and construct the Edick state (e.g., quantum state data of transition state type) converted to one-hot encoded state The line is denoted as At the same time, we designed and constructed Convert to binary code The line is denoted as
[0209] S2: If you want to convert the one-hot encoding state into a binary encoding state, you can first pass the one-hot encoding state through After the inverse gate (for example, the inverse circuit of the first quantum circuit) (in quantum computing, if a gate can be prepared, then its inverse gate is also very easy to prepare), (For example, the second quantum circuit) outputs a binary coded state.
[0210] If you want to convert binary encoding to one-hot encoding, you can first pass the binary encoding state through After the reverse gate (for example, the reverse circuit of the first quantum circuit), (For example, the second quantum circuit) outputs a one-hot encoded state.
[0211] Among them, the Edick state is a transition quantum state.
[0212] Specific construct preparation in S1 and When , we can first use a recursive method (for example, a recursive rule) to construct the Edick state to the one-hot encoding state The line can be constructed from the Edick state to the binary coded state by using the divide-and-conquer idea. The three preset template lines A1, A2, and A3 can be used; further, the recursive method can be combined with the three methods of preparing binary states, such as the N+1 method and the 2^k method, to more accurately construct and prepare the binary state.
[0213] In this scenario example, the data processing method provided in this specification is also compared with the existing method.
[0214] For the By analyzing the depth and size of the recursive circuit, it is possible to determine The depth d o (N) and size s o (N) satisfies the following two equations:
[0215] d o (N) = d o (N / 2)+2, N is an even number o (N) = s(N / 2) + N-1, N is an even number
[0216] do (N) = d o (N-1), N is an odd number o (N) = s(N-1) + 1, N is an odd number
[0217] d o (2) = 1, s o (2)=1.
[0218] By solving the above two equations, we can get d o (N) = O(log N), s o (N) = O(N).
[0219] For the Three methods can be used to determine The depth d b (N) and size s b (N) satisfies the following equations:
[0220] When y=1, we have the following system of equations:
[0221] N is an odd number
[0222] d b (N) = d b (N+1)+O(log N), N is an even number
[0223] N is an odd number
[0224] s b (N) = s b (N-1)+O(log 2 N), N is an even number;
[0225] When y=2, we have the following system of equations:
[0226] N is an odd number
[0227] d b (N) = d b (N+1), N is an even number
[0228] N is an odd number
[0229] s b (N) = s b (N+1), N is an even number;
[0230] When y=3, we have the following system of equations:
[0231]
[0232]
[0233] Also, due to b (N) = O(log 2 N), s b (N) = O(N); combined with d o (N) = O(log N), s o (N) = O(N), d b (N) = O(log 2 N), s b (N) = O(N), and by solving it we can get:
[0234] Based on the method provided in the specification, the total depth of the conversion circuit is: d(N) = O(log 2 N); the total size is: s(N) = O(N).
[0235] Based on the existing method, the time complexity is too slow and too many quantum gates are used, which leads to the circuit depth (describing the quantum circuit running time) and size (describing the quantum circuit running space) being O(Nlog 2 N).
[0236] By comparing the data processing method provided in this specification with the existing methods, it can be seen that the data processing method provided in this specification does effectively reduce the consumption of processing resources and processing time in the data processing process, and has obvious improvements in both time and space.
[0237] Although the present specification provides method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent a unique execution order. When the device or client product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. The first, second, etc. words are used to represent the name, and do not represent any particular order.
[0238] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0239] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media including storage devices.
[0240] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that the present specification can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present specification can essentially be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.
[0241] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. This specification can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0242] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.
Claims
1. A data processing method, characterized in that: include: Acquire first target data to be converted; wherein the first target data includes quantum state data of a first encoding type; Determining the state number of the first target data; According to the state number of the first target data, a first quantum circuit and a second quantum circuit about the first target data are constructed; wherein the first quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the first coding type; and the second quantum circuit is used to convert the quantum state data of the transition state type into the quantum state data of the second coding type; According to the first quantum circuit, generating a reverse circuit of the first quantum circuit; Based on the inverse circuit of the first quantum circuit, the first target data is processed to obtain target data of a transition state type; Based on the second quantum circuit, processing the target data of the transition state type to obtain second target data; wherein the second target data includes quantum state data of the second coding type; According to the state number of the first target data, constructing a first quantum circuit about the first target data includes: determining whether the state number of the first target data is an even number; when it is determined that the state number of the first target data is an even number, obtaining a current first auxiliary quantum circuit; wherein the state number of the current first auxiliary quantum circuit is one-half of the state number of the first target data; the current first auxiliary quantum circuit is constructed based on a recursive rule and according to a preset construction rule; according to the preset construction rule, a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain a corresponding first quantum circuit; According to the state number of the first target data, a second quantum circuit about the first target data is constructed, including: determining the numerical type of the state number of the first target data; according to the numerical type of the state number of the first target data, determining a matching preset circuit from a plurality of preset circuits as an intermediate circuit; wherein the preset circuit includes a preset first template circuit, a preset second template circuit and a preset third template circuit; and performing corresponding construction according to the intermediate circuit to obtain the second quantum circuit.
2. The method according to claim 1, characterized in that: After obtaining the second target data, the method further includes: Processing the second target data according to the target algorithm rules to obtain a target processing result; wherein the target algorithm rules include algorithm rules suitable for processing quantum state data of the second encoding type; Determining a target business object combination suitable for the target user according to the target processing result; The target business object combination is pushed to the target user.
3. The method according to claim 2, characterized in that The first encoding type includes: one-hot encoding; the second encoding type includes: binary encoding.
4. The method according to claim 3, characterized in that The target algorithm rules include: an algorithm based on a quantum Fourier circuit.
5. The method according to claim 3, characterized in that: The first quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into one-hot encoded quantum state data.
6. The method according to claim 5, characterized in that After determining whether the state number of the first target data is an even number, the method further includes: When it is determined that the state number of the first target data is an odd number, a current first auxiliary quantum circuit is obtained; wherein the state number of the current first auxiliary quantum circuit is a difference value obtained by subtracting one from the state number of the first target data; and the current first auxiliary quantum circuit is constructed based on a recursive rule and a preset construction rule; According to the preset construction rules, quantum bits representing the state are added, and corresponding construction is performed using the control NOT gate and the current first auxiliary quantum circuit to obtain the corresponding first quantum circuit.
7. The method according to claim 3, characterized in that The second quantum circuit includes a quantum circuit for converting quantum state data of a transition state type into binary-coded quantum state data.
8. The method according to claim 7, characterized in that The numerical value type includes at least one of the following: an even number, an odd number that does not conform to a preset numerical value relationship, and an odd number that conforms to a preset numerical value relationship.
9. The method according to claim 7, characterized in that: According to the state number of the first target data, a second quantum circuit about the first target data is constructed, further comprising: Determine the type of method for preparing binary states that meets the target user's requirements based on the target user's requirements for the use of quantum bits and / or auxiliary quantum bits; According to the type of method for preparing the binary state and the value type of the state number of the first target data, a matching preset circuit is determined from a plurality of preset circuits as an intermediate circuit.
10. The method according to claim 9, characterized in that Types of methods for preparing binary states, including: recursive method, expansion to N+1 method, expansion to 2 k Law.
11. The method according to claim 7, characterized in that The preset first template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, acting on Use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th quantum bit, the target bit is the i+l-th quantum bit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1-th and i-th quantum bits, respectively, the target bit is the il-th quantum bit, and i is an integer in the interval [Nm,N-1]; use 3 controlled NOT gates, where the control bit of the first controlled NOT gate is the lm-th quantum bit, and the target bit is the Nm-2-th quantum bit; the control bit of the second controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the lm-th quantum bit; the control bit of the third controlled NOT gate is the Nm-2-th quantum bit, and the target bit is the Nm-1-th quantum bit; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
12. The method according to claim 7, characterized in that The preset second template circuit is constructed in the following manner: the number of quantum bits is divided into two parts, wherein the first half and the second half are l quantum bits respectively, acting on Use Adder-Plus-d gates on the last m+1 qubits; use m controlled NOT gates, where the control bit of each controlled NOT gate is the i-th qubit, the target bit is the i+l-th qubit, and i is an integer in the interval [l-m+1,l]; use m Toffoli gates, where the control bits of each Toffoli gate are the Nm-1th and i-th qubits, respectively, the target bit is the il-th qubit, and i is an integer in the interval [Nm,N-1]; use an inverse gate of an Adder-Plus-d gate; where N is the number of states of the first target data, l=(N-1) / 2, is a quantum circuit with a state number of l+1 for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
13. The method according to claim 7, characterized in that The preset third template circuit is constructed in the following manner: Act on the last N-2 quantum bits of the transition state; calculate the binary of N-1 and N-2, perform bitwise XOR on them, and obtain the XOR binary sequence, recorded as c; if the i-th bit of c from left to right is 1, use C to control the NOT gate at the 1st and 2nd bits. qubits; prepared according to the binary of N-1 Toffoli gate of quantum bit; if the i-th bit is 1, the i-th bit state of the corresponding Toffoli gate is on, otherwise the state is off; where N is the state number of the first target data, A quantum circuit having a state number of N-1 and used for converting quantum state data of a transition state type into quantum state data of one-hot encoding.
14. The method according to claim 2, characterized in that The first encoding type also includes: binary encoding; the second encoding type also includes: one-hot encoding.
15. A data processing device, characterized in that: include: An acquisition module, used to acquire first target data to be converted; wherein the first target data includes quantum state data of a first coding type; A determination module, used for determining the state number of the first target data; A construction module, configured to construct a first quantum circuit and a second quantum circuit related to the first target data according to the state number of the first target data; wherein the first quantum circuit is configured to convert quantum state data of a transition state type into quantum state data of a first coding type; and the second quantum circuit is configured to convert quantum state data of a transition state type into quantum state data of a second coding type; A generation module, used for generating a reverse circuit of the first quantum circuit according to the first quantum circuit; A first processing module is used to process the first target data based on the inverse circuit of the first quantum circuit to obtain target data of a transition state type; A second processing module, used to process the target data of the transition state type based on the second quantum circuit to obtain second target data; wherein the second target data includes quantum state data of the second coding type; The construction module is specifically used to determine whether the state number of the first target data is an even number; when it is determined that the state number of the first target data is an even number, the current first auxiliary quantum circuit is obtained; wherein the state number of the current first auxiliary quantum circuit is one-half of the state number of the first target data; the current first auxiliary quantum circuit is constructed based on a recursive rule and according to a preset construction rule; according to the preset construction rule, a control NOT gate and the current first auxiliary quantum circuit are used to perform corresponding construction to obtain a corresponding first quantum circuit; The construction module is also specifically used to determine the numerical type of the state number of the first target data; according to the numerical type of the state number of the first target data, determine a matching preset circuit from multiple preset circuits as an intermediate circuit; wherein the preset circuit includes a preset first template circuit, a preset second template circuit and a preset third template circuit; and perform corresponding construction according to the intermediate circuit to obtain a second quantum circuit.
16. A server, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 14 when executing the instructions.
17. A computer program product, characterized in that The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 14 when being executed by a processor.
Citation Information
Patent Citations
Adjustable electrical components formed from arrays of differential circuit elements
CN101626222A
Quantum multiplication operation method and device, electronic device and storage medium
CN112114776A
Model processing method and device, equipment, storage medium and product
CN112561069A
Artificial neuron construction method based on quantum circuit
CN113159303A
Quantum AND logic gate, inverse quantum AND logic gate and logic operation line generation method
CN114399052A
