Quantum state amplitude coding method, device, equipment and medium
By normalizing complex vectors and building quantum circuits, efficient amplitude encoding of complex vectors is achieved, solving the shortcomings of complex vector encoding in the field of quantum machine learning, and achieving 100% fidelity.
Patent Information
- Application Number
- CN202510293702.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-13
AI Technical Summary
How to efficiently encode complex vector data into quantum states solves the shortcomings of complex vector encoding in the field of quantum machine learning in the prior art.
By normalizing the complex vector to be encoded, calculating its mode length and radial angle, building a quantum circuit with a parameter sub-gate, using the real vector amplitude coding algorithm to calculate the parameters, generating the first and second quantum circuits, and outputting the target quantum state.
It realizes efficient amplitude encoding of N=2n-dimensional normalized complex vectors, achieving 100% fidelity without relying on auxiliary qubits, and is suitable for a variety of real vector amplitude encoding schemes.
Smart Images

Figure CN119783842A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quantum computing technology, and in particular to a quantum state amplitude encoding method, device, equipment and medium. Background Art
[0002] Quantum algorithms, as an advanced computing paradigm based on the principles of quantum mechanics, use quantum bits (Qubit) as the basic unit of information encoding, and cleverly utilize the unique properties of quantum mechanics such as quantum superposition and quantum entanglement to achieve efficient processing of computing tasks. In specific computing scenarios, quantum algorithms have shown significant performance advantages over traditional algorithms. For example, Shor's algorithm provides an exponential acceleration effect compared to classical algorithms when dealing with the prime factorization problem of large integers; and Grover's algorithm achieves a quadratic efficiency improvement when performing search tasks on unordered databases compared to classical search algorithms. These breakthroughs not only demonstrate the potential of quantum algorithms in solving complex problems, but also provide a solid theoretical foundation and practical guidance for the continued development and practical application of quantum computing technology.
[0003] At present, in the field of classical machine learning, the data processed by the algorithm is mainly real vectors; in the field of quantum machine learning, the data mainly processed by quantum algorithms is often complex vectors. Therefore, how to efficiently encode complex vector data into quantum states is an urgent problem that needs to be solved. Summary of the invention
[0004] The purpose of the present invention is to provide a quantum state amplitude encoding method, device, equipment and medium.
[0005] The embodiment of the present invention provides a quantum state amplitude coding method, comprising: normalizing a complex vector to be coded to obtain a normalized complex vector to be coded, wherein the normalized complex vector to be coded includes 2 n elements, n is a positive integer; the modulus of each element in the normalized complex vector to be encoded is calculated to obtain a modulus vector; a quantum circuit including a parameterized quantum gate is constructed according to the modulus vector, and the parameters of the parameterized quantum gate are calculated using a real vector amplitude coding algorithm to obtain a first quantum circuit with a fixed parameter value to output a first quantum state after evolution of the first quantum circuit, wherein the modulus vector is mapped to the amplitude of the first quantum state; the argument of each element in the normalized complex vector to be encoded is calculated to obtain an argument vector; a second quantum circuit is constructed according to the argument vector, wherein the second quantum circuit includes 2 sequentially connected nAn operation unit is provided, wherein the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state correspondingly; the first quantum circuit and the second quantum circuit are executed to output a target quantum state, wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; and the first quantum circuit and the second quantum circuit both contain n quantum bits.
[0006] Furthermore, the second quantum circuit is constructed according to the argument vector, including: initializing n quantum bits, the n quantum bits are sorted in order from low to high; dividing the initialized n quantum bits into 2 n Operation unit; 2 n The operation units are numbered 0, 1, ..., 2. n -2,2 n -1 in sequence; convert the sequence number of each operation unit into an n-bit binary string, wherein the characters in the n-bit binary string correspond one-to-one to the sequence of the quantum bits from low to high in order from low to high; allocate each computational basis state in the first quantum state in sequence according to the sequence number of each operation unit, so that each operation unit has a target basis state corresponding to the n-bit binary string; create a multi-controlled phase-shift gate in each operation unit, wherein the multi-controlled phase-shift gate is an n-bit quantum gate, the multi-controlled phase-shift gate acts on the quantum bit of the highest bit, and the multi-controlled phase-shift gate has n-1 controlled bits, the sequence of each radiation angle in the radiation angle vector corresponds one-to-one to the sequence number of each operation unit, and each multi-controlled phase-shift gate carries The parameter of the band is the corresponding argument in the argument vector; a first operation column and a second operation column are created in each operation unit, wherein the multi-controlled phase-shift gate is located between the first operation column and the second operation column, the first operation column includes n first quantum gates, and the n quantum gates are correspondingly arranged on n quantum bits, the second operation column is set to be the same as the first operation column, the first quantum gate is set to be an X gate or an I gate, the first operation column is used to convert the target ground state of the current operation unit into a full|1> state, and perform an operation on the current multi-controlled phase-shift gate to achieve adding the current argument to the amplitude of the corresponding first quantum state, and the second operation column is used to make the calculation ground state in the quantum state output by each operation unit consistent with each calculation ground state in the first quantum state.
[0007] Further, the creation of the first operation column and the second operation column in each operation unit includes: performing a unitary operation on an n-bit binary string to convert a target ground state corresponding to the current operation unit into a full |1> state; wherein, judging whether a current character in the n-bit binary string corresponding to the current operation unit is equal to "0", if the current character is equal to "0", setting the first quantum gate on the target quantum bit corresponding to the current character to an X gate, and if the current character is not equal to "0", setting the first quantum gate to an I gate; traversing all characters in the n-bit binary string in sequence, so that the target ground state corresponding to the current operation unit is converted into a full |1> state, so as to complete the creation of the first operation column before the multi-controlled phase shift gate; and creating the second operation column after the multi-controlled phase shift gate.
[0008] Furthermore, constructing the second quantum circuit according to the argument vector also includes: traversing in sequence according to the sequence number of each operation unit to complete the creation of a multi-controlled phase-shift gate, a first operation column and a second operation column in each operation unit, thereby adding each argument in the argument vector to the amplitude of the first quantum state accordingly.
[0009] Furthermore, constructing the second quantum circuit according to the argument vector also includes: arbitrarily arranging the execution order of each operation unit in the second quantum circuit; adjusting the execution order of each operation unit in the second quantum circuit so that two adjacent X gates on the same quantum bit cancel each other out, so as to obtain an optimized second quantum circuit with the least quantum gates.
[0010] Furthermore, executing the first quantum circuit and the second quantum circuit to output a target quantum state includes: connecting the first quantum circuit and the optimized second quantum circuit in a front-to-back order to obtain a combined quantum circuit; and executing the combined quantum circuit to output the target quantum state.
[0011] Furthermore, the parameter-containing quantum gates in the first quantum circuit include one or more of the following: an RX gate, an RY gate, an RZ gate, a multi-qubit RX gate, a multi-qubit RY gate, and a multi-qubit RZ gate.
[0012] The embodiment of the present invention provides a quantum state amplitude coding device, comprising: a normalization module, which is used to normalize a complex vector to be coded to obtain a normalized complex vector to be coded, wherein the normalized complex vector to be coded includes 2 nelements, n is a positive integer; a modulus vector module, which is used to calculate the modulus of each element in the normalized complex vector to be encoded to obtain a modulus vector; a first construction module, which is used to construct a quantum circuit including a parameterized quantum gate according to the modulus vector, and use a real vector amplitude coding algorithm to calculate the parameters of the parameterized quantum gate to obtain a first quantum circuit with a fixed parameter value, so as to output a first quantum state after evolution of the first quantum circuit, wherein the modulus vector is mapped to the amplitude of the first quantum state; an argument vector module, which is used to calculate the argument of each element in the normalized complex vector to be encoded to obtain an argument vector; a second construction module, which is used to construct a second quantum circuit according to the argument vector, wherein the second quantum circuit includes 2 sequentially connected n An operation unit is provided, and the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state accordingly; an output module is used to execute the first quantum circuit and the second quantum circuit to output the target quantum state, wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; the first quantum circuit and the second quantum circuit both contain n quantum bits.
[0013] An embodiment of the present invention provides an electronic device, which includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the method described above are implemented.
[0014] An embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the method described above are implemented.
[0015] The above technical solution of the present invention has the following beneficial technical effects: In the embodiment of the present invention, the amplitude coding of the modulus vector can be realized by adopting the real vector amplitude coding algorithm; the first quantum state after the first quantum circuit evolution can include 2 n The calculation basis state can be 2 n The calculated ground state and 2 n The operation units are allocated one by one in sequence, and then each argument in the argument vector can be added to the amplitude of the first quantum state one by one in the corresponding order by executing the operation units in the second quantum circuit; the first quantum circuit and the second quantum circuit are connected in a front-to-back order, and the first quantum circuit and the second quantum circuit are executed to output the target quantum state, thereby realizing N=2 n The technical solution of the present invention can flexibly adapt to a variety of real vector amplitude coding schemes, aiming to solve the problem of 2-dimensional normalized complex vector to be encoded. nThe amplitude coding problem of a 1-dimensional normalized complex vector can be solved without relying on auxiliary quantum bits, and the amplitude-coded quantum state corresponding to the normalized complex vector can be accurately output. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the drawings in the embodiment of the present invention are briefly introduced below.
[0017] Figure 1 It is a flowchart of a quantum state amplitude encoding method according to an embodiment of the present invention.
[0018] Figure 2 It is a schematic diagram of a top-down amplitude coded quantum circuit constructed according to a modulus vector in an embodiment of the present invention.
[0019] Figure 3 It is a schematic diagram of another top-down amplitude coded quantum circuit constructed according to the modulus vector in an embodiment of the present invention.
[0020] Figure 4 This is a schematic diagram of an optimized first quantum circuit according to an embodiment of the present invention.
[0021] Figure 5 It is a schematic diagram of a second quantum circuit constructed according to an argument vector in an embodiment of the present invention.
[0022] Figure 6 yes Figure 5 Schematic diagram of a second quantum circuit after optimizing the quantum circuit in .
[0023] Figure 7 This is another schematic diagram of a second quantum circuit constructed according to an argument vector in an embodiment of the present invention.
[0024] Figure 8 This is a schematic diagram of a combined quantum circuit according to an embodiment of the present invention.
[0025] Fig. 9 It is a structural block diagram of a quantum state amplitude encoding device according to an embodiment of the present invention.
[0026] Fig.10 It is a schematic diagram of an electronic device used to implement a quantum state amplitude encoding method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirit of the present invention clearer and more thorough, so that those skilled in the art can better understand and implement the principles and spirit of the present invention. The exemplary embodiments provided herein are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a quantum state amplitude encoding method, quantum circuit, electronic device, and computer-readable storage medium. Therefore, the present disclosure may be implemented in at least one of the following forms: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0029] In this document, terms such as first, second, etc. are only used to distinguish one entity (or operation) from another entity (or operation), and do not require or imply any order or association between these entities (or operations). In this document, the elements (such as parts, components, processes, steps) defined by the sentence "including..." do not exclude the existence of other elements in addition to the listed elements, that is, other elements that are not explicitly listed may also be included. In this document, any elements and their quantities in the drawings are used for illustration rather than limitation, and any names in the drawings are only used for distinction and do not have any limiting meaning.
[0030] The principle and spirit of the present invention are explained in detail below with reference to several exemplary or representative embodiments of the present invention.
[0031] Quantum state refers to the state of quantum bits, and its eigenstate is represented by binary in quantum algorithms (or quantum programs). For example, a group of quantum bits is q0, q1, q2, which represent the 0th, 1st, and 2nd quantum bits, and are ordered from low to high as q0, q1, and q2. The quantum state that can be evolved from this group of quantum bits can be represented as a linear combination of 8 computational basis states on 3 quantum bits: x0|000>, x1|001>, x2|010>, x3|011>, x4|100>, x5|101>, x6|110>, and x7|111>. There are 8 (2 3 ) amplitudes, corresponding to the 8 (2 3) elements, each computational basis state corresponds to a quantum bit, such as the |000> state, 000 corresponds to q2q1q0 from high to low, that is, the quantum bits q2q1q0 are all in the |0> state; such as the |001> state, 001 corresponds to q2q1q0 from high to low, that is, the quantum bits q2q1 are all in the |0> state, and the quantum bit q0 is in the |1> state.
[0032] In the field of quantum machine learning, the key to achieving effective processing of classical data by quantum algorithms is to map classical data to quantum states. Amplitude coding, as a widely used coding strategy in quantum information processing, characterizes data through the amplitude properties of quantum states. The advantage of this coding technology is that it can fully utilize the high-dimensional data representation capabilities provided by the quantum superposition principle, enabling quantum systems to efficiently process large-scale data sets. This coding method provides important technical support for quantum machine learning algorithms in processing high-dimensional data, enabling quantum algorithms to effectively utilize their unique quantum properties to enhance data processing capabilities.
[0033] A series of technical solutions have been proposed for amplitude coding. These include top-down amplitude coding technology, which directly uses the superposition characteristics of quantum states to encode data in a precise manner without the need for additional auxiliary quantum bits. In contrast, bottom-up amplitude coding technology requires the introduction of auxiliary quantum bits to achieve data encoding by constructing quantum states in steps. This method provides greater flexibility in processing complex data structures, although it may require more quantum resources. In addition, MPS approximate coding technology, as an approximate method, although it cannot fully guarantee 100% fidelity of data encoding, can provide effective data encoding approximation in certain circumstances. This technology is particularly important when processing high-dimensional data because it can significantly reduce the demand for computing resources while maintaining high fidelity.
[0034] At present, in the field of classical machine learning, the data processed by the algorithm is mainly real vectors; in the field of quantum machine learning, the data mainly processed by quantum algorithms is often complex vectors. Therefore, how to efficiently encode complex vector data into quantum states is an urgent problem that needs to be solved.
[0035] Based on this, an embodiment of the present invention proposes a quantum state amplitude encoding method, which can accurately and efficiently encode complex vector data into a quantum state.
[0036] Figure 1 A schematic flow chart of a quantum state amplitude encoding method according to an embodiment of the present invention is shown, and the method comprises the following steps: S110: normalize the complex vector to be coded to obtain a normalized complex vector to be coded; the normalized complex vector to be coded includes 2n elements, n is a positive integer.
[0037] Specifically, the obtained complex vector to be encoded is normalized to achieve the purpose of encoding the input classical data into the amplitude of the quantum state, and it is determined whether the number of elements of the complex vector to be encoded is N=2. n , if the number of elements does not meet 2 n , it needs to be padded with zeros to make the number of elements reach 2 n , to meet the coding conditions of amplitude coding; where n is a positive integer.
[0038] S120: Calculate the modulus length of each element in the normalized complex vector to be encoded to obtain a modulus length vector.
[0039] Specifically, for an N=2 n The normalized complex vector to be encoded , where normalization means that the modulus length of the complex vector to be encoded is 1, that is, , T represents transpose; specifically, the jth element in the complex vector x to be encoded can be written as ,in and are real numbers, and represent the real and imaginary parts of the jth element respectively, and ; is the jth element in the complex vector to be encoded; for the normalized complex vector to be encoded, the modulus length of each element is calculated, and the modulus length vector , The modulus of each element is ,and .
[0040] S130: constructing a quantum circuit including a parameterized quantum gate according to the modulus vector, calculating the parameters of the parameterized quantum gate using a real vector amplitude coding algorithm, and obtaining a first quantum circuit with fixed parameter values to output a first quantum state after evolution of the first quantum circuit; wherein the modulus vector is mapped to the amplitude of the first quantum state.
[0041] Specifically, it can be seen from the above that each modulus in the modulus vector is a real number, and the modulus vector is a normalized real vector. Therefore, a real vector amplitude coding algorithm can be used to realize the amplitude coding of the quantum state of the modulus vector; a quantum circuit including a parameterized quantum gate is constructed according to the modulus vector, and the quantum circuit may include n quantum bits, and no auxiliary quantum bits are required; the parameterized quantum gate may be, for example, an RX gate, an RY gate, an RZ gate, a dual-qubit CRX gate, a CRY gate and a CRZ gate, and other multi-qubit gates; the parameter carried by the quantum gate is, for example, a rotation angle, and the real vector amplitude coding algorithm is, for example, a variational quantum algorithm, through A quantum circuit including a parametric quantum gate and a quantum-classical hybrid neural network are constructed. The training parameters of the variational quantum circuit in the quantum-classical hybrid neural network are trained and optimized by a classical optimizer until the training parameters or the loss value converge to a set threshold. The training stops and the training parameters are fixed to obtain the target variational quantum circuit. Therefore, the quantum final state after the evolution of the target variational quantum circuit can be output to realize amplitude encoding of the modulus vector. This combines the classical optimization technology and the quantum circuit algorithm, and can accurately map the modulus vector to its corresponding amplitude-coded quantum state, ensuring the integrity and accuracy of the information.
[0042] S140: Calculate the argument of each element in the normalized complex vector to be encoded to obtain an argument vector.
[0043] Specifically, for the complex vector to be encoded, the argument of each element is calculated to obtain the argument vector , in, Represents the complex number x j The angle of .
[0044] S150: construct a second quantum circuit according to the argument vector; wherein the second quantum circuit includes two sequentially connected n An operation unit is provided, and the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state accordingly.
[0045] Specifically, the first quantum state after the first quantum circuit evolves is, for example, 2 n The linear combination of the calculation basis states can be n The calculated ground state and 2 n The operation units are assigned one by one in sequence. For example, n The sequence numbers of the operation units are set to 0, 1, ..., 2 n -2,2 n -1, so with 2 nThe calculation base states can correspond one to one in sequence; and then each argument in the argument vector can be added to the amplitude of the first quantum state one to one in the corresponding sequence by executing the operation unit.
[0046] S160: Execute the first quantum circuit and the second quantum circuit to output a target quantum state; wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; and the first quantum circuit and the second quantum circuit both contain n quantum bits.
[0047] In the embodiment of the present invention, the amplitude coding of the modulus vector can be realized by adopting the real vector amplitude coding algorithm; the first quantum state after the first quantum circuit evolution can include 2 n The calculation basis state can be 2 n The calculated ground state and 2 n The operation units are allocated one by one in sequence, and then each argument in the argument vector can be added to the amplitude of the first quantum state one by one in the corresponding order by executing the operation units in the second quantum circuit; the first quantum circuit and the second quantum circuit are connected in a front-to-back order, and the first quantum circuit and the second quantum circuit are executed to output the target quantum state, thereby realizing N=2 n The technical solution of the present invention can flexibly adapt to a variety of real vector amplitude coding schemes, aiming to solve the problem of 2-dimensional normalized complex vector to be encoded. n The amplitude coding problem of a 1-dimensional normalized complex vector can be solved without relying on auxiliary quantum bits, and the amplitude-coded quantum state corresponding to the normalized complex vector can be accurately output.
[0048] In some embodiments, step S150: constructing a second quantum circuit according to the argument vector may include the following specific steps: S151: Initialize n quantum bits; the n quantum bits are sorted in order from low to high; S152: Divide the initialized n quantum bits into 2 n operating units; S153: 2 n The sequence numbers of the operation units are set to 0, 1, ..., 2 n -2,2 n -1; S154: converting the serial number of each operation unit into an n-bit binary string; wherein the characters in the n-bit binary string correspond one to one with the order of the quantum bits from low to high in order from low to high; S155: allocating each calculation basis state in the first quantum state in sequence according to the sequence number of each operation unit, so that each operation unit has a target basis state corresponding to the n-bit binary string; S156: creating a multi-controlled phase-shift gate in each operation unit, the multi-controlled phase-shift gate being an n-bit quantum gate; wherein the multi-controlled phase-shift gate acts on the quantum bit of the highest bit, and the multi-controlled phase-shift gate has n-1 controlled bits; the order of each argument in the argument vector corresponds to the sequence number of each operation unit one by one; the parameter carried by each multi-controlled phase-shift gate is the corresponding argument in the argument vector; S157: A first operation column and a second operation column are created in each operation unit, and the multi-controlled phase-shift gate is located between the first operation column and the second operation column; the first operation column includes n first quantum gates, and the n quantum gates are correspondingly set on n quantum bits, and the second operation column is set to be the same as the first operation column; wherein the first quantum gate is set to be an X gate or an I gate; the first operation column is used to convert the target ground state of the current operation unit into a full |1> state, and perform an operation on the current multi-controlled phase-shift gate to achieve adding the current argument to the amplitude of the corresponding first quantum state; the second operation column is used to make the calculation ground state in the quantum state output by each operation unit consistent with each calculation ground state in the first quantum state.
[0049] Specifically, the Multiple-Control Phase Shift Gate, also known as the Multi-Control PS Gate, can impose a specific phase change on the target qubit under the condition of multiple control qubits. That is, when all control qubits are in the |1> state, the target qubit can be phase shifted when the Multi-Control PS gate operation is performed; otherwise, the target qubit will remain unchanged. When the first quantum gate is set as an X gate, each X gate in the first operation column is used to convert the target quantum bit where the X gate is located from the |0> state to the |1> state, so that the target ground state of the current operation unit is converted to the full |1> state, and the current multi-controlled phase shift gate is operated to realize the addition of the current angle to the amplitude of the corresponding first quantum state, so as to obtain the quantum state output by the current operation unit; due to the action of the X gate in the first operation column, the calculation ground state in the quantum state output by each operation unit changes relative to each calculation ground state in the first quantum state, so the second operation column is set to be the same as the first operation column, and the X gate in the second operation column performs an operation to convert the target quantum bit where the X gate is located from the |1> state to the |0> state, so that the full |1> state in the quantum state output by the current operation unit is converted to the corresponding target ground state, and the calculation ground state in the quantum state output by other operation units is restored to be consistent with each calculation ground state in the first quantum state. When the first quantum gate is set as an I gate, since the meaning of performing an I gate operation in a quantum circuit is not to perform any operation on the quantum bit, this embodiment does not add any quantum gate symbol in the quantum circuit.
[0050] In some embodiments, step S157: creating a first operation column and a second operation column in each operation unit may include the following specific steps: S1571: Perform a unitary operation on the n-bit binary string to convert the target base state corresponding to the current operation unit into a full |1> state; wherein, S15711: Determine whether the current character in the n-bit binary string corresponding to the current operation unit is equal to "0"; if the current character is equal to "0", set the first quantum gate on the target quantum bit corresponding to the current character to the X gate; if the current character is not equal to "0", set the first quantum gate on the target quantum bit corresponding to the current character to the I gate; S15712: traverse all characters in the n-bit binary string in sequence, so that the target ground state corresponding to the current operation unit is converted into a full|1> state, so as to complete the creation of the first operation column before the multi-controlled phase shift gate; S1572: Create a second operation column after the multi-controlled phase-shift gate.
[0051] Specifically, it is determined whether the current character in the n-bit binary string corresponding to the current operation unit is equal to "0"; if the current character is equal to "0", an X-gate operation is performed on the target quantum bit corresponding to the current character, and accordingly, an X-gate can be first created on the target quantum bit in the first operation column; performing the X-gate operation can transform the target quantum bit from the |0> state to the |1> state; if the current character is not equal to "0" but equal to "1", an I-gate can be created on the target quantum bit in the first operation column, which is equivalent to not performing any operation on the target quantum bit corresponding to the current character; by traversing all the characters in the n-bit binary string from low to high, the target ground state corresponding to the current operation unit can be transformed into the full |1> state, thereby completing the creation of the first operation column before the multi-controlled phase shift gate; Figure 5 As shown, the I gate is not shown in the first operation column and the second operation column, and the X gate created in the second operation column in each operation unit is the same as the X gate created in the first operation column.
[0052] In some embodiments, step S150: constructing the second quantum circuit according to the argument vector, further comprises the following specific steps: S158: Traverse in sequence according to the sequence number of each operation unit to complete the creation of a multi-controlled phase-shift gate, a first operation column and a second operation column in each operation unit, so as to add each argument in the argument vector to the amplitude of the first quantum state accordingly.
[0053] Specifically, 2 n The sequence numbers of the operation units are set to 0, 1, ..., 2 n -2,2 n -1; each argument in the argument vector is set accordingly , by setting the subscript data of each radial angle to be consistent with the serial number of each operation unit, the serial number of each operation unit is converted into an n-bit binary string; after the various calculation base states in the first quantum state are allocated in sequence according to the serial number of each operation unit, each operation unit has a target ground state corresponding to the n-bit binary string, and the target ground state corresponds to the quantum bit. For example, when the serial number of the operation unit is "0", its target ground state is |000> state, 000 corresponds to q2q1q0 from high to low, that is, the quantum bit q2q1q0 is in the |0> state; when the serial number of the operation unit is "1", its target ground state is |001> state, 001 corresponds to q2q1q0 from high to low, that is, the quantum bit q2q1 is in the |0> state, and the quantum bit q0 is in the |1> state, so each radial angle can be accurately added to the amplitude of the first quantum state accordingly.
[0054] Taking a two-qubit system as an example, the implementation process of adding each argument to the amplitude of the first quantum state is explained below.
[0055] The two quantum bits are recorded as q1 and q0 from high to low. The first quantum state that can be evolved after executing the first quantum circuit is expressed as follows:
[0056] The binary character corresponding to the operation unit with serial number 0 is
[00] , so X gates need to be created on both quantum bits q1 and q0. By executing X gates on both quantum bits q1 and q0, the quantum states corresponding to each operation unit can be obtained as follows:
[0057] Comparing the quantum state before executing the X gate, it can be seen that the overall quantum state of the quantum system has not changed.
[0058] Then execute C on the two qubits ^ {1}PS(β0) gate operation, adding the first argument β0 to the first quantum state On, you get , that is, the quantum state of the current quantum system is expressed as:
[0059] Then, the X-gate operation is performed on the two quantum bits, and the quantum state of the quantum system is expressed as:
[0060] Thereby, the first argument β0 is encoded into the amplitude of the first quantum state.
[0061] The binary character corresponding to the operation unit with serial number 1 is
[01] , so it is only necessary to create an X gate on the second quantum bit q1, and execute the X gate on the second quantum bit q1 to obtain the quantum state of the current quantum system as:
[0062] Comparing the quantum state before executing the X gate, it can be seen that the overall quantum state of the quantum system has not changed.
[0063] Then execute C on the two qubits ^ {1}PS(β1) gate operation, adding the second angle β1 to the second quantum state On, you get , that is, the quantum state of the current quantum system is expressed as:
[0064] Then, the X-gate operation is performed on the second quantum bit q1, and the quantum state of the obtained quantum system is expressed as:
[0065] Thereby, the second angle β1 is encoded into the second quantum state, and it can be seen that the computational basis state of the quantum state corresponding to each operation unit is restored to the computational basis state of the original first quantum state.
[0066] By analogy, the target quantum state data obtained after encoding is expressed as:
[0067] The binary character corresponding to the last operation unit with serial number 3 is
[11] , that is, I gates are created on both qubits, which is equivalent to performing no operation on the two qubits and executing C on the two qubits. ^ {1}PS(β1) gate operation, adding the fourth argument β3 to the fourth quantum state superior.
[0068] In some embodiments, step S150: constructing the second quantum circuit according to the argument vector, further comprises the following specific steps: S159: The execution order of each operation unit in the second quantum circuit is set to be arbitrary; S1591: Adjust the execution order of each operation unit in the second quantum circuit so that two adjacent X gates on the same quantum bit cancel each other out, thereby obtaining an optimized second quantum circuit with the least quantum gates.
[0069] Specifically, Figure 5As shown, each operation unit includes a first operation column, a multi-controlled phase shift gate, and a second operation column, which can be arranged in sequence from front to back and perform quantum operations. The "front" and "back" mentioned here refer to the "front" and "back" in the sense of time, corresponding to Figure 5 , that is, the left is the front and the right is the back, in the order from front to back, that is, in the order from left to right. When two X-gate operations are performed on a quantum bit in succession, it is equivalent to not performing any operation on the quantum bit, that is, the state after two consecutive X-gate operations is the same as the state before the operation. Therefore, after eliminating the two adjacent X-gates, the quantum state is not changed, and the quantum operations are reduced, so that the number of quantum gates in the quantum circuit is reduced, which can simplify the quantum circuit structure. Each operation unit can perform operations in the order from front to back. In order to eliminate more adjacent X-gates on the same quantum bit, the front and back execution order of each operation unit in the second quantum circuit can be adjusted, and it can not be in the preset order of 0, 1, ..., 2 n -2,2 n -1 execution, after adjusting the order, the two adjacent X gates on the same quantum bit are eliminated, such as Figure 6 As shown, the optimized second quantum circuit with the least quantum gates is obtained. Similarly, the two adjacent X gates on the same quantum bit in the first quantum circuit can also be eliminated.
[0070] In some embodiments, step S160: executing the first quantum circuit and the second quantum circuit to output a target quantum state includes the following specific steps: S161: connecting the first quantum circuit and the optimized second quantum circuit in a front-to-back order to obtain a combined quantum circuit; S162: Execute the combined quantum circuit to output the target quantum state.
[0071] In an exemplary embodiment, the parameter-containing quantum gates in the first quantum circuit include one or more of the following: an RX gate, an RY gate, an RZ gate; a multi-qubit RX gate, a multi-qubit RY gate, and a multi-qubit RZ gate.
[0072] The implementation methods and advantages of the embodiments of the present invention are described above through multiple embodiments. The specific processing process of the embodiments of the present invention is described in detail below with reference to specific examples.
[0073] Step S1: Get an N=2 n The normalized complex vector to be encoded , where normalization means that the modulus length of the complex vector to be encoded is 1, that is, , T represents transpose; specifically, the jth element in the complex vector x to be encoded can be written as ,in and are real numbers, and represent the real and imaginary parts of the jth element respectively, and If the dimension of the complex vector x to be encoded is not equal to 2 n , you can add appropriate 0 to make its dimension equal to 2 n If the complex vector to be encoded does not satisfy the normalization condition, a normalization operation, such as extracting a common factor, can be performed to make it satisfy the normalization condition.
[0074] For example, if N=16=2 after normalization 4 The dimensional complex vector x to be encoded is as follows: [1.42285003e-01+0.14238149i 2.45769699e-01+0.19062108i 3.90238908e-05+0.04789905i 1.03153767e-01+0.06759085i 5.00720875e-02+0.27320847i3.15052852e-02+0.3303641i 6.35506865e-02+0.10693815i 1.17902913e-01+0.23621565i 1.35374298e-01+0.29901787i 1.83840516e-01+0.30523356i1.43026248e-01+0.02901649i 2.33792120e-01+0.01332522i 6.97576832e-02+0.05794496i 2.99607552e-01+0.2996161i 9.34445599e-03+0.03355525i 2.28758843e-01+0.14367899i].
[0075] According to the above complex vector x to be encoded, it can be known that n=4, and the modulus length of the complex vector x to be encoded is 1.
[0076] Step S2: For the complex vector x to be encoded, calculate the modulus length of each element and obtain the modulus length vector , in, ,and .
[0077] For example, by calculating the modulus of each element of the complex vector x to be encoded, the corresponding modulus vector γ can be obtained as follows: [0.20128962 0.31102916 0.04789906 0.12332568 0.27775903 0.331862960.12439637 0.26400555 0.3282345 0.35632129 0.14593993 0.23417155 0.090684910.42371511 0.03483208 0.27013748].
[0078] Step S3: For the complex vector x to be encoded, calculate the argument of each element and obtain the argument vector , in, Represents the complex number x j The angle of .
[0079] For example, by calculating the modulus length of each element of the complex vector x to be encoded, the corresponding argument vector β can be obtained as follows: [0.78573712 0.65969015 1.56998162 0.58005259 1.38953368 1.475718521.03459688 1.10784295 1.14567463 1.02869135 0.20015873 0.05693442 0.693158820.78541244 1.29919799 0.5608115 ].
[0080] Step S4: According to the modulus vector γ, a top-down amplitude coded quantum circuit can be constructed, such as Figure 2 As shown; according to each modulus vector element , the angle tree algorithm is used to calculate each parameter required by the RY gate in the above Top-down amplitude coding circuit ,in , a total of 2 n -1 RY gate to carry parameters.
[0081] For example, for the above N=2 4 The complete Top-down amplitude coding circuit of the corresponding modulus vector is generated by the complex vector x to be encoded, such as Figure 3 As shown in the figure, the four quantum bits arranged from low to high can be recorded as q0, q1, q2, q3, and the parameters carried by each Ry gate can be recorded as: theta0, theta1, ... theta13, theta14. For example, in Figure 2 The control bit of CRy(θ1) in is qn-1 , it is a hollow dot at this time. The hollow dot indicates that the control bit is in the |0> state. It is necessary to add an X gate on the left and right of the hollow dot to turn the hollow dot into a solid dot. The X gate added on the left is used to convert the control bit to the |1> state, and the X gate added on the right is used to roll back (or convert) the control bit to its initial state. Figure 2 The control bit of C^Ry(θ2) in is q n-1 , but the control bit is a solid dot at this time. The solid dot indicates that the control bit is in the |1> state, so there is no need to add an X gate. Figure 2 The control bit of C^2Ry(θ3) in is q n-2 and q n-1 , but at this time the control bits are all hollow points, so it is necessary to add an X gate on the left and right of the hollow point; and so on, add an X gate on the left and right of all the control bits that are hollow points, and you can get Figure 3 The complete Top-down amplitude coding circuit shown in FIG. 1 cancels two adjacent X gates on the same quantum bit to reduce the number of quantum gates, and an optimized Top-down amplitude coding circuit can be obtained. For example, the modulus vector γ in step S2 above is calculated and each parameter required for the corresponding RY gate is obtained as follows:
[0082] Therefore, we can get Figure 4 Shown is the first quantum circuit with fixed parameters and after optimization.
[0083] Step S5: Execution Figure 4 The quantum circuit can obtain the quantum state that realizes amplitude encoding of the modulus length vector γ .
[0084] Step S6: A second quantum circuit may be constructed according to the argument vector β, which may include the following specific steps: Step S6-1: Initialize n quantum bits; the n quantum bits are sorted in order from low to high; for example, four quantum bits are constructed for the argument vector β in the above step S3, and they are sorted in order from low to high as q0, q1, q2, and q3; Step S6-2: Divide the initialized n quantum bits into 2 n operating units; Step S6-3: 2 n The sequence numbers p of the operation units are set to 0, 1, ..., 2 in sequence. n -2,2 n -1; For example, the above 4 quantum bits are divided into 16 operation units, and the serial number p of each operation unit is set to 0, 1, ..., 14, 15 in sequence; Step S6-4: convert the serial number p of each operation unit into an n-bit binary string, which can be recorded as
[0000] ,
[0001] , ...,
[1110] ,
[1111] in sequence; it can be seen that it is consistent with each calculation basis state of the first quantum state assigned to each operation unit; Step S6-5: Create a multi-control PS gate in each operation unit, which can be recorded as C^{n-1}PS(β j ) gate, the multi-controlled phase-shift gate is a 4-bit quantum gate, which can be recorded as C^{3}PS(β j ) gate; β j is the jth element in the argument vector; Step S6-6: Let p = 0, that is, starting from the first operation unit on the left, the corresponding n-bit binary string is
[0000] , and traverse the n-bit binary string from low to high. If the current character m k If is "0", then the X gate is executed on the k-th qubit, otherwise the I gate is executed; thus, it can be seen that X gates need to be created on the four qubits in the first operation unit to obtain the first operation column, which is located on the left side of the multi-controlled PS gate; Step S6-7: Execute the left row C^{n-1}PS(β j ) Door operation; Step S6-8: creating a second operation column on the right side of the multi-control PS gate, and setting the second operation column to be the same as the first operation column; Step S6-9: Let p=1, that is, starting from the second operation unit on the left, repeat the above steps S6-6, S6-7 and S6-8; for example, the n-bit binary string corresponding to the second operation unit is
[0001] , and the n-bit binary string is traversed from low to high. If the first character m0 is "1", then the I gate is executed on the quantum bit q0, and the remaining quantum bits q1, q2, and q3 are all executed with the X gate; it can be seen that the X gate needs to be created on the quantum bits q1, q2, and q3 in the second operation unit, and the I gate is created on the quantum bit q0 (the I gate is not shown in the figure); traverse p in sequence until p=2 n -1 to complete the creation of each operation unit, and you can get the following Figure 5 The second quantum circuit shown; it is worth noting that Figure 5 The dotted lines in the figure do not belong to the structure of the variational quantum circuit in the embodiment of the present invention and are only used to distinguish each operation unit.
[0085] Step S6-10: If Figure 5 Further optimization can cancel out two adjacent X-gate operations on the same quantum bit, and the resulting quantum circuit is as follows: Figure 6 shown.
[0086] For example, the complete second quantum circuit constructed for the argument vector β in step S3 is as follows Figure 7 As shown, the second quantum circuit includes 16 operation units, and the 4 quantum bits are arranged from low to high as q0, q1, q2, and q3; C^{3}PS(β j ) gate, each C^{3}PS(β j ) The parameters carried by the gate are set to beta0, beta1, ..., beta14, beta15 in sequence; the parameter values are as follows:
[0087] Step S7: Figure 7 The complete second quantum circuit shown is further optimized, that is, the adjacent X gates on the same quantum bit are offset, and an optimized second quantum circuit can be obtained.
[0088] Step S8: Figure 4 The optimized first quantum circuit shown is connected with the optimized second quantum circuit to obtain a combined quantum circuit, such as Figure 8 As shown. After optimization, the number of quantum gates required to execute the combined quantum circuit is reduced from 129 to 83; the reduction in the number of quantum gates can improve the amplitude coding efficiency of complex vectors. It is worth noting that Figure 7 The thick solid line in does not belong to the structure of the variational quantum circuit in the embodiment of the present invention, and is only used to distinguish each operating unit.
[0089] Step S9: Execution Figure 8 The combined quantum circuit shown can obtain the target quantum state As shown below: (0.14228500264993257+0.14238149124285226i)¦0000> (0.24576969872687432+0.19062107712419107i)¦0001> (3.9023890839065115e-05+0.04789904538559103i)¦0010> (0.1031537674582972+0.06759084792060513i)¦0011> (0.0500720875117822+0.2732084681171133i)¦0100> (0.03150528522047643+0.33036410384464304i)¦0101>(0.06355068646401656+0.10693814599003476i)¦0110> (0.11790291257675982+0.2362156531173297i)¦0111> (0.1353742979644006+0.2990178730394566i)¦1000>(0.18384051575449734+0.3052335609438082i)¦1001> (0.14302624782414+0.029016492424040162i)¦1010> (0.23379211967309557+0.01332521994791732i)¦1011>(0.06975768320806329+0.05794495596225954i)¦1100> (0.29960755153183993+0.2996161042307253i)¦1101> (0.0093444559922479+0.033555254530341194i)¦1110>(0.22875884338637364+0.14367898783299107i)¦1111> It can be seen that the output target quantum state The amplitude of is one-to-one corresponding to the element of the normalized complex vector x to be encoded, and the target quantum state The amplitude of is consistent or nearly consistent with the complex vector x to be encoded, which means that complex vector amplitude encoding with a fidelity of up to 100% is achieved.
[0090] In summary, the technical solution of the present invention has the following advantages: 1. The technical solution of the present invention can efficiently realize amplitude coding of complex vectors with 100% fidelity, and can process any normalized complex vector, significantly expanding the application scope of amplitude coding. This wide applicability makes the technical solution more advantageous in quantum machine learning tasks and can play a more effective role, bringing important progress to the field of quantum computing.
[0091] 2. The technical solution of the present invention has achieved remarkable results through simulation experiments carried out in MindSpore Quantum quantum computing software; experimental data clearly show that the technical solution successfully realizes the amplitude encoding of normalized complex vectors and accurately obtains the corresponding encoded quantum states; what is particularly striking is that the fidelity of the process reaches 100%. This achievement not only verifies the efficiency and accuracy of the technical solution in the field of amplitude coding, but also provides strong evidence for its reliability in quantum computing applications.
[0092] 3. In the technical solution of the present invention, a series of different real vector amplitude coding schemes can be adapted for the modulus vector to meet the specific requirements of a specific application scenario; in addition, for the processing of the argument vector, each operation unit can be allowed to execute in any order, further enhancing the adaptability and flexibility of the quantum algorithm; this design not only improves the versatility of the quantum algorithm, but also provides solid technical support for the diversified applications of quantum computing.
[0093] Corresponding to the method embodiment of the present invention, the embodiment of the present invention also provides a quantum state amplitude encoding device, such as Fig. 9 As shown, specifically, it may include: The normalization module 510 is used to perform normalization processing on the complex vector to be encoded to obtain a normalized complex vector to be encoded; the normalized complex vector to be encoded includes 2 n elements, n is a positive integer; A modulus vector module 520, which is used to calculate the modulus of each element in the normalized complex vector to be encoded to obtain a modulus vector; A first construction module 530 is used to construct a quantum circuit including a parameterized quantum gate according to the modulus vector, and calculate the parameters of the parameterized quantum gate using a real vector amplitude coding algorithm to obtain a first quantum circuit with fixed parameter values, so as to output a first quantum state after the first quantum circuit evolves; wherein the modulus vector is mapped to the amplitude of the first quantum state; An argument vector module 540, which is used to calculate the argument of each element in the normalized complex vector to be encoded to obtain an argument vector; The second construction module 550 is used to construct a second quantum circuit according to the argument vector; wherein the second quantum circuit includes two sequentially connected nAn operation unit, the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state accordingly; An output module 560, which is used to execute the first quantum circuit and the second quantum circuit to output a target quantum state; wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; The first quantum circuit and the second quantum circuit both include n quantum bits.
[0094] In another aspect, the present invention further provides an electronic device, see Fig.10 , Fig.10 1 is a block diagram of the structure principle of an electronic device according to an embodiment of the present invention. Fig.10 As shown, the electronic device includes a processor 601 and a memory 602 storing computer program instructions; when the processor 601 executes the computer program instructions, the quantum state amplitude encoding method in the above-mentioned embodiment is implemented.
[0095] Specifically, the processor 601 may include a central processing unit (CPU) or a graphics processing unit (GPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of an embodiment of the present invention. The memory 602 may include a memory for data or instructions. For example, the memory 602 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, a universal serial bus (USB) drive, or other physical / tangible memory storage device. For another example, the memory 602 includes a removable or non-removable (or fixed) medium. For another example, the memory 602 may be inside or outside the integrated gateway disaster recovery device. The memory 602 may be a non-volatile solid-state memory. In other words, typically the memory 602 includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with executable instructions, wherein when the stored executable instructions are executed by the processor 601 (such as executed by one or more processors), the quantum state amplitude encoding method in the embodiment of the present invention can be implemented.
[0096] In one example, Fig.10 The electronic device shown may also include a communication interface 603 and a bus 610. The processor 601, the memory 602, and the communication interface 603 are connected and communicate with each other via the bus 610. The communication interface 603 is mainly used to implement communication between modules, devices, units, and / or devices in the electronic device.
[0097] The bus 610 includes hardware, software or both, and can couple the components of the online data traffic billing device to each other. For example, the bus may include at least one of the following: an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus. The bus 610 may include one or more buses. Although the embodiments of the present invention describe or show a specific bus, the embodiments of the present invention may consider any suitable bus or interconnection method.
[0098] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the aforementioned quantum state amplitude encoding method is implemented.
[0099] The flowchart and / or block diagram of the method and system of the embodiment of the present invention are described above by way of example, and various aspects of the related aspects are described. It should be understood that each box or combination thereof in the flowchart and / or block diagram can be implemented by computer program instructions, or by dedicated hardware that performs specified functions or actions, or by a combination of dedicated hardware and computer instructions. For example, these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box or combination thereof in the flowchart and / or block diagram. Such a processor can be a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit.
[0100] The functional blocks shown in the structural block diagram of the embodiment of the present invention can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0101] It should be noted that the present invention is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific implementation mode of the present invention. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be covered within the protection scope of the present invention.
Claims
1. A quantum state amplitude encoding method, characterized in that: include: The complex vector to be coded is normalized to obtain a normalized complex vector to be coded. The normalized complex vector to be coded includes 2 n elements, n is a positive integer; Calculate the modulus length of each element in the normalized complex vector to be encoded to obtain a modulus length vector; A quantum circuit including a parameterized quantum gate is constructed according to the modulus vector, and a parameter of the parameterized quantum gate is calculated using a real vector amplitude coding algorithm to obtain a first quantum circuit with a fixed parameter value, so as to output a first quantum state after evolution of the first quantum circuit, wherein the modulus vector is mapped to the amplitude of the first quantum state; Calculate the argument of each element in the normalized complex vector to be encoded to obtain an argument vector; The second quantum circuit is constructed according to the argument vector, wherein the second quantum circuit includes 2 n An operation unit, the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state accordingly; executing the first quantum circuit and the second quantum circuit to output a target quantum state, wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; The first quantum circuit and the second quantum circuit both include n quantum bits.
2. The method according to claim 1, characterized in that The step of constructing a second quantum circuit according to the argument vector comprises: Initialize n quantum bits; sort the n quantum bits from low to high; Divide the initialized n qubits into 2 n operating units; 2 n The operation units are numbered 0, 1, ..., 2. n -2,2 n -1 in order; Convert the sequence number of each operation unit into an n-bit binary string, where the characters in the n-bit binary string correspond one-to-one to the order of the quantum bits from low to high in order from low to high; Allocating each computational basis state in the first quantum state in sequence according to the sequence number of each operation unit so that each operation unit has a target basis state corresponding to the n-bit binary string; A multi-controlled phase-shift gate is created in each operation unit, wherein the multi-controlled phase-shift gate is an n-bit quantum gate, the multi-controlled phase-shift gate acts on the quantum bit of the highest bit, and the multi-controlled phase-shift gate has n-1 controlled bits, the order of each argument in the argument vector corresponds to the serial number of each operation unit, and the parameter carried by each multi-controlled phase-shift gate is the corresponding argument in the argument vector; A first operation column and a second operation column are created in each operation unit, wherein a multi-controlled phase-shift gate is located between the first operation column and the second operation column, the first operation column includes n first quantum gates, and the n quantum gates are correspondingly arranged on n quantum bits, the second operation column is set to be the same as the first operation column, and the first quantum gate is set to be an X gate or an I gate, the first operation column is used to convert the target ground state of the current operation unit into a full|1> state, and perform an operation on the current multi-controlled phase-shift gate to achieve adding the current argument to the amplitude of the corresponding first quantum state, and the second operation column is used to make the calculation ground state in the quantum state output by each operation unit consistent with each calculation ground state in the first quantum state.
3. The method according to claim 2, characterized in that The step of creating a first operation column and a second operation column in each operation unit includes: The n-bit binary string performs a unitary operation to convert the target base state corresponding to the current operation unit into a full |1> state; where Determine whether the current character in the n-bit binary string corresponding to the current operation unit is equal to "0". If the current character is equal to "0", set the first quantum gate on the target quantum bit corresponding to the current character to the X gate. If the current character is not equal to "0", set the first quantum gate to the I gate. All characters in the n-bit binary string are traversed in sequence, so that the target ground state corresponding to the current operation unit is converted into the full|1> state, so as to complete the creation of the first operation column before the multi-controlled phase shift gate; A second operating column is created after the multi-controlled phase-shift gates.
4. The method according to claim 3, characterized in that: The constructing of the second quantum circuit according to the argument vector also includes: Each operation unit is traversed in sequence according to its sequence number to complete the creation of a multi-controlled phase-shift gate, a first operation column and a second operation column in each operation unit, thereby adding each argument in the argument vector to the amplitude of the first quantum state accordingly.
5. The method according to claim 4, characterized in that The constructing of the second quantum circuit according to the argument vector also includes: Arbitrarily arrange the execution order of each operation unit in the second quantum circuit; The execution order of each operation unit in the second quantum circuit is adjusted so that two adjacent X gates on the same quantum bit are offset, thereby obtaining an optimized second quantum circuit with the least quantum gates.
6. The method according to claim 5, characterized in that Executing the first quantum circuit and the second quantum circuit to output a target quantum state includes: Connecting the first quantum circuit and the optimized second quantum circuit in a front-to-back order to obtain a combined quantum circuit; Execute the combined quantum circuit to output the target quantum state.
7. The method according to claim 1, characterized in that The parameter-containing quantum gates in the first quantum circuit include one or more of the following: an RX gate, an RY gate, an RZ gate, a multi-qubit RX gate, a multi-qubit RY gate, and a multi-qubit RZ gate.
8. A quantum state amplitude encoding device, characterized in that: include: A normalization module is used to normalize the complex vector to be encoded to obtain a normalized complex vector to be encoded. The normalized complex vector to be encoded includes 2 n elements, n is a positive integer; A modulus vector module, which is used to calculate the modulus of each element in the normalized complex vector to be encoded to obtain a modulus vector; A first construction module is used to construct a quantum circuit including a parameterized quantum gate according to the modulus vector, and calculate the parameters of the parameterized quantum gate using a real vector amplitude coding algorithm to obtain a first quantum circuit with a fixed parameter value, so as to output a first quantum state evolved by the first quantum circuit, wherein the modulus vector is mapped to the amplitude of the first quantum state; An argument vector module, which is used to calculate the argument of each element in the normalized complex vector to be encoded to obtain an argument vector; The second building module is used to build a second quantum circuit according to the argument vector, wherein the second quantum circuit includes two sequentially connected n An operation unit, the operation unit is used to add each argument in the argument vector to the amplitude of the first quantum state accordingly; An output module, which is used to execute the first quantum circuit and the second quantum circuit to output a target quantum state, wherein the normalized complex vector to be encoded is mapped to the amplitude of the target quantum state; The first quantum circuit and the second quantum circuit both include n quantum bits.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the electronic device executes the computer program instructions, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for encoding complex vector to quantum circuit
CN112633507A
Quantum circuit generation method and device, storage medium and electronic device
CN112633508A
Method, device and equipment for quantum phase coding and storage medium
CN118036764A
Method for optimizing quantum neural network and improving amplitude coding
CN118364925A
Amplitude coding quantum circuit construction method and related device
CN119250211A