A value register is the output half of a quantum key–value encoding. Paired with a key register, it holds the integer output for each encoded input: measuring both registers returns an input together with its corresponding function value. With n key qubits and m value qubits, the registers represent up to 2^n inputs and 2^m output values. section 10.1 section 10.4
Choose the value-register width from the output range. For unsigned outputs, m qubits encode integers representable by m binary digits; negative outputs use Two’s Complement. If a register is too small, an encoded integer becomes its remainder modulo 2^m, so widths may need increasing when functions or constraint shifts enlarge the range. section 10.1 section 10.4 section 11.3.2
To encode a function into a value register:
- Create key and value registers, then place both in equal superposition. section 10.4
- Express the output as binary-variable terms when needed; represent polynomial terms as coefficient-and-variable tuples. section 10.1.3
- Apply phase rotations to value qubits, controlled by the key variables for each term. Multi-variable terms use multi-controlled phase gates; constant terms are uncontrolled. section 10.1.3
- Apply an inverse quantum Fourier transform (IQFT) to the value register to obtain output integers correlated with their keys. section 10.4
Binary-digit sum
For a three-qubit key, encode the function that counts 1 digits in the input. Its outputs run from 0 to 3, so a two-qubit value register suffices: 000 maps to 00, 011 maps to 10, and 111 maps to 11. Each key bit controls phase rotations on the value register; after the IQFT, the measurement outcomes form the desired key–value pairs. section 10.1.1
Figure 10.4 Grid visualization of the encoded function inputs (columns) and outputs (rows)
Inspect the grid as a function table: columns are key inputs, rows are value-register outputs, and populated cells show the encoded pairs. section 10.1.1
A value register can encode more than a single computed result. In knapsack search, separate value and weight registers attach total value and total weight to every item-selection key. Constraint shifts can make desired values nonnegative, allowing an oracle to recognize them by leading bits or by an all-zero value register. section 10.1.2 section 10.2 section 11.3.2
Encoding alone gives all valid input–output pairs equal measurement probability. Grover’s algorithm can then amplify pairs selected through value-register conditions, such as outputs in a range, negative outputs under Two’s Complement, or zeros of a polynomial. section 10.2 section 10.3
