books book reviews

quantum computer programming books

reviewed by T. Nelson

Score+2

Programming Quantum Computers:
Essential Algorithms and Code Samples

by ER Johnston, N Harrigan, M Gimeno-Segovia
O'Reilly, 2019, 317 pages
reviewed by T. Nelson

B esides generating random numbers, using up the world's supply of helium, and putting your computer in a crashed and non-crashed state simultaneously, what do you do with a quantum computer . . . early in the morning?

A qubit is actually pretty simple: it's a bit that can be in two states simultaneously and can be quantum entangled with other bits. The books by Nielsen and Chuang and by Bouwmeester et al. cover the science, and even Wikipedia has a good, easy-to-understand article on qubits.

This is one of a new bunch of books that describe how to actually program them, and what they're actually good for. It's written for programmers, and the computer part is pretty easy for anyone who's ever done bit-flipping and conventional programming. They walk through primitive qubit operations like CNOT, PHASE, and HAD (short for Hadamard operation), then work up to applications like factoring, machine learning, and quantum searching. Current quantum computers have only a handful of bits, and they're not yet 100% reliable, so these are only demonstrations.

The authors invent a circle diagram notation to help you visualize the qubits graphically, but it's incredibly confusing: instead of representing an actual qubit, the diagram represents each state as a separate circle, so sometimes a qubit has one, sometimes two circles. They also contain redundant information, so you never get a good concept of what the qubits are doing. It would've been better to show them as Bloch spheres. After the first few chapters I just ignored all the circle diagrams.

Qubits
Circle diagram of four qubits from page 45

Most of their pro­grams are writ­ten in Java­Script and can be run on the authors' online quantum computer simulator. If you ever used a real quantum computer, you'd use something like QCL that's more like assembler. IBM has an online quantum computer and a tutorial here which uses a different language, so I wouldn't get too attached to the authors' JavaScript. Even Microsoft has something they call Q sharp (Q#, no doubt soon to be Visual Q-sharp).

To get anywhere in quantum computing, you'll need a firm understanding of what qubits do. For that, you'll need some other book. Reading this one will let you say you've worked on a quantum computer and give you an overview of what it's all about. But I found after reading it that I was in a superposed state of confusion and non-confusion.

With quantum computing you could write a program that's simultaneously a killer app and not a killer app. Or one that gives you both the right and wrong answers. Accounting software that simultaneously shows a profit and a loss. Oh, the jokes just write themselves. They are funny and yet also not funny.

jan 12 2020