liveBook · Manning

Selection register

As explained in Building Quantum Software with Python

A selection register is a quantum register whose qubits encode whether corresponding items are included in a selection.

A selection register is a quantum register whose qubits encode item inclusion. Each qubit corresponds to one item: 1 includes it, while 0 excludes it. With three items, the register uses three qubits and represents every binary selection. section 2.3.1 section 10.1.2

Use the register as the key that connects selections to computed attributes:

  • Represent a selection such as 110 as a bitstring whose positions identify included items. section 2.3.1
  • Place the selection register in superposition with a Hadamard gate on each qubit to represent all possible selections. section 10.1.2 section 11.3.1
  • Use the selection qubits as controls while value and weight registers encode linear functions of the selection variables. section 10.1.2

Three-item knapsack

For items with values 2, 3, and 1 and weights 3, 2, and 1, a three-qubit selection register indexes eight combinations. The selection 011 corresponds to value 5 and weight 5; the associated value and weight registers encode those results. section 2.3.1 section 10.1.2

Figure 2.9 The register for encoding item selections. Each qubit corresponds to an item.
figure

A register diagram makes the one-qubit-per-item mapping visible before circuit construction. section 2.3.1

How Building Quantum Software with Python covers it

How deep it goes
Defines bit meanings and circuit preparation, then stops short of explaining the underlying encoding method in full.
Examples
Uses an eight-row three-item knapsack table, including selections 000, 011, and 111 with their values and weights.
What it assumes
Assumes binary variables and basic quantum-circuit registers, while teaching the item-to-qubit mapping directly.
What you can do after
Build it from scratch by preparing a selection superposition and using its qubits to encode value and weight functions.
How it connects
Connects quantum registers, binary variables, superposition, controlled phase rotations, value registers, weight registers, and the inverse quantum Fourier transform.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.