2 Qubits: The building blocks

 

This chapter covers

  • Why random numbers are an important resource
  • What is a qubit?
  • What basic operations can we perform on a qubit?
  • Programming a quantum random number generator in Python

In this chapter, we’ll start to get our feet wet with some quantum programming concepts. The main concept we will explore is the qubit, the quantum analogue of a classical bit. We’ll use qubits as an abstraction or model to describe the new kinds of computing that are possible with quantum physics. Figure 2.1 shows a model of using a quantum computer as well as the simulator setup that we use in this book. Real or simulated qubits will live on the target machine and interact with the quantum programs that we will be writing! Those quantum programs can be sent by various host programs that then wait to receive the results from the quantum program.

Figure 2.1 A mental model for how we can use a quantum computer. The top half of the figure is the general model for a quantum computer. We will be using local simulators for this book, and the bottom half represents what we will be building and using.

To help learn about what qubits are and how we interact with them, we will use an example of how they are used today: random number generation. While we can build up much more interesting devices from qubits, the simple example of a quantum random number generator (QRNG) is a good way to get familiar with the qubit.

2.1 Why do we need random numbers?

2.2 What are classical bits?

2.2.1 What can we do with classical bits?

2.2.2 Abstractions are our friend

2.3 Qubits: States and operations

2.3.1 State of the qubit

2.3.2 The game of operations

2.3.3 Measuring qubits

2.3.4 Generalizing measurement: Basis independence

2.3.5 Simulating qubits in code

2.4 Programming a working QRNG

Summary

sitemap