liveBook · Manning

Control qubit

As explained in Building Quantum Software with Python

A control qubit is a qubit whose state conditionally determines whether or how a controlled quantum operation acts on another qubit.

A control qubit conditionally determines whether a gate acts on a target qubit. In a state array, the gate recombines only amplitude pairs whose control positions contain 1; pairs with 0 remain unchanged. section 4.4 section 4.6

Use the control position to reason about controlled transformations:

  • Find outcome pairs that differ only at the target position. section 4.4
  • Keep only pairs whose control-bit positions contain 1. section 4.4
  • Apply the gate formula to each selected pair; a controlled X swaps the selected amplitudes. section 4.4
  • Add more controls by requiring every control position to contain 1. section 4.4.2

Python controlled transformation

A simulator can filter the pairs generated for target t with is_bit_set(p[0], c), then process each surviving pair. Calling c_transform(state, 1, 2, x) swaps outcomes 2 and 6, and outcomes 3 and 7. With controls [1, 2] and target 0, only outcomes 6 and 7 are swapped. section 4.4.1 section 4.4.2

Figure 4.25 The pairs of outcomes for applying a controlled single-qubit gate to a three-qubit system with target qubit 0 and control qubit 2
figure

Use the outcome-pair diagram to see how target position and control position select the amplitude pairs processed by a controlled gate. section 4.4

How Building Quantum Software with Python covers it

How deep it goes
Descends to bit tests, pair filtering, amplitude updates, and multicontrol code, while stopping short of physical implementation details.
Examples
Uses three-qubit state diagrams, controlled X swaps, Python simulator functions, and a multicontrolled transformation example.
What it assumes
Assumes qubit amplitudes, binary outcome positions, single-qubit gates, and target qubits while developing their circuit-level combination.
What you can do after
Build controlled and multicontrolled gate operations in a Python state-vector simulator.
How it connects
Connects controlled transformations with target qubits, quantum gates, amplitude pairs, quantum circuits, registers, and quantum parallelism.

Also explained in

Compare how 2 books explain control qubit →

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.