Skip to content

Creating qubit registers

A Register defines the qubit resources to be used by a quantum program.

from qoolqit import Register

qubits = {
    0: (-0.5, -0.5),
    1: (-0.5, 0.5),
    2: (0.5, -0.5),
    3: (0.5, 0.5),
}

register = Register(qubits)
Register(n_qubits = 4)

It can be instantiated from a list of coordinates.

coords = [(-0.5, -0.5), (-0.5, 0.5), (0.5, -0.5), (0.5, 0.5)]

register = Register.from_coordinates(coords)

register.draw()
2025-06-26T15:13:32.448923 image/svg+xml Matplotlib v3.10.3, https://matplotlib.org/

The distances between all qubits can be directly accessed.

register.distances()
{(0, 1): 1.0, (1, 2): 1.4142135623730951, (0, 3): 1.4142135623730951, (2, 3): 1.0, (0, 2): 1.0, (1, 3): 1.0}

The minimum distance can be directly accessed.

register.min_distance()
1.0

The interaction coefficients \(1/r_{ij}^6\) can be directly accessed.

register.interactions()
{(0, 1): 1.0, (1, 2): 0.12499999999999994, (0, 3): 0.12499999999999994, (2, 3): 1.0, (0, 2): 1.0, (1, 3): 1.0}