Quantum Registers and Basis Encoding
A quantum register is a collection of qubits treated as one system; basis encoding stores integers as computational basis states.
Grouping qubits
A quantum register is a set of qubits treated together as a single quantum system. An n-qubit register lives in a 2^n-dimensional space via the tensor product, and its computational basis states are labelled by n-bit binary strings.
Basis encoding
The simplest way to store data is basis encoding: represent the integer x by the computational basis state |x>. Three qubits can hold the integers 0 through 7 as |000> through |111>. This is the direct quantum analogue of a classical register, and it is how inputs are often loaded into an algorithm.
Superposition of data
The quantum advantage appears when a register holds a superposition of many values at once. Applying Hadamards to every qubit of |000> produces an equal superposition of all eight integers. A function evaluated on this register acts on all inputs simultaneously — the basis of quantum parallelism.
Endianness and ordering
Care is needed with bit ordering: registers may be written most-significant-qubit-first or last, and different frameworks differ. The mapping between an integer and its basis state must be fixed consistently, because gates that do arithmetic depend on it. This is a frequent source of bugs in circuit implementation.
Other encodings
Basis encoding is not the only option. Amplitude encoding packs a length-2^n data vector into the amplitudes of an n-qubit state, exponentially compact but hard to prepare and read. Angle encoding maps features to rotation angles. The choice of encoding strongly affects an algorithm's cost and is a key design decision in quantum machine learning and simulation.