QDB: From Quantum Algorithms Towards Correct Quantum Programs

Authors Yipeng Huang , Margaret Martonosi

Thumbnail PDF


  • Filesize: 0.5 MB
  • 14 pages

Document Identifiers

Author Details

Yipeng Huang
  • Princeton University, USA
Margaret Martonosi
  • Princeton University, USA

Cite AsGet BibTex

Yipeng Huang and Margaret Martonosi. QDB: From Quantum Algorithms Towards Correct Quantum Programs. In 9th Workshop on Evaluation and Usability of Programming Languages and Tools (PLATEAU 2018). Open Access Series in Informatics (OASIcs), Volume 67, pp. 4:1-4:14, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2019)


With the advent of small-scale prototype quantum computers, researchers can now code and run quantum algorithms that were previously proposed but not fully implemented. In support of this growing interest in quantum computing experimentation, programmers need new tools and techniques to write and debug QC code. In this work, we implement a range of QC algorithms and programs in order to discover what types of bugs occur and what defenses against those bugs are possible in QC programs. We conduct our study by running small-sized QC programs in QC simulators in order to replicate published results in QC implementations. Where possible, we cross-validate results from programs written in different QC languages for the same problems and inputs. Drawing on this experience, we provide a taxonomy for QC bugs, and we propose QC language features that would aid in writing correct code.

Subject Classification

ACM Subject Classification
  • Computer systems organization → Quantum computing
  • correctness
  • debugging


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. R. Barends, A. Shabani, L. Lamata, J. Kelly, A. Mezzacapo, U. Las Heras, R. Babbush, A. G. Fowler, B. Campbell, Yu Chen, Z. Chen, B. Chiaro, A. Dunsworth, E. Jeffrey, E. Lucero, A. Megrant, J. Y. Mutus, M. Neeley, C. Neill, P. J. J. O'Malley, C. Quintana, P. Roushan, D. Sank, A. Vainsencher, J. Wenner, T. C. White, E. Solano, H. Neven, and John M. Martinis. Digitized adiabatic quantum computing with a superconducting circuit. Nature, 534:222 EP-, June 2016. URL: http://dx.doi.org/10.1038/nature17658.
  2. Stephane Beauregard. Circuit for Shor’s Algorithm Using 2N+3 Qubits. Quantum Info. Comput., 3(2):175-185, March 2003. URL: http://dl.acm.org/citation.cfm?id=2011517.2011525.
  3. Frederic T. Chong, Diana Franklin, and Margaret Martonosi. Programming languages and compiler design for realistic quantum hardware. Nature, 549:180 EP-, September 2017. URL: http://dx.doi.org/10.1038/nature23459.
  4. Patrick J. Coles, Stephan Eidenbenz, Scott Pakin, Adetokunbo Adedoyin, John Ambrosiano, Petr M. Anisimov, William Casper, Gopinath Chennupati, Carleton Coffrin, Hristo Djidjev, David Gunter, Satish Karra, Nathan Lemons, Shizeng Lin, Andrey Y. Lokhov, Alexander Malyzhenkov, David Mascarenas, Susan M. Mniszewski, Balu Nadiga, Dan O'Malley, Diane Oyen, Lakshman Prasad, Randy Roberts, Philip Romero, Nandakishore Santhi, Nikolai Sinitsyn, Pieter Swart, Marc Vuffray, Jim Wendelberger, Boram Yoon, Richard J. Zamora, and Wei Zhu. Quantum Algorithm Implementations for Beginners. CoRR, abs/1804.03719, 2018. URL: http://arxiv.org/abs/1804.03719.
  5. A. W. Cross, L. S. Bishop, J. A. Smolin, and J. M. Gambetta. Open Quantum Assembly Language. ArXiv e-prints, July 2017. URL: http://arxiv.org/abs/1707.03429.
  6. Alexander S. Green, Peter LeFanu Lumsdaine, Neil J. Ross, Peter Selinger, and Benoît Valiron. Quipper: A Scalable Quantum Programming Language. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '13, pages 333-342, New York, NY, USA, 2013. ACM. URL: http://dx.doi.org/10.1145/2491956.2462177.
  7. Lov K Grover. From Schrödinger’s equation to the quantum search algorithm. Pramana, 56(2-3):333-348, 2001. Google Scholar
  8. T. Häner, T. Hoefler, and M. Troyer. Using Hoare logic for quantum circuit optimization. ArXiv e-prints, September 2018. URL: http://arxiv.org/abs/1810.00375.
  9. Thomas Häner, Martin Roetteler, and Krysta M. Svore. Factoring Using 2N + 2 Qubits with Toffoli Based Modular Multiplication. Quantum Info. Comput., 17(7-8):673-684, June 2017. URL: http://dl.acm.org/citation.cfm?id=3179553.3179560.
  10. Thomas Häner, Damian S. Steiger, Mikhail Smelyanskiy, and Matthias Troyer. High Performance Emulation of Quantum Circuits. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC '16, pages 74:1-74:9, Piscataway, NJ, USA, 2016. IEEE Press. URL: http://dl.acm.org/citation.cfm?id=3014904.3015003.
  11. Aram Harrow. Why Now is the Right Time to Study Quantum Computing. XRDS, 18(3):32-37, March 2012. URL: http://dx.doi.org/10.1145/2090276.2090288.
  12. Thomas Häner, Damian S Steiger, Krysta Svore, and Matthias Troyer. A software methodology for compiling quantum programs. Quantum Science and Technology, 3(2):020501, 2018. URL: http://stacks.iop.org/2058-9565/3/i=2/a=020501.
  13. Ali JavadiAbhari, Shruti Patil, Daniel Kudrow, Jeff Heckey, Alexey Lvov, Frederic T. Chong, and Margaret Martonosi. ScaffCC: A framework for compilation and analysis of quantum computing programs. In Proceedings of the 11th ACM Conference on Computing Frontiers, CF '14, pages 1:1-1:10, New York, NY, USA, 2014. ACM. URL: http://dx.doi.org/10.1145/2597917.2597939.
  14. Phillip Kaye, Raymond Laflamme, and Michele Mosca. An Introduction to Quantum Computing. Oxford University Press, Inc., New York, NY, USA, 2007. Google Scholar
  15. N. Khammassi, I. Ashraf, X. Fu, C. G. Almudever, and K. Bertels. QX: A high-performance quantum computer simulation platform. In Proceedings of the Conference on Design, Automation &Test in Europe, DATE '17, pages 464-469, 3001 Leuven, Belgium, Belgium, 2017. European Design and Automation Association. URL: http://dl.acm.org/citation.cfm?id=3130379.3130487.
  16. B. P. Lanyon, T. J. Weinhold, N. K. Langford, M. Barbieri, D. F. V. James, A. Gilchrist, and A. G. White. Experimental Demonstration of a Compiled Version of Shor’s Algorithm with Quantum Entanglement. Phys. Rev. Lett., 99:250505, December 2007. URL: http://dx.doi.org/10.1103/PhysRevLett.99.250505.
  17. B. P. Lanyon, J. D. Whitfield, G. G. Gillett, M. E. Goggin, M. P. Almeida, I. Kassal, J. D. Biamonte, M. Mohseni, B. J. Powell, M. Barbieri, A. Aspuru-Guzik, and A. G. White. Towards quantum chemistry on a quantum computer. Nature Chemistry, 2:106 EP-, January 2010. URL: http://dx.doi.org/10.1038/nchem.483.
  18. R. LaRose. Overview and Comparison of Gate Level Quantum Software Platforms. ArXiv e-prints, July 2018. URL: http://arxiv.org/abs/1807.02500.
  19. Norbert M. Linke, Dmitri Maslov, Martin Roetteler, Shantanu Debnath, Caroline Figgatt, Kevin A. Landsman, Kenneth Wright, and Christopher Monroe. Experimental comparison of two quantum computing architectures. Proceedings of the National Academy of Sciences, 114(13):3305-3310, 2017. URL: http://dx.doi.org/10.1073/pnas.1618020114.
  20. S. McArdle, S. Endo, A. Aspuru-Guzik, S. Benjamin, and X. Yuan. Quantum computational chemistry. ArXiv e-prints, August 2018. URL: http://arxiv.org/abs/1808.10402.
  21. J. R. McClean, I. D. Kivlichan, K. J. Sung, D. S. Steiger, Y. Cao, C. Dai, E. Schuyler Fried, C. Gidney, B. Gimby, P. Gokhale, T. Häner, T. Hardikar, V. Havlíček, C. Huang, J. Izaac, Z. Jiang, X. Liu, M. Neeley, T. O'Brien, I. Ozfidan, M. D. Radin, J. Romero, N. Rubin, N. P. D. Sawaya, K. Setia, S. Sim, M. Steudtner, Q. Sun, W. Sun, F. Zhang, and R. Babbush. OpenFermion: The Electronic Structure Package for Quantum Computers. ArXiv e-prints, October 2017. URL: http://arxiv.org/abs/1710.07629.
  22. N.D. Mermin. Quantum Computer Science: An Introduction. Cambridge University Press, 2007. Google Scholar
  23. Tzvetan S. Metodi, Arvin I. Faruque, and Frederic T. Chong. Quantum Computing for Computer Architects, Second Edition. Synthesis Lectures on Computer Architecture, 6(1):1-203, 2011. URL: http://dx.doi.org/10.2200/S00331ED1V01Y201101CAC013.
  24. Ashley Montanaro. Quantum algorithms: an overview. npj Quantum Information, 2:15023, 2016. Google Scholar
  25. Michele Mosca. Quantum algorithms. In Encyclopedia of Complexity and Systems Science, pages 7088-7118. Springer, 2009. Google Scholar
  26. Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press, New York, NY, USA, 10th edition, 2011. Google Scholar
  27. Jonathan Olson, Yudong Cao, Jonathan Romero, Peter Johnson, Pierre-Luc Dallaire-Demers, Nicolas Sawaya, Prineha Narang, Ian Kivlichan, Michael Wasielewski, and Alán Aspuru-Guzik. Quantum information and computation for chemistry. arXiv preprint arXiv:1706.05413, 2017. Google Scholar
  28. S. Patil, A. JavadiAbhari, C. Chiang, J. Heckey, M. Martonosi, and F. T. Chong. Characterizing the performance effect of trials and rotations in applications that use Quantum Phase Estimation. In 2014 IEEE International Symposium on Workload Characterization (IISWC), pages 181-190, October 2014. URL: http://dx.doi.org/10.1109/IISWC.2014.6983057.
  29. Archimedes Pavlidis and Dimitris Gizopoulos. Fast Quantum Modular Exponentiation Architecture for Shor’s Factoring Algorithm. Quantum Info. Comput., 14:649-682, May 2014. URL: http://dl.acm.org/citation.cfm?id=2638682.2638690.
  30. Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J. Love, Alán Aspuru-Guzik, and Jeremy L. O'Brien. A variational eigenvalue solver on a photonic quantum processor. Nature Communications, 5:4213 EP-, July 2014. URL: http://dx.doi.org/10.1038/ncomms5213.
  31. John Preskill. Quantum Computing in the NISQ era and beyond. Quantum, 2:79, August 2018. URL: http://dx.doi.org/10.22331/q-2018-08-06-79.
  32. M. Roetteler, K. M. Svore, D. Wecker, and N. Wiebe. Design automation for quantum architectures. In Design, Automation Test in Europe Conference Exhibition (DATE), 2017, pages 1312-1317, March 2017. URL: http://dx.doi.org/10.23919/DATE.2017.7927196.
  33. Jacob T. Seeley, Martin J. Richard, and Peter J. Love. The Bravyi-Kitaev transformation for quantum computation of electronic structure. The Journal of Chemical Physics, 137(22):224109, 2012. URL: http://dx.doi.org/10.1063/1.4768229.
  34. Peter W. Shor. Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer. SIAM J. Comput., 26(5):1484-1509, October 1997. URL: http://dx.doi.org/10.1137/S0097539795293172.
  35. R. S. Smith, M. J. Curtis, and W. J. Zeng. A Practical Quantum Instruction Set Architecture. ArXiv e-prints, August 2016. URL: http://arxiv.org/abs/1608.03355.
  36. Damian S. Steiger, Thomas Häner, and Matthias Troyer. ProjectQ: an open source software framework for quantum computing. Quantum, 2:49, January 2018. URL: http://dx.doi.org/10.22331/q-2018-01-31-49.
  37. Krysta Svore, Alan Geller, Matthias Troyer, John Azariah, Christopher Granade, Bettina Heim, Vadym Kliuchnikov, Mariia Mykhailova, Andres Paz, and Martin Roetteler. Q#: Enabling Scalable Quantum Computing and Development with a High-level DSL. In Proceedings of the Real World Domain Specific Languages Workshop 2018, RWDSL2018, pages 7:1-7:10, New York, NY, USA, 2018. ACM. URL: http://dx.doi.org/10.1145/3183895.3183901.
  38. Yasuhiro Takahashi and Noboru Kunihiro. A Quantum Circuit for Shor’s Factoring Algorithm Using 2N + 2 Qubits. Quantum Info. Comput., 6(2):184-192, March 2006. URL: http://dl.acm.org/citation.cfm?id=2011665.2011669.
  39. Benoît Valiron, Neil J. Ross, Peter Selinger, D. Scott Alexander, and Jonathan M. Smith. Programming the Quantum Future. Commun. ACM, 58(8):52-61, July 2015. URL: http://dx.doi.org/10.1145/2699415.
  40. Dave Wecker, Bela Bauer, Bryan K. Clark, Matthew B. Hastings, and Matthias Troyer. Gate-count estimates for performing quantum chemistry on small quantum computers. Phys. Rev. A, 90:022305, August 2014. URL: http://dx.doi.org/10.1103/PhysRevA.90.022305.
  41. J. D. Whitfield, J. Biamonte, and A. Aspuru-Guzik. Simulation of electronic structure Hamiltonians using quantum computers. Molecular Physics, 109:735-750, March 2011. URL: http://dx.doi.org/10.1080/00268976.2011.552441.
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail