Skip to content

Quantum registers

In Qadence, quantum programs can be executed by specifying the layout of a register of resources as a lattice. Built-in Register types can be used or constructed for arbitrary topologies. Common register topologies are available and illustrated in the plot below.

2023-10-16T14:58:14.346418 image/svg+xml Matplotlib v3.7.3, https://matplotlib.org/

Building and drawing registers

Built-in topologies are directly accessible in the Register:

from qadence import Register

reg = Register.honeycomb_lattice(2, 3)
reg.draw(show=False)
2023-10-16T14:58:14.496314 image/svg+xml Matplotlib v3.7.3, https://matplotlib.org/

Arbitrarily shaped registers can be constructed by providing coordinates.

Registers defined from coordinates

Register constructed via the from_coordinates method do not define edges in the connectivity graph.

import numpy as np
from qadence import Register

reg = Register.from_coordinates(
    [(x, np.sin(x)) for x in np.linspace(0, 2*np.pi, 10)]
)

reg.draw(show=False)
2023-10-16T14:58:14.535823 image/svg+xml Matplotlib v3.7.3, https://matplotlib.org/

Units for qubit coordinates

Qubits coordinates in Qadence are dimensionless but converted to the required unit when executed on a backend. For instance, Pulser uses \(\mu \textrm{m}\).

Connectivity graphs

Register topology is often asssumed in simulations to be an all-to-all qubit connectivity. When running on real devices that enable the digital-analog computing paradigm, qubit interaction must be specified either by specifying distances between qubits, or by defining edges in the register connectivity graph.

It is possible to access the abstract graph nodes and edges to work with if needed as in the perfect state transfer example.

from qadence import Register

reg = Register.rectangular_lattice(2,3)
reg.nodes = NodeView((0, 1, 2, 3, 4, 5))
reg.edges = EdgeView([(0, 2), (0, 1), (1, 3), (2, 4), (2, 3), (3, 5), (4, 5)])

It is possible to customize qubit interaction through the add_interaction method. In that case, Register.coords are accessible from the concrete graph:

print(f"{reg.coords = }")
reg.coords = {0: (0.0, 0.0), 1: (0.0, 1.0), 2: (1.0, 0.0), 3: (1.0, 1.0), 4: (2.0, 0.0), 5: (2.0, 1.0)}

More details about their usage in the digital-analog paradigm can be found in the digital-analog basics section.