Skip to Content
Programming Quantum Computers
book

Programming Quantum Computers

by Eric R. Johnston, Nic Harrigan, Mercedes Gimeno-Segovia
July 2019
Intermediate to advanced content levelIntermediate to advanced
333 pages
8h 13m
English
O'Reilly Media, Inc.
Content preview from Programming Quantum Computers

Chapter 5. Quantum Arithmetic and Logic

QPU applications often gain an advantage over their conventional counterparts by performing a large number of logical operations in superposition.1

A key aspect of this is the ability to apply simple arithmetic operations on a qubit register in superposition. In this chapter, we will look in detail at how to do this. Initially, we’ll discuss arithmetic operations at the more abstracted level we’re used to in conventional programming, dealing with integers and variables rather than qubits and operations. But toward the end of the chapter we’ll also take a closer look at the logical operations making these up (akin to the elementary gates of digital logic).

Strangely Different

Conventional digital logic has plenty of well-optimized approaches for performing arithmetical operations—why can’t we just replace bits with qubits and use those in our QPU?

The problem, of course, is that conventional operations are expected to operate on a single set of inputs at a time, whereas we will often have input registers that are in superposition, for which we want quantum arithmetic operations to affect all values in the superposition.

Let’s start with a simple example demonstrating how we want logic to work on a superposition. Suppose we have three single-qubit QPU registers, a, b, and c, and we want to implement the following logic: if (a and b) then invert c. So if a is ∣1⟩ and b is ∣1⟩, then the value of c will be flipped. We saw in Figure 3-20 that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Quantum Computing Fundamentals

Quantum Computing Fundamentals

Chuck Easttom
Algorithms, 4th Edition

Algorithms, 4th Edition

Robert Sedgewick, Kevin Wayne

Publisher Resources

ISBN: 9781492039679Errata PageSupplemental Content