Book Image

Mastering Quantum Computing with IBM QX

By : Dr. Christine Corbett Moran
Book Image

Mastering Quantum Computing with IBM QX

By: Dr. Christine Corbett Moran

Overview of this book

<p>Quantum computing is set to disrupt the industry. IBM Research has made quantum computing available to the public for the first time, providing cloud access to IBM QX from any desktop or mobile device. Complete with cutting-edge practical examples, this book will help you understand the power of quantum computing in the real world.</p> <p>Mastering Quantum Computing with IBM QX begins with the principles of quantum computing and the areas in which they can be applied. You'll explore the IBM Ecosystem, which enables quantum development with Quantum Composer and Qiskit. As you progress through the chapters, you'll implement algorithms on the quantum processor and learn how quantum computations are actually performed.</p> <p>By the end of the book, you will completely understand how to create quantum programs of your own, the impact of quantum computing on your business, and how to future-proof your programming career.</p>
Table of Contents (22 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Using Qiskit to generate quantum circuits


Qiskit is the Quantum Information Science Kit. It is an SDK for working with the IBM QX quantum processors. It also has a variety of tools to simulate a quantum computer in Python. It is so important and useful it will get its own chapter later in this book. In this chapter, we are going to learn to use it to generate quantum circuits.

Single-qubit circuits in Qiskit

First, let's import the tools to create classical and quantum registers as well as quantum circuits from qiskit:

from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister

Next let's make the X |"0"> circuit using qiskit:

qr = QuantumRegister(1)
circuit = QuantumCircuit(qr)
circuit.x(qr[0])

Note that the argument to QuantumRegister is 1; this indicates that the quantum register is to contain one qubit. 

The XH|"0"> circuit using qiskit becomes the following:

qr = QuantumRegister(1)
circuit = QuantumCircuit(qr)
circuit.h(qr[0])
circuit.x(qr[0])

Qiskit's QuantumCircuit class and...