When you create a qubit register with the `qubits`

instruction a binary register is created with the same number of entries as the qubit register. As an example: `qubits 5`

creates a qubit register for 5 qubits PLUS a binary register with 5 entries.

The binary register is used to store the outcomes of qubit measurents, the so-called declared states. Declared states are always 0 or 1. The binary register is often referred to as the measurement register.

All entries in the binary register are initialized to zero.

Entries in the binary register can be used to control your quantum algorithm e.g. with binary controlled gates. The index used for addressing the qubit register and the binary register are identical. So, `q[0]`

corresponds to qubit 0 and `b[0]`

corresponds to the measurement outcome of measurements on `q[0]`

. When shown in histograms, the rightmost bit is for the measured qubit with the lowest index (q[0]). The leftmost bit is for the qubit with the highest index.

The measurement register is displayed as a binary string, following the convention that the least significant bit is the rightmost bit and the most significant bit is the leftmost bit. In practice, this means that the measurement result of qubit 0 is shown as the right-most bit. The measurement result of qubit 3 is shown as the third bit from the right.

` ````
version 1.0
qubits 2
H q[0]
measure q[0]
c-X b[0],q[1]
measure q[1]
```

q[0] | |||||
---|---|---|---|---|---|

q[1] |

which results in a histogram similar to this one (for a large number of shots):

A small note here: Although this may look like the two qubits are entangled, just like in a Bell state this is not the case. Here we have just created a classical correlation between the two qubit states.

The contents of the binary register can be written to the results file at any location in your algorithm using the `display_binary`

instruction. This instruction will also be forcefully added to the end of all algorithms to create the histogram data for your experiment.

Bits within the binary register can be inverted with a classical `NOT`

instruction.

Measurements can be done in various bases (z-basis, y-basis or x-basis). The correspondence between basis states and declared states is given in qubit basis states.