Abstract
The Poisson equation has applications across many areas of physics and engineering, such as the dynamic process simulation of ocean current. Here we present a quantum algorithm for solving Poisson equation, as well as a complete and modular circuit design. The algorithm takes the HHL algorithm as the framework (where HHL is for solving linear equations). A more efficient way of implementing the controlled rotation, one of the crucial steps in HHL, is developed based on the arc cotangent function. The key point is that the inverse trigonometric function can be evaluated in a very simple recursive way by a binary expansion method. Quantum algorithms for solving square root and reciprocal functions are proposed based on the classical non-restoring method. These advances not only reduce the algorithm’s complexity, but more importantly make the circuit more complete and practical. We demonstrate our circuits on a quantum virtual computing system installed on the Sunway TaihuLight supercomputer. This is an important step toward practical applications of the present circuits as a fast Poisson solver in the near-term hybrid classical/quantum devices.
Similar content being viewed by others
References
Cleve, R., Ekert, A., Macchiavello, C., Mosca, M.: Quantum algorithms revisited. Proc. R. Soc. Lond. A 454, 339–354 (1998)
Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information, Chaps. 1–6. Cambridge University Press, Cambridge (2010)
Shor, P.W.: Algorithms for quantum computation: discrete logarithms and factoring. In: Proceedings 35th Annual Symposium on Foundations of Computer Science, pp. 124–134 (1994)
Grover, L.: Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett. 79, 325–328 (1997)
Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103, 150502 (2009)
Biamonte, J., Wittek, P., Pancotti, N., Rebentrost, P., Wiebe, N., Lloyd, S.: Quantum machine learning. Nature 549, 195–202 (2017)
Leyton, S.K., Osborne, T.J.: A quantum algorithm to solve nonlinear differential equations (2008). arXiv:0812.4423
Berry, W.: High-order quantum algorithm for solving linear differential equations. J. Phys. A Math. Theor. 47, 105301 (2014)
Berry, W., Childs, A.M., Ostrander, A., Wang, G.: Quantum algorithm for linear differential equations with exponentially improved dependence on precision. Commun. Math. Phys. 356, 1057–1081 (2017)
Arrazola, J.M., Kalajdzievski, T., Weedbrook, C., Lloyd, S.: Quantum algorithm for non-homogeneous linear partial differential equations. Phys. Rev. A 100, 032306 (2019)
Cao, Y., Papageorgiou, A., Petras, I., Traub, J., Kais, S.: Quantum algorithm and circuit design solving the Poisson equation. New J. Phys. 15, 013021 (2013)
White, F.M.: Fluid Mechanics, Chap. 4, 8th edn. McGraw-Hill Education, New York (2016)
Lukaszewicz, G., Kalita, P.: Navier–Stokes Equations: An Introduction with Applications, Chap. 2. Springer, Switzerland (2016)
Kosior, A., Kudela, H.: Parallel computations on GPU in 3D using the vortex particle method. Comput. Fluids 80, 423–428 (2013)
Steijl, R., Barakos, G.N.: Parallel evaluation of quantum algorithms for computational fluid dynamics. Comput. Fluids 173, 22–28 (2018)
Hockney, R.W.: A fast direct solution of Poisson’s equation using Fourier analysis. J. Assoc. Comput. Mach. 12, 95–113 (1965)
Buzbee, B.L., Golub, G.H., Nielson, C.W.: On direct methods for solving Poisson’s equations. SIAM J. Numer. Anal. 7, 627–656 (1970)
Swarztrauber, P.N.: The methods of cyclic reduction, Fourier analysis and the FACR algorithm for the discrete solution of Poisson’s equation on a rectangle. SIAM Rev. 19, 490–501 (1977)
Ritter, K., Wasilkowski, G.W.: On the average case complexity of solving Poisson equations. Lect. Appl. Math. 32, 677–688 (1996)
Childs, A.M., Liu, J.-P.: Quantum spectral methods for differential equations (2019). arXiv:1901.00961
Childs, A.M., Kothari, R., Somma, R.D.: Quantum algorithm for systems of linear equations with exponentially improved dependence on precision. SIAM J. Comput. 46, 1920–1950 (2017)
Borwein, J.M., Girgensohn, R.: Addition theorems and binary expansions. Can. J. Math. 47, 262–273 (1995)
Freiman, C.V.: Statistical analysis of certain binary division algorithms. Proc. IRE 49, 91–103 (1961)
Sutikno, T.: An efficient implementation of the non restoring square root algorithm in gate level. Int. J. Comput. Theory Eng. 3, 46 (2011)
Burks, A.W., Goldstine, H.H., von Neumann, J.: Preliminary discussion of the logical design of an electronic computing instrument. Princeton, Institute for Advanced Study (1947)
Demmel, J.W.: Applied Numerical Linear Algebra, Chap. 6. SIAM, Philadelphia (1997)
Aaronson, S.: Read the fine print. Nat. Phys. 11, 291–293 (2015)
Biham, O., Biron, D., Grassl, M., Lidar, D.A.: Grover’s quantum search algorithm for an arbitrary initial amplitude distribution. Phys. Rev. A 60, 2742 (1999)
Grover, L.K.: Synthesis of quantum superpositions by quantum computation. Phys. Rev. Lett. 85, 1334 (2000)
Grover, L., Rudolph, T.: Creating superpositions that correspond to efficiently integrable probability distributions (2002). arXiv:quant-ph/0208112
Soklakov, A.N., Schack, R.: Efficient state preparation for a register of quantum bits. Phys. Rev. A 73, 012307 (2006)
Luis, A., Peřina, J.: Optimum phase-shift estimation and the quantum description of the phase difference. Phys. Rev. A 54, 4564 (1996)
Weinstein, Y.S., Pravia, M.A., Fortunato, E.M., Lloyd, S., Cory, D.G.: Implementation of the quantum Fourier transform. Phys. Rev. Lett. 86, 1889 (2001)
Lloyd, S.: Universal quantum simulators. Science 273, 1073–1078 (1996)
Berry, D.W., Ahokas, G., Cleve, R., Sanders, B.C.: Efficient quantum algorithms for simulating sparse Hamiltonians. Commun. Math. Phys. 270, 359–371 (2007)
Wickerhauser, M.V.: Adapted Wavelet Analysis: From Theory to Software, Chap. 3. Peters A.K./CRC Press, Wellesley (1994)
Klappenecker, A., Rotteler, M.: Discrete cosine transforms on quantum computers (2001). arXiv:quant-ph/0111038
Barenco, A., Bennett, C.H., Cleve, R., DiVincenzo, D.P., Margolus, N., Shor, P., Sleator, T., Smolin, J.A., Weinfurter, H.: Elementary gates for quantum computation. Phys. Rev. A 52, 3457 (1995)
Vedral, V., Barenco, A., Ekert, A.: Quantum networks for elementary arithmetic operations. Phys. Rev. A 54, 147 (1996)
Bhaskar, M.K., Hadfield, S., Papageorgiou, A., Petras, I.: Quantum algorithms and circuits for scientific computing. Quantum Inf. Comput. 16, 197–236 (2016)
Brassard, G., Hoyer, P., Mosca, M., Tapp, A.: Quantum amplitude amplification and estimation. Contemp. Math. 305, 53–74 (2002)
Zhao-Yun, Chen, Qi, Zhou, Cheng, Xue, Xia, Yang, Guang-Can, Guo, Guo-Ping, Guo: 64-qubit quantum circuit simulation. Sci. Bull. 63, 964–971 (2018)
The web address for accessing our QRunes codes
User manual of QRunes. https://github.com/OriginQ/QPanda/tree/master/QRunes
Mitarai, K., Kitagawa, M., Fujii, K.: Quantum analog-digital conversion. Phys. Rev. A 99, 012301 (2019)
Häner, T., Roetteler, M., Svore, K.M: Optimizing quantum circuits for arithmetic (2018). arXiv:1805.12445
Pan, V.Y., Ivolgin, D., Murphy, B., Rosholt, R.E., Tang, Y., Yan, X.: Additive preconditioning for matrix computations. Linear Algebra Appl. 432, 1070–1089 (2010)
Acknowledgements
We are very grateful to the National Supercomputing Center in Wuxi for the great computing resource. We would also like to thank the technical team from the Origin Quantum Computing Technology Co., Ltd, in Hefei for the professional services on quantum virtual computation. The present work is financially supported by the National Natural Science Foundation of China (Grant Nos. 61575180, 61701464, 11475160) and the Pilot National Laboratory for Marine Science and Technology (Qingdao).
Author information
Authors and Affiliations
Corresponding authors
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Electronic supplementary material
Below is the link to the electronic supplementary material.
Appendices
Appendix 1
We take the maximum eigenvalue as the norm of the discretized matrix A. The norm of matrix A is \( \lambda_{\hbox{max} } = 4N^{2} \sin^{2} \frac{(N - 1)\pi }{2N} \) as shown in Sect. 2 and that of matrix A−1 is \( \lambda^{\prime}_{\hbox{max} } = (4N^{2} \sin^{2} \frac{\pi }{2N})^{ - 1} \). So the condition number of matrix A, or the ratio between A’s largest and smallest eigenvalues [5], can be obtained as follows:
The relationship between κ and N is apparently nonlinear. Assuming \( x = {\pi \mathord{\left/ {\vphantom {\pi {2N}}} \right. \kern-0pt} {2N}} < 1 \), the squared cotangent function satisfies the following equalities,
where Taylor expansions of \( {\text{e}}^{ix} \) and \( {\text{e}}^{ - ix} \) are used. The condition number of matrix A is \( \kappa = O(N^{2} ) \). In addition, we have the relationship between N and the basic error of the solutions caused by the central-difference approximation, namely \( N = \varepsilon^{ - \alpha } \). The α is a smoothness parameter depending on the smoothness of the solution function. (For example, when the solution function has uniformly bounded partial derivatives up to order four, α is 1/2 [26].) Therefore, the condition number of matrix A can be further expressed as \( \kappa = O(N^{2} ) = O(\varepsilon^{ - 2\alpha } ) \), which is independent of the dimension of matrix A. The additive preconditioner [47] would be used to reduce the κ.
Appendix 2
2.1 Non-restoring method for solving the square root function
The calculation procedure consists of the following five steps.
- 1st.
Ignore the binary point of the binary number and expand the m-bits binary string to be 2m-bits by adding 0 on the right-hand side.
- 2nd.
Divide the 2m-bits string into m parts in pairs from upper bit to lower.
- 3rd.
Subtract 01 from the most left part. If the subtraction result is nonnegative, then the first bit of the solution is 1 and proceed to the next step. Otherwise, first bit of the solution is 0 and undo the subtraction operation.
- 4th.
Expand the subtraction result of the last step by combining it with the next 2-bit part, and combine the solution obtained in the last step with 01. Then subtract the second number from the first number. If the subtraction result is nonnegative, the next bit of the solution is 1 and proceed to the next step. Otherwise, the next bit is 0 and undo the subtraction operation.
- 5th.
Repeat step 4m − 1 times and the m-bits of the solution are obtained.
We take the square root of 01.002 as the example to illustrate the calculation procedure as shown in Fig. 15.
2.2 Non-restoring method for solving the reciprocal function
The calculation procedure consists of the following three steps.
- 1st.
The highest bit of dividend 1 is the sign bit. Subtract the divisor from the dividend. If the sign bit of the result is 0, the first bit of reciprocal is 1, otherwise the first bit is 0. Then the result shifts left one bit except the sign bit with zero padding to the end to obtain the second dividend.
- 2nd.
If the sign bit of the dividend of the last step is 0, subtract the divisor. If the sign bit is 1, add the divisor. If the sign bit of the result is 0, the next bit of reciprocal is 1, otherwise the next bit is 0. Then the result shifts left one bit except the sign bit with zero padding to the end to obtain the next dividend.
- 3rd.
Repeat step 2m − 1 times and the m-bits of reciprocal of the divisor are obtained.
The reciprocal of 10002 is taken as the example as described in Fig. 16.
Appendix 3
3.1 Error accumulation in the iteration process of EVC module
As shown in Fig. 6, the EVC module is first initialized with q qubits to perform the intermediate iterative calculations and finally truncated to m qubits to store the approximated eigenvalues. There exists truncation error in each iteration which will be accumulated to the final result. So appropriate q should be selected to guarantee that all the m-bits of the output are exact.
According to the characteristics of the iterative formula as shown in Eq. (12), the maximum error accumulation occurs at the points of |cos(1/2 ± 1/2n)π|. We take one of them, namely \( {j \mathord{\left/ {\vphantom {j N}} \right. \kern-0pt} N} = (0.0\mathop {\underline{11 \cdots 1} }\limits_{n - 1} )_{2} \), to evaluate the upper bound of the truncation error. Firstly, Eq. (12) can be expressed as
The derivative of the first iteration function is decreasing and belongs to the interval of \( [{1 \mathord{\left/ {\vphantom {1 4}} \right. \kern-0pt} 4},{{\sqrt 2 } \mathord{\left/ {\vphantom {{\sqrt 2 } 4}} \right. \kern-0pt} 4}] \), while the second is also decreasing and belongs to the interval of \( [{{ - \sqrt 2 } \mathord{\left/ {\vphantom {{ - \sqrt 2 } 4}} \right. \kern-0pt} 4}, - \infty ) \). The iteration process is as follows:
where εi represents the truncation error of each iteration step. The error of the first step is always zero. For \( {j \mathord{\left/ {\vphantom {j N}} \right. \kern-0pt} N} = (0.011 \cdots 1)_{2} \), the next n − 2 steps satisfy vi= vi − 1, so the function of \( \sqrt {(1 + x)/2} \) is calculated; the last step calculates \( \sqrt {(1 - x)/2} \). Using the fact that the derivative of \( \sqrt {(1 + x)/2} \) is no larger than \( {{\sqrt 2 } \mathord{\left/ {\vphantom {{\sqrt 2 } 4}} \right. \kern-0pt} 4} \), the error accumulation can be expressed as
where δ is the derivative of \( \sqrt {(1 - x)/2} \) satisfying \( \delta = |y^{\prime}_{n} | \in [{{\sqrt 2 } \mathord{\left/ {\vphantom {{\sqrt 2 } 4}} \right. \kern-0pt} 4},\infty ) \).
Now we need to evaluate the upper bound of δ. First we have the relation of cosx < 1 − x2/4 when \( x \in (0,1) \). Then the output of the (n − 1)th iteration satisfies
So the absolute value of the derivative at the nth iteration could be calculated,
Substitute the result in Eq. (C.1.3) and we obtain
This is the error for |cos(jπ/N)|. We finally truncate the result of 2N2(1 − cos(jπ/N)) into m qubits, and m = 2n + 2+f (note that the n here represents the same parameter as that in, say Eq. (C.1.2)), where the 2n + 2 bits hold the integer part and the f bits hold the fractional part. In order to guarantee that all the m-bits of the output are totally exact, the q should satisfy the following inequality,
Without loss of generality, we would assume that f = 2n + 2, so in such case q = 5m/4 is adequate to make the high m-bits output being exact in theory.
3.2 The error in controlled rotation
According to Eq. (13), the probability amplitude of the quantum state after controlled rotation should be
Substituting Eq. (14) in Eq. (C.2.1), then it turns to
Based on Eq. (14), we know that \( {1 \mathord{\left/ {\vphantom {1 {\tilde{\lambda }_{j} }}} \right. \kern-0pt} {\tilde{\lambda }_{j} }} = {1 \mathord{\left/ {\vphantom {1 {\sqrt {1 + \hat{\lambda }_{j}^{2} } }}} \right. \kern-0pt} {\sqrt {1 + \hat{\lambda }_{j}^{2} } }} \). So the error is
We can reduce error by amplifying the approximated eigenvalues, i.e., shift the binary numeral of \( \hat{\lambda }_{j} \) left, say, i bits. Now the error turns to
where NR means the operation is calculated by non-restoring method. So the upper bound of error \( \varepsilon_{2} (i) \) reduces exponentially with i. Shifting left one bit makes the error reduce about 22 times. And the state after controlled rotation turns to \( \sqrt {1 - \left( {{{C^{\prime}} \mathord{\left/ {\vphantom {{C^{\prime}} {2^{i} \tilde{\lambda }_{j} }}} \right. \kern-0pt} {2^{i} \tilde{\lambda }_{j} }}} \right)^{2} } |0\rangle + {{C^{\prime}} \mathord{\left/ {\vphantom {{C^{\prime}} {2^{i} \tilde{\lambda }_{j} }}} \right. \kern-0pt} {2^{i} \tilde{\lambda }_{j} }} |1\rangle \), where \( C^{\prime} \) represents the normalizing constant. Factor \( {1 \mathord{\left/ {\vphantom {1 {2^{i} }}} \right. \kern-0pt} {2^{i} }} \) will be contained in the normalizing constant.
Rights and permissions
About this article
Cite this article
Wang, S., Wang, Z., Li, W. et al. Quantum fast Poisson solver: the algorithm and complete and modular circuit design. Quantum Inf Process 19, 170 (2020). https://doi.org/10.1007/s11128-020-02669-7
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11128-020-02669-7