# A Variational Quantum Linear Solver Application to Discrete Finite-Element Methods

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

**any problem**faster on a quantum computer, regardless of its real-world applicability [2].

## 2. The Variational Quantum Linear Solver

#### 2.1. The Variational Ansatz

#### 2.2. Matrix Pauli Decomposition

#### 2.3. Right-Hand Side Preparation

## 3. Computational Details

## 4. Training Algorithm

## 5. Applications

#### 5.1. Application 1: The Poisson Equation

- qc = QuantumCircuit (4)
- U = [0.1,2,2,2,2,2,2,0.1]
- U /= np.linalg.norm (U)
- qc.isometry (U, [0, 1, 2], [])
- qc = transpile (qc, basis_gates = [’u3’, ’cx’], optimization_level=3)

#### 5.1.1. Poisson Case 1: Parabolic Solution with Homogeneous Boundary Conditions

#### 5.1.2. Poisson Case 2: Cubic Solution with Non-Homogeneous B.C.

#### 5.2. Application 2: The Heat Equation

#### 5.3. Application 3: The Wave Equation

## 6. Discussion

## Author Contributions

## Funding

## Institutional Review Board Statement

## Data Availability Statement

## Conflicts of Interest

## Appendix A. Preparation of the Stiffness Matrix

#### Appendix A.1. Implementing the Recursion Using GHZ States

#### Appendix A.2. Preparation of the m=3 Stiffness Matrix

#### Appendix A.3. Preparation of a General m Qubit Stiffness Matrix

## References

- Preskill, J. Quantum computing and the entanglement frontier. arXiv
**2012**, arXiv:1203.5813. Available online: http://arxiv.org/abs/1203.5813 (accessed on 20 February 2023). - Harrow, A.W.; Montanaro, A. Quantum computational supremacy. Nature
**2017**, 549, 203–209. [Google Scholar] [CrossRef] [Green Version] - Arute, F.; Arya, K.; Babbush, R.; Bacon, D.; Bardin, J.C.; Barends, R.; Biswas, R.; Boixo, S.; Brandao, F.G.S.L.; Buell, D.A.; et al. Quantum supremacy using a programmable superconducting processor. Nature
**2019**, 574, 505–510. Available online: https://www.nature.com/articles/s41586-019-1666-5 (accessed on 20 February 2023). - Connor, E. The New Light-Based Quantum Computer Jiuzhang Has Achieved Quantum Supremacy. 2020. Available online: https://www.sciencenews.org/article/new-light-based-quantum-computer-jiuzhang-supremacy (accessed on 20 February 2023).
- Head-Marsden, K.; Flick, J.; Ciccarino, C.J.; Narang, P. Quantum information and algorithms for correlated quantum matter. Chem. Rev.
**2021**, 121, 3061–3120. [Google Scholar] [CrossRef] [PubMed] - Breuer, H.-P.; Petruccione, F. The Theory of Open Quantum Systems; Oxford University Press: Oxford, UK, 2007; ISBN 9780199213900. [Google Scholar]
- Clerk, A.A.; Devoret, M.H.; Girvin, S.M.; Marquardt, F.; Schoelkopf, R.J. Introduction to quantum noise, measurement, and amplification. Rev. Mod. Phys.
**2010**, 82, 1155–1208. [Google Scholar] [CrossRef] - Lidar, D.A. Lecture notes on the theory of open quantum systems. arXiv
**2019**, arXiv:1902.00967. [Google Scholar] - Krantz, P.; Kjaergaard, M.; Yan, F.; Orlando, T.P.; Gustavsson, S.; Oliver, W.D. A quantum engineer’s guide to superconducting qubits. Appl. Phys. Rev.
**2019**, 6, 021318. [Google Scholar] [CrossRef] [Green Version] - Kandala, A.; Temme, K.; Córcoles, A.D.; Mezzacapo, A.; Chow, J.M.; Gambetta, J.M. Error mitigation extends the computational reach of a noisy quantum processor. Nature
**2019**, 567, 491–495. [Google Scholar] [CrossRef] [PubMed] [Green Version] - McArdle, S.; Yuan, X.; Benjamin, S. Error-mitigated digital quantum simulation. Phys. Rev. Lett.
**2019**, 122, 180501. [Google Scholar] [CrossRef] [Green Version] - Smart, S.E.; Mazziotti, D.A. Quantum-classical hybrid algorithm using an error-mitigating n -representability condition to compute the mott metal-insulator transition. Phys. Rev. A
**2019**, 100, 022517. [Google Scholar] [CrossRef] [Green Version] - Smart, S.E.; Boyn, J.N.; Mazziotti, D.A. Resolving correlated states of benzyne with an error-mitigated contracted quantum eigensolver. Phys. Rev. A
**2022**, 105, 022405. [Google Scholar] [CrossRef] - Endo, S.; Cai, Z.; Benjamin, S.C.; Yuan, X. Hybrid quantum-classical algorithms and quantum error mitigation. J. Phys. Soc. Jpn.
**2021**, 90, 032001. [Google Scholar] [CrossRef] - Smart, S.E.; Hu, Z.; Kais, S.; Mazziotti, D.A. Relaxation of stationary states on a quantum computer yields a unique spectroscopic fingerprint of the computer’s noise. Commun. Phys.
**2022**, 5, 8. [Google Scholar] [CrossRef] - Aleksandrowicz, G.; Alexander, T.; Barkoutsosa, P.; Bello, L.; Ben-Haim, Y.; Bucher, D.; Cabrera-Hernández, F.; Carballo-Franquis, J.; Chen, A.; Chen, C.; et al. Qiskit: An Open-Source Framework for Quantum Computing. 2019. Available online: https://doi.org/10.5281/zenodo.2562111 (accessed on 10 May 2022).
- Amazon, Amazon Braket. Available online: https://aws.amazon.com/braket/ (accessed on 10 May 2022).
- IBM, Learning Quantum Computation Using Qiskit. Available online: http://qiskit.org/textbook (accessed on 1 July 2021).
- Albornoz, C.; Alonso, G.; Andrenkov, P.A.M.; Asadi, A. Anothers, Xanadu Quantum Codebook. 2021. Available online: https://codebook.xanadu.ai (accessed on 1 July 2022).
- Qbraid. Qbraid: Cloud-Based ide for Quantum Computing. Available online: https://qbraid.com (accessed on 10 July 2022).
- Biamonte, J.; Wittek, P.; Pancotti, N.; Rebentrost, P.; Wiebe, N.; Lloyd, S. Quantum machine learning. Nature
**2017**, 549, 195–202. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Pudenz, K.L.; Lidar, D.A. Quantum adiabatic machine learning. Quantum Inf. Process.
**2013**, 12, 2027–2070. [Google Scholar] [CrossRef] [Green Version] - Lloyd, S.; Mohseni, M.; Rebentrost, P. Quantum principal component analysis. Nat. Phys.
**2014**, 10, 631–633. [Google Scholar] [CrossRef] [Green Version] - Rebentrost, P.; Mohseni, M.; Lloyd, S. Quantum support vector machine for big data classification. Phys. Rev. Lett.
**2014**, 113, 130503. [Google Scholar] [CrossRef] [Green Version] - Schuld, M.; Sinayskiy, I.; Petruccione, F. An introduction to quantum machine learning. Contemp. Phys.
**2015**, 56, 172–185. [Google Scholar] [CrossRef] [Green Version] - Altaisky, M.V.; Zolnikova, N.N.; Kaputkina, N.E.; Krylov, V.A.; Lozovik, Y.E.; Dattani, N.S. Towards a feasible implementation of quantum neural networks using quantum dots. Appl. Phys. Lett.
**2016**, 108, 103108. [Google Scholar] [CrossRef] [Green Version] - Dunjko, V.; Taylor, J.M.; Briegel, H.J. Framework for learning agents in quantum environments. arXiv
**2015**, arXiv:1507.08482. [Google Scholar] - Alvarez-Rodriguez, U.; Lamata, L.; Escandell-Montero, P.; Martín-Guerrero, J.D.; Solano, E. Supervised quantum learning without measurements. Sci. Rep.
**2017**, 7, 1–9. [Google Scholar] - Lamata, L. Basic protocols in quantum reinforcement learning with superconducting circuits. Sci. Rep.
**2017**, 7, 1–10. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Wiebe, N.; Braun, D.; Lloyd, S. Quantum algorithm for data fitting. Phys. Rev. Lett.
**2012**, 109, 050505. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Schuld, M.; Sinayskiy, I.; Petruccione, F. Prediction by linear regression on a quantum computer. Phys. Rev. A
**2016**, 94, 022342. [Google Scholar] [CrossRef] [Green Version] - Harrow, A.W.; Hassidim, A.; Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett.
**2009**, 103, 150502. [Google Scholar] [CrossRef] [PubMed] - Berry, D.W.; Childs, A.M.; Kothari, R. Hamiltonian simulation with nearly optimal dependence on all parameters. In Proceedings of the 2015 IEEE 56th Annual Symposium on Foundations of Computer Science, Berkeley, CA, USA, 17–20 October 2015; pp. 792–809. [Google Scholar] [CrossRef] [Green Version]
- Zhao, Z.; Fitzsimons, J.K.; Fitzsimons, J.F. Quantum-assisted Gaussian process regression. Phys. Rev. A
**2019**, 99, 052331. [Google Scholar] [CrossRef] [Green Version] - Zheng, Y.; Song, C.; Chen, M.C.; Xia, B.; Liu, W.; Guo, Q.; Zhang, L.; Xu, D.; Deng, H.; Huang, K.; et al. Solving systems of linear equations with a superconducting quantum processor. Phys. Rev. Lett.
**2017**, 118, 210504. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Lee, Y.; Joo, J.; Lee, S. Hybrid quantum linear equation algorithm and its experimental test on ibm quantum experience. Sci. Rep.
**2019**, 9, 4778. [Google Scholar] [CrossRef] [Green Version] - Pan, J.; Cao, Y.; Yao, X.; Li, Z.; Ju, C.; Chen, H.; Peng, X.; Kais, S.; Du, J. Experimental realization of quantum algorithm for solving linear systems of equations. Phys. Rev. A
**2014**, 89, 022313. [Google Scholar] [CrossRef] [Green Version] - Cai, X.-D.; Weedbrook, C.; Su, Z.-E.; Chen, M.-C.; Gu, M.; Zhu, M.-J.; Li, L.; Liu, N.; Lu, C.; Pan, J. Experimental quantum computing to solve systems of linear equations. Phys. Rev. Lett.
**2013**, 110, 30501. [Google Scholar] [CrossRef] [Green Version] - Barz, S.; Kassal, I.; Ringbauer, M.; Lipp, Y.O.; Dakić, B.; Aspuru-Guzik, A.; Walther, P. A two-qubit photonic quantum processor and its application to solving systems of linear equations. Sci. Rep.
**2014**, 4, 6115. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Wen, J.; Kong, X.; Wei, S.; Wang, B.; Xin, T.; Long, G. Experimental realization of quantum algorithms for a linear system inspired by adiabatic quantum computing. Phys. Rev. A
**2019**, 99, 012320. [Google Scholar] [CrossRef] [Green Version] - Anschuetz, E.; Olson, J.; Aspuru-Guzik, A.; Cao, Y. Variational quantum factoring. In Quantum Technology and Optimization Problems; Feld, S., Linnhoff-Popien, C., Eds.; Springer International Publishing: Cham, Switzerland, 2019; pp. 74–85. [Google Scholar]
- Peruzzo, A.; McClean, J.; Shadbolt, P.; Yung, M.; Zhou, X.; Love, P.J.; Aspuru-Guzik, A.; O’Brien, J.L. A variational eigenvalue solver on a photonic quantum processor. Nat. Commun.
**2014**, 5, 4213. [Google Scholar] [CrossRef] [Green Version] - Cao, Y.; Romero, J.; Olson, J.P.; Degroote, M.; Johnson, P.D.; Kieferova, M.; Kivlichan, I.D.; Menke, T.; Peropadre, B.; Sawaya, N.P.D.; et al. Quantum chemistry in the age of quantum computing. Chem. Rev.
**2019**, 119, 10856–10915. [Google Scholar] [CrossRef] [Green Version] - Higgott, O.; Wang, D.; Brierley, S. Variational quantum computation of excited states. Quantum
**2019**, 3, 156. [Google Scholar] [CrossRef] [Green Version] - Jones, T.; Endo, S.; McArdle, S.; Yuan, X.; Benjamin, S.C. Variational quantum algorithms for discovering hamiltonian spectra. Phys. Rev. A
**2019**, 99, 062304. [Google Scholar] [CrossRef] [Green Version] - Li, Y.; Benjamin, S.C. Efficient variational quantum simulator incorporating active error minimization. Phys. Rev. X
**2017**, 7, 021050. [Google Scholar] [CrossRef] [Green Version] - Kokail, C.; Maier, C.; van Bijnen, R.; Brydges, T.; Joshi, M.K.; Jurcevic, P.; Muschik, C.A.; Silvi, P.; Blatt, R.; Roos, C.F.; et al. Self-verifying variational quantum simulation of lattice models. Nature
**2019**, 569, 55–360. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Heya, K.; Nakanishi, K.M.; Mitarai, K.; Fujii, K. Subspace variational quantum simulator. arXiv
**2019**, arXiv:1904.08566. [Google Scholar] - Cirstoiu, C.; Holmes, Z.; Iosue, J.; Cincio, L.; Coles, P.J.; Sornborger, A. Variational fast forwarding for quantum simulation beyond the coherence time. npj Quantum Inf.
**2020**, 6, 82. [Google Scholar] [CrossRef] - Yuan, X.; Endo, S.; Zhao, Q.; Li, Y.; Benjamin, S.C. Theory of variational quantum simulation. Quantum
**2019**, 3, 191. [Google Scholar] [CrossRef] - Romero, J.; Olson, J.P.; Aspuru-Guzik, A. Quantum autoencoders for efficient compression of quantum data. Quantum Sci. Technol.
**2017**, 2, 045001. [Google Scholar] [CrossRef] [Green Version] - LaRose, R.; Tikku, A.; O’Neel-Judy, É.; Cincio, L.; Coles, P.J. Variational quantum state diagonalization. npj Quantum Inf.
**2019**, 5, 57. [Google Scholar] [CrossRef] [Green Version] - Bravo-Prieto, C.; Garcí a-Martín, D.; Latorre, J.I. Quantum singular value decomposer. Phys. Rev. A
**2020**, 101, 062310. [Google Scholar] [CrossRef] - Cerezo, M.; Sharma, K.; Arrasmith, A.; Coles, P.J. Variational quantum state eigensolver. npj Quantum Inf.
**2022**, 8, 113. [Google Scholar] [CrossRef] - Khatri, S.; LaRose, R.; Poremba, A.; Cincio, L.; Sornborger, A.T.; Coles, P.J. Quantum-assisted quantum compiling. Quantum
**2019**, 3, 140. [Google Scholar] [CrossRef] [Green Version] - Jones, T.; Benjamin, S.C. Robust quantum compilation and circuit optimisation via energy minimisation. Quantum
**2022**, 6, 628. [Google Scholar] [CrossRef] - Arrasmith, A.; Cincio, L.; Sornborger, A.T.; Zurek, W.H.; Coles, P.J. Variational consistent histories as a hybrid algorithm for quantum foundations. Nat. Commun.
**2019**, 10, 3438. [Google Scholar] [CrossRef] [Green Version] - Cerezo, M.; Poremba, A.; Cincio, L.; Coles, P.J. Variational quantum fidelity estimation. Quantum
**2020**, 4, 248. [Google Scholar] [CrossRef] [Green Version] - Koczor, B.; Endo, S.; Jones, T.; Matsuzaki, Y.; Benjamin, S. Variational-state quantum metrology. New J. Phys.
**2020**, 22, 083038. [Google Scholar] [CrossRef] - Bravo-Prieto, C.; LaRose, R.; Cerezo, M.; Subasi, Y.; Cincio, L.; Coles, P.J. Variational Quantum Linear Solver. arXiv
**2019**, arXiv:1909.05820. [Google Scholar] [CrossRef] - Bravo-Prieto, C.; LaRose, R.; Cerezo, M.; Subaşı, Y.; Cincio, L.; Coles, P.J. Variational quantum linear solver: A hybrid algorithm for linear systems. Bull. Am. Phys. Soc.
**2020**, arXiv:1909.05820v2. [Google Scholar] [CrossRef] - Cincio, L.; Subaşı, Y.; Sornborger, A.T.; Coles, P.J. Learning the quantum algorithm for state overlap. New J. Phys.
**2018**, 20, 13022. [Google Scholar] [CrossRef] - Pesce, R.M.N.; Stevenson, P.D. H2zixy: Pauli spin matrix decomposition of real symmetric matrices. arXiv
**2021**, arXiv:2111.00627. [Google Scholar] - Pellow-Jarman, A.; Sinayskiy, I.; Pillay, A.; Petruccione, F. A comparison of various classical optimizers for a variational quantum linear solver. Quantum Inf. Process.
**2021**, 20, 202. [Google Scholar] [CrossRef] - Hughes, T.J. The Finite Element Method: Linear Static and Dynamic Finite Element Analysis; Courier Corporation: Chelmsford, MA, USA, 2012. [Google Scholar]
- Soklakov, A.N.; Schack, R. Efficient state preparation for a register of quantum bits. Phys. Rev. A
**2006**, 73, 012307. [Google Scholar] [CrossRef] - Giovannetti, V.; Lloyd, S.; Maccone, L. Quantum Random Access Memory. Phys. Rev. Lett.
**2008**, 100, 160501. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Aaronson, S. Read the fine print. Nat. Phys.
**2015**, 11, 291–293. [Google Scholar] [CrossRef] - Bang, J.; Dutta, A.; Lee, S.W.; Kim, J. Optimal usage of quantum random access memory in quantum machine learning. Phys. Rev. A
**2019**, 99, 012326. [Google Scholar] [CrossRef] [Green Version]

**Figure 2.**A quantum circuit representing ${\overrightarrow{f}}^{T}=[\phantom{\rule{0.166667em}{0ex}}0.1,2,2,2,2,2,2,0.1\phantom{\rule{0.166667em}{0ex}}]$ found using Qiskit’s Isometry command.

**Figure 3.**Two-qubit VQLS cost function results for the reduced Poisson problem with homogeneous Dirichlet boundary conditions. The results were averaged over 20 trial runs. Variances are shown by respective bars.

**Figure 4.**Wall clock time in seconds versus the number of layers for the two-qubit VQLS reduced Poisson problem with homogeneous Dirichlet boundary conditions.

**Figure 5.**Three-qubit VQLS cost function results for the reduced Poisson problem with homogeneous Dirichlet boundary conditions. The results were averaged over 10 trial runs. Variances are shown by respective bars.

**Figure 6.**Three-qubit (eight-node) VQLS results (filled circles with dashed lines) for reduced Poisson problem with homogeneous Dirichlet boundary conditions. The classical discrete solution is shown with a solid black line.

**Figure 7.**The root mean squared solution error versus the number of layers for the three-qubit VQLS reduced Poisson problem with homogeneous Dirichlet boundary conditions. Here, the errors were averaged over all 10 runs for each layer.

**Figure 8.**Wall clock time in seconds versus the number of layers for the three-qubit VQLS reduced Poisson problem with homogeneous Dirichlet boundary conditions. The three-layer run does not converge.

**Figure 9.**The COBYLA cost convergence for a range of shots in the two-qubit VQLS reduced Poisson problem with homogeneous Dirichlet boundary conditions.

**Figure 10.**Two-qubit, two-layer solution (filled circles) along with the analytic solution (solid line) of Case 2: the cubic Poisson problem.

**Figure 11.**VQLS mean cost versus iteration or optimization count over a range of layers for the cubic Poisson problem. Variances are shown as curve error bars.

**Figure 12.**Analytic solution (solid line) versus two-qubit VQLS-based finite element results (dashed line with open circles) for the time-dependent heat equation at each time step.

**Figure 14.**Analytic solution (solid line) versus two-qubit VQLS-based finite element results (dashed line with open circles) for the time-dependent wave equation at each time step.

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Trahan, C.J.; Loveland, M.; Davis, N.; Ellison, E.
A Variational Quantum Linear Solver Application to Discrete Finite-Element Methods. *Entropy* **2023**, *25*, 580.
https://doi.org/10.3390/e25040580

**AMA Style**

Trahan CJ, Loveland M, Davis N, Ellison E.
A Variational Quantum Linear Solver Application to Discrete Finite-Element Methods. *Entropy*. 2023; 25(4):580.
https://doi.org/10.3390/e25040580

**Chicago/Turabian Style**

Trahan, Corey Jason, Mark Loveland, Noah Davis, and Elizabeth Ellison.
2023. "A Variational Quantum Linear Solver Application to Discrete Finite-Element Methods" *Entropy* 25, no. 4: 580.
https://doi.org/10.3390/e25040580