Procedia Computer Science Volume 51, 2015, Pages 1724–1733 ICCS 2015 International Conference On Computational Science
Teaching Quantum Computing with the QuIDE Simulator Katarzyna Rycerz1,2 , Joanna Patrzyk1 , Bartlomiej Patrzyk1 , and Marian Bubak1,2,3 1 2
AGH University of Science and Technology, Department of Computer Science, al.Mickiewicza 30, 30-059 Krakow, Poland AGH University of Science and Technology, ACC Cyfronet, Nawojki 11, 30-950 Krakow, Poland 3 Insitute of Informatics, University of Amsterdam, Postbus 94323 1090 GE Amsterdam, the Netherlands
Abstract Recently, the idea of quantum computation is becoming more and more popular and there are many attempts to build quantum computers. Therefore, there is a need to introduce this topic to regular students of computer science and engineering. In this paper we present a concept of a course powered by the Quantum Integrated Development Environment (QuIDE), the new quantum computer simulator that joins features of GUI based simulators with interpreters and simulation library approach. The idea of the course is to put together theoretical aspects with practical assignments realized on the QuIDE simulator. Such an approach enables studying a variety of topics in a way understandable for this category of students. The topics of the course included understanding the concept of quantum gates, registers and a series of algorithms: Deutsch and Bernstein-Vazirani Problems, Grover’s Fast Database Search, Shor’s Prime Factorization, Quantum Teleportation and Quantum Dense Coding. We describe results of QuIDE assessment during the course; our solution scored more points in System Usability Scale survey then the other tool previously used for that purpose. We also show that the most useful features of such a tool indicated by students are similar to the assumptions made on the simulator functionality. Keywords: quantum computing course, MSc program, computer science, simulator, SUS survey
1
Introduction
In the recent years the idea of quantum computation is really pushing forward as the significant progress has been made in the field of constructing a quantum computer [14, 15]. The main concept is to use of quantum-mechanical phenomena to perform operations on data considerably faster than with classical computers. Thanks to the quantum parallelism, the ability of being in a superposition of many states, quantum computers would be more powerful and much faster than today’s conventional supercomputers [10]. The first commercially available machine, The 1724
Selection and peer-review under responsibility of the Scientific Programme Committee of ICCS 2015 c The Authors. Published by Elsevier B.V.
doi:10.1016/j.procs.2015.05.374
Rycerz, et. al
D-Wave OneTM , was presented in 2010 by the D-Wave System Inc1 . Therefore, the need to teach computer science students how quantum computer operates becomes more and more important. Especially, there is a need to introduce this topic to regular computer science students, also those who focus their interests towards applied computer science or computer engineering rather then theoretical areas. In this paper, we present a new tool for teaching quantum computation – the Quantum Integrated Development Environment (QuIDE) that was the main simulation software in the course ‘Mathematics for Future Computer Systems’ on Master of Science Degree in Computer Science at the Department of Computer Science at AGH University of Science and Technology [1]. This course, besides of quantum computing, covers also selected topics from complex systems and network science. Teaching such complex and ”exotic” topic as quantum computation requires a convenient and lightweight tool that helps to understand how the quantum computer is actually working. Although many courses already exists [18, 24], none of them propose usage of a simulator that illustrates and verifies pure mathematical assignments. In our work, we propose to add a practical aspect by using a user friendly simulator that verifies theoretical calculations. The preparation of this course became also a challenging task as most of the general profile of the studies is not focused much on theory, but is oriented more towards computer science engineering. This paper is organized as follows: in Section 2 we present related work on the subject. In Section 3 we briefly present concept of the course, Section 4 we describe an overview of the QuIDE simulator and in Section 5 we explain how it was used for our course. We present validation results in Section 6 and summarize in Section 7.
2
Quantum Computing Courses and Simulators
There are many courses on Quantum Computation at different universities. One of the very good examples is the course run by the inventor of quantum factorization algorithm, Peter Shor; this course is available on MIT OpenCourseWare with many interesting lectures and assignments [24]. The other good source of lecture notes and assignments is that at Cornell University [17] and yet another example is the course run by Quantum Theory Group at Carnegie-Mellon University [11]. All of these courses include a large variety of topics related to the subject, however, all of them concentrate on very theoretical aspects and consist of a set of lectures and assignments of pure mathematical character. To our best knowledge, none of them uses a quantum simulator to demonstrate presented topics. On the other hand, there are many quantum computing simulators that could be used during such courses for practical assignments. However, they either focus only on a part of the subject e.g. simulation of a specific phenomena such as Quantum Walks [13] or Quantum Key Distribution [4] or they are not convenient or easy to use. Most of existing simulators provide only a command–line textual interfaces which are not hard to read only when the simulated system is very simple. The examples are quantum computing languages like CHP [2] or QCL [20]. More complicated are simulation libraries like libquantum [8] or Eqcs [3], that provide wide functionality, but could be difficult to use, as their users are responsible for programming every action during the simulation (like a stepping execution or printing the visualization of the simulated quantum state). The existing GUI simulators like QCAD [28] or Quantum Computer Emulator [25] usually have very limited functionality, most of them do not support building custom subroutines, combining the classical and quantum computations and allow to use only 1 http://www.dwavesys.com
1725
Rycerz, et. al
a limited number of qbits. An overview of existing simulators can be found in [23].
3
Quantum Computing Course Concept for MSc Computer Science
The proposed quantum computing course is a part of ‘Mathematics for Future Computer Systems’ lectures [1] and it is based mostly on the book ’Quantum Computing Explained’ [16]. The laboratory part of the course consists of 15 hours and covers three aspects: mathematical assignments (theoretical part), simulation of problems solutions (practical part) and tests. The idea is not to focus on few specific features, but to support a variety of topics in assignments that join both theoretical and practical aspects of the subject. The content should be understandable for the MSc students with very practical approach to the subject. The topics of the course included understanding concept and operation of quantum gates and registers as well as quantum computation; understanding entanglement; knowledge of the most important quantum algorithms: Deutsch Problem [9], Bernstein-Vazirani Problem [6], Grover’s Fast Database Search Algorithm [12], Shor’s Prime Factorization Algorithm [26], Quantum Teleportation [5] and Quantum Dense Coding [19]. For the theoretical part, we have used concepts from examples available on the web [18]. However, for the practical part, although many simulators exists, none of them was actually sufficient. At the beginning, students were asked to work using the libquantum library [8]; thanks to its lightweight implementation and wide functionality it was possible to cover all the above listed topics. However, this library turned out not to be very user–friendly due to quite low level way of programming and textual interface without possibility to graphically create quantum circuits. This was the motivation to create our own simulator that would satisfy all the requirements.
4
Overview of QuIDE Quantum Computing Simulator
For supporting practical assignments for our course, we have proposed and implemented the Quantum Integrated Development Environment (QuIDE), presented in our paper [23], that supports learning, understanding and analyzing quantum algorithms. Firstly, the simulator should be understandable for a typical computer science student with a basic knowledge of quantum information and computation theory. It should be universal to cover all the course topics and include a set of examples for the topics, not only the simple ones, but also the most important quantum algorithms such as Shor’s Factoring algorithm [26] and Grover’s Database Search [12]. These algorithms are too complex to be implemented by students from scratch during a one semester course. Additionally, students should be able to follow the steps of the example algorithms in a reasonable time on the standard PCs in the laboratory. The main functional requirements of the simulator are: providing and managing elementary quantum gates and quantum registers, supporting gates grouping in more complex blocks, performing actual computations, building custom computation subroutines out of the elementary gates, combining quantum and classical computations, previewing of the internal state of the simulated quantum system (which is not possible on real quantum systems) and its stepby step execution. Moreover, QuiDE should combine features of GUI-based simulators (for drawing quantum circuits) with interpreters and simulation libraries (for flexibility in writing 1726
Rycerz, et. al
Figure 1: The main modules of the QuIDE simulator architecture joining GUI, interpreter and simulation library approaches.
algorithms and combining them with classical code). Last but, not least, the simulator has to be easy to obtain, to install and to run on computer labs and on students PCs or laptops. Figure 1 shows how the main modules of the QuIDE architecture allow to combine approach of GUI-based simulators with interpreters and simulation libraries. One of the main modules of the QuIDE is the Interactive Circuit Designer that supports construction of quantum circuits and their step-by-step execution. The internal quantum state is presented in the Quantum State Preview during the simulation runtime. Users preferring interpreter approach can use Code Editor that enables the user to program the simulations using quantum and classical operations. The output of the code execution is shown in the Console Output window. Additionally, the user is able to switch between the source code and the graphical circuit at any time of the designing process. Both graphical and interpreter mode is supported by QuIDE Simulation Library with defined API that can be also used standalone. The GUI screenshot of the simulator showing the Circuit Designer, Code Editor and Quantum State Preview modules in action is shown in Figure 2. To fulfill both GUI and the core simulation module requirements we decided to choose one of the most robust technologies which support both rich GUI design and complex numerical computations – the Microsoft .NET Framework. The QuIDE core simulation library, QuIDE.dll, is thus a standalone C# library. The GUI-based QuIDE simulator follows Model View ViewModel (MVVM) architectural design pattern and is a desktop application using WPF Windows Presentation Foundation framework [27]). The full design of the simulator is described in [23]. 1727
Rycerz, et. al
Figure 2: The Graphical User Interface of the QuIDE simulator with main componenents: Code Editor, Circuit Designer and Quantum State Preview.
5
Using QuIDE in the course
The course consisted of six different sessions; at each session students were first asked to solve mathematical assigments and then verify the results using the simulator. Below, we present how QuIDE was used during these sessions. Introduction to quantum computing. This session covers basic aspects required understanding quantum computation: review of basic knowledge from algebra (linear spaces, vectors, matrices, complex numbers), as well as introduction to basic issues needed to understand quantum computation such as features of Pauli matrices, features of unitary matrices, Hermitian adjoint, Dirac notation or tensor product. This session is realized by solving and discussing simple assignments covering aforementioned aspects. Quantum registers and gates; entanglement. This session involves experimenting with QuIDE simulator: building simple circuits with usage of basic quantum gates and comparing their simulated behavior with theoretical expectations. The more demanding assignment is to produce entangled state. Usage of the simulator helps with understanding the basics of the idea of quantum entanglement. Quantum computation This session is devoted to understanding quantum computations on two problems: Deutsch Problem [9] and Bernstein-Vazirani Problem [6]. Students are asked to build a quantum circuits solving these problems and to compare their flow with classical solutions. As a result they observe the advantage of using quantum computer over the classical one. Grover’s algorithm This session covers the understanding of Grover’s Fast Database Search Algorithm [12]. First, the students are asked to solve theoretical assignments for a simple case 1728
Rycerz, et. al
(two qbit register). Next, they are asked to simulate their solution using QuIDE. Finally, they are asked to simulate and analyse the behavior of a full Grover’s algorithm. As a result they observe how the actual (lower then classical) complexity of the quantum search in an unsorted base is obtained. Shor’s Factorization This session is devoted to understanding Shor’s Prime Factorization Algorithm [26], The students are asked to run the algorithm step by step in QuIDE simulator and to observe internal changes in the registers of quantum computers. Additionally, they are asked to use the Shor’s algorithm in the RSA encryption/ decryption with example small keys. As the result, the students observe and understand the outcome of the particular steps of Shors’ algorithm on the example and they also learn how quantum factorization is used in RSA encryption/decryption. Quantum transmission of information The last session covers various aspects of transporting information using quantum entanglement namely the Quantum Teleportation [5] and the Quantum Dense Coding [19] protocols. The students are asked to simulate both protocols using QuIDE. As the result, they learn how these protocols work. The summary of particular QuIDE features and their usage is shown in Table 1. Table 1: Usage of QuIDE features during the course. QuIDE feature Basic quantum gates and registers
Previewing of the internal state of the simulated quantum system
Graphical circuit designer
Simple switching between visual circuits and their code representation Building complex gates from simple ones Combining quantum and classical computation
6
Usage Understanding the difference between classical computer and quantum computer. Verification of simple theoretical assignments Observation of a state change during quantum computation and running various algorithms and to verify theoretical calculations. Of course, this feature would not possible on real quantum computer due to the fact that learning (measuring) the state destroys it. Visual building of quantum circuits; for most exercises, it is easier to visually build a circuit then to code it using the library API. Useful when students first build basic blocks which are later used in a more complex algorithm or in a classic code (e.g. in a loop) Useful in more complex algorithms like Shor’s factorization or Grover’s search, Especially useful for Shor’s algorithm that consists of a classical and a quantum part
Assessment of the QuIDE
The usability of QuIDE was evaluated and compared to libquantum using the System Usability Scale (SUS) surveys [7]. The questions in the survey are presented in Table 2. The students were asked to answer to what extent they agree with the given statements in 0 to 4 scale, where 0 means ‘I strongly disagree’ and 4 means ‘I strongly agree’. The results from questions 2, 4, 6, 8 and 10 had to be reversed, because in these questions the lowest answer meant the best usability. 1729
Rycerz, et. al
Table 2: Students survey questions. 1 2 3 4 5 6 7 8 8 10 11 12
I I I I I I I I I I I I
think that I would like to use this system frequently found the system unnecessarily complex thought the system was easy to use think that I would need the support of a technical person to be able to use this system found the various functions in this system were well integrated thought there was too much inconsistency in this system would imagine that most people would learn to use this system very quickly found the system very cumbersome to use felt very confident using the system needed to learn a lot of things before I could get going with this system think that the system make it easier to understand the quantum computations think that the system is a good tool to design and analyze quantum algorithms
The results of the survey conducted at the beginning of the course are presented in Figure 3. QuIDE scored better than libquantum in every question, averagely by 1 point. It is a satisfying
Figure 3: Results of the initial SUS survey. The figure shows the average score obtained for each question, with their standard deviation. The scores ranges from 0 (the worst rate) to 4 (the best). The ratings are received from a group of 31 students. result because libquantum is a powerful simulation tool with extensive and simple API, as well as having a good documentation. Figure 4 compares the usability surveys of QuIDE conducted at the beginning and at the end of the course. In the second survey, the students were asked to answer the same questions about the usability of QuIDE as in the initial SUS survey. The results of the second survey were slightly worse. The biggest decrease can be noticed for the first question. This result was expected, since the course was ending and the students apparently did not plan to work with quantum computer simulators in the near future. Figure 5 presents the summarized results of SUS surveys. In the second survey, QuIDE performed worse than in the first, but it is still better than libquantum. The simulator was validated by executing various examples of different algorithms and by comparing outputs produced by the simulator with theoretical ones. All the examples as well 1730
Rycerz, et. al
Figure 4: Results of the second SUS survey. The figure shows the average score obtained for each question, with their standard deviation. The scores ranges from 0 (the worst rate) to 4 (the best). The answers are collected from a group of 57 students.
Figure 5: The average total SUS score achieved by libquantum and QuIDE in the two SUS surveys. The figure shows the average scores and their standard deviations. Results were obtained by summing the scores for all 12 questions and scaling the result to range from 0 (the worst) to 100 (the best).
as solutions of the assignments given to the students were precisely checked beforehand. The small bugs of the simulator were reported by the students on-line and corrected imidiatelly after the report. The automatic update feature of the simulator allowed a convenient and fast update to a new version of the software. Apart from the SUS survey, the students were asked to describe the most useful features and also to suggest improvements. The most useful features depicted by students in the survey are: graphical interface and on-line switching between GUI and the code, step by step execution, support for a variety of different gates, support for building complex gates and gates grouping. These features agree with our assumption on main quantum computation specific 1731
Rycerz, et. al
QuIDE functionality described in Section 4. In contrast, the suggested improvements include: support for different operating systems, drag and drop in circuit designer, autofill and syntax highlighting, better documentation, more descriptive error messages. The students’ suggestions are of a more general nature of the usability and are not connected with the actual topic of the course. The work on the Quantum Simulator also resulted in two MSc theses at AGH University of Science and Technology in Krakow [22, 21] available on the Web2 .
7
Summary
In this paper, we described a new concept of the course on quantum computing for the IT students. The course joins two aspects: theoretical (based on lectures and assignments available on the web 3 ) and practical supported by the QuIDE quantum simulator, which was especially developed for that purpose. We described the features and the functionality of QuIDE and explained how they are used in education to help students understand a variety of topics on quantum computing. Our course do not focus on one aspect, but covers the most important variety of topics from quite simple Deutch problem to more complicated Shor’s factoring algorithm. Finally, we described results of QuIDE validation during the course. Our solution scored more points in System Usability Scale survey then the libquantum library previously used for that purpose. The most useful features asked by students in the survey are consistent with our assumptions concerning the main QuIDE functionality. The improvements suggested by students do not focus on the way the quantum computing is taught, but they are rather directed towards general usability (such as support for different operating systems, more advanced code editor features, syntax highlighting etc.) that could be extended in the future. Acknowledgements This study was partly supported by the AGH grant no 11.11.230.124 and by PLGrid Core project no POIG.02.03.00-12-137/13.
References [1] AGH University of Science and Technology, Syllabus: Module Matematyka w informatyce przyszlosci, MSc students, fall semester, 2012. [2] S. Aaronson and D. Gottesman. Improved simulation of stabilizer circuits. Phys. Rev. A, 70:052328, Nov 2004. [3] P. Belkner. Eqcs-0.0.8, Mar. 2012. Accessed May 10, 2014. [4] C. H. Bennett and G. Brassard. Quantum cryptography: Public key distribution and coin tossing. In Proceedings of IEEE International Conference on Computers, Systems, and Signal Processing, page 175, India, 1984. [5] C. H. Bennett, G. Brassard, C. Cr´epeau, R. Jozsa, A. Peres, and W. K. Wootters. Teleporting an unknown quantum state via dual classical and einstein-podolsky-rosen channels. Phys. Rev. Lett., 70:1895–1899, Mar 1993. [6] E. Bernstein and U. Vazirani. Quantum complexity theory. SIAM J. Comput., 26(5):1411–1473, Oct. 1997. [7] J. Brooke. SUS - A quick and dirty usability scale. In P. W. Jordan et al., editors, Usability Evaluation in Industry. Taylor and Francis, 1996. 2 http://dice.cyfronet.pl
3 http://www.lassp.cornell.edu/mermin/qcomp/CS483.html
1732
Rycerz, et. al [8] B. Butscher and H. Weimer. Simulation eines Quantencomputers, March 2003. [9] D. Deutsch. Quantum theory, the Church-Turing principle and the universal quantum computer. Royal Society of London Proceedings Series A, 400:97–117, July 1985. [10] R. Feynman and P. W. Shor. Simulating physics with computers. SIAM Journal on Computing, 26:1484–1509, 1982. [11] G. Griffiths, D. Stahlke, and A. Blum. ”Quantum Computation and Quantum Information Theory Course (Spring Term 2014) Physics Department, Carnegie Mellon University Department of Physics and Astronomy, University of Pittsburgh http://quantum.phys.cmu.edu/QCQI/ ”. [12] L. K. Grover. A fast quantum mechanical algorithm for database search. In STOC ’96: Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pages 212–219, New York, NY, USA, 1996. ACM Press. [13] J. Kempe. Quantum random walks - an introductory overview. Contemporary Physics, 44(4):302– 327, 2003. lanl-arXive quant-ph/0303081. [14] T. Lanting, A. J. Przybysz, A. Y. Smirnov, et al. Entanglement in a quantum annealing processor. Phys. Rev. X, 4:021041, May 2014. [15] E. Martin-Lopez, A. Laing, T. Lawson, R. Alvarez, X.-Q. Zhou, and J. O’Brien. Experimental realisation of shor’s quantum factoring algorithm using qubit recycling. In Lasers and Electro-Optics Europe (CLEO EUROPE/IQEC), 2013 Conference on and International Quantum Electronics Conference, pages 1–1, May 2013. [16] D. D. M. McMahon. Quantum computing explained. IEEE Computer Society, Hoboken, N.J. Wiley-Interscience, 2008. [17] D. Mermin. Phys481-681-CS483, Quantum Computation Lecture Notes and Homework Assignments Cornell, Spring 2006 http://www.lassp.cornell.edu/mermin/qcomp/CS483.html. [18] N. Mermin. Quantum Computer Science: An Introduction. Cambridge University Press, 2007. [19] M. A. Nielsen and I. L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, October 2000. ¨ [20] B. Omer. Quantum programming in qcl. Master’s thesis, Technical University of Vienna, Jan. 2000. [21] B. Patrzyk. Review, analysis and simulation of quantum algorithms in cryptography. Master of Science Thesis supervised by Katarzyna Rycerz; AGH University of Science and Technology, Krakow, Poland (September 2014). [22] J. Patrzyk. Graphical and programming support for simulations of quantum computations. Master of Science Thesis supervised by Katarzyna Rycerz; AGH University of Science and Technology, Krakow, Poland (September 2014). [23] J. Patrzyk, B. Patrzyk, K. Rycerz, and M. Bubak. Towards a novel environment for simulation of quantum computing. Computer Science Journal, to be printed. [24] S. Peter. 18.435J Quantum Computation, Fall 2003. (MIT OpenCourseWare: Massachusetts Institute of Technology), http://ocw.mit.edu/courses/mathematics/ 18-435j-quantum-computation-fall-2003 (Accessed 10 Dec, 2014). . [25] K. D. Raedt, K. Michielsen, H. D. Raedt, B. Trieu, G. Arnold, M. Richter, T. Lippert, H. Watanabe, and N. Ito. Massively parallel quantum computer simulator. Computer Physics Communications, 176(2):121 – 136, 2007. [26] P. W. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput., 26(5):1484–1509, Oct. 1997. [27] J. Smith. Wpf apps with the model-view-viewmodel design pattern. MSDN Magazine, Feb 2009. [28] H. Watanabe, M. Suzuki, and J. Yamazaki. QCAD, GUI environment for Quantum Computer Simulator, 2011. Accessed Sep 18, 2014.
1733