Chapter 9. Real Data

Fully fledged QPU applications are built to operate on genuine, unaccommodating data. Real data won’t necessarily be as simple to represent as the basic integer inputs we’ve been satisfied with up until now. Thinking of how to represent more complex data within QPUs is thus well worth our effort, and a good data structure can be just as important as a good algorithm. This chapter sets out to answer two questions that we’ve previously sidestepped:

  1. How should we represent complicated data types in a QPU register? A positive integer can be represented with simple binary encoding. What should we do with irrational, or even compound types of data, such as a vectors or matrices? This question takes on more depth when considering that superposition and relative phase might allow entirely quantum ways of encoding such data types.

  2. How can we read stored data into a QPU register? So far we’ve been initializing our input registers by hand, using WRITE operations to manually set a register’s qubits to binary integers of interest. If we’re ever to employ quantum applications on large swathes of data we’ll need to read that data into QPU registers from memory. This is a nontrivial requirement as we may want to initialize a QPU register with a superposition of values—something that conventional RAM isn’t cut out for.

We’ll start by addressing the first of these questions. As we describe QPU representations for increasingly complex types of data, we’ll be led to introduce ...

Get Programming Quantum Computers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.