Basic Quantum Simulator

In this lesson, we put together everything we have learned so far and create a basic quantum computing simulator.

In the last chapter, we learned the representation for quantum states, gates, and operations in NumPy. Now, we shall put together all those pieces and create a basic quantum computing simulator that runs small quantum circuits. As stated at the beginning of the chapter, this exercise of creating our own quantum simulator from scratch cements the understanding of the underlying mathematics and principles of quantum computing before we formally begin our discussion of practical quantum algorithms.

Disclaimer: this exercise draws inspiration from one of the screening tasks for the third cohort of the QOSF Mentorship Program.

In the following subsections, we will be building the simulator one step at a time. We will be going through the various function definitions and will look at the solution at the end of this lesson.

Get hands-on with 1200+ tech skills courses.