3 Implement quantum operations

 

This chapter covers

  • Implementing quantum operations based on their matrix notation
  • Using Q# and Qiskit to write more complicated quantum programs
  • Observing the matrix implemented by a quantum operation
  • Writing tests for validating quantum operations

As we’ve seen in the previous chapter, a typical quantum algorithm can be represented as a standard sequence of steps (see figure 3.1). In chapter 2, we’ve learned to implement the first step, preparing the quantum system in the given state.

Figure 3.1 Any quantum algorithm can be broken down into several steps: prepare the initial state, evolve it by applying unitary transformations, and measure the final state. In this chapter, we’ll learn to perform the second step, implementing unitary transformations as the algorithm dictates.
figure

In this chapter, we’ll focus on the second step: changing the state of the system using quantum operations. More specifically, we’ll learn to implement quantum operations that change the state of the system the way the algorithm requires.

What do we mean by “implementing” a quantum operation? Figure 3.2 shows how quantum algorithms are decomposed into simpler building blocks on multiple levels.

3.1 Implement a single-qubit gate

 
 
 
 

3.1.1 Math

 
 

3.1.2 Qiskit

 
 
 

3.1.3 Q#

 
 
 
 

3.2 What does your solution do?

 
 
 

3.2.1 Qiskit

 
 

3.2.2 Q#

 
 

3.3 Test your solution

 
 
 

3.3.1 Qiskit

 
 
 
 

3.3.2 Q#

 
 

3.4 Matrix decomposition

 

3.5 Implement a two-qubit block-diagonal unitary with \(2 \times 2\) blocks

 

3.5.1 Refresher: controlled gates in matrix notation

 
 

3.5.2 Math

 
 
 

3.5.3 Qiskit

 
 
 

3.5.4 Q#

 
 

3.6 Implement a two-qubit CS unitary

 
 
 
 

3.6.1 Math

 
 

3.6.2 Qiskit

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage