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-11-13T15:12:00.218265 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-11-13T15:12:00.829693 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-11-13T15:12:00.939776 image/svg+xml Matplotlib v3.7.3, https://matplotlib.org/

Units for qubit coordinates

In general, Qadence makes no assumption about the units given to qubit coordinates. However, if used in the context of a Hamiltonian coefficient, the quantity \(H.t\) must be dimensionless for exponentiation in the PyQTorch backend, where it is assumed that \(\hbar = 1\) (consistent ). For registers passed to the Pulser backend, coordinates are in \(\mu \textrm{m}\).

Connectivity graphs

Register topology is often assumed in digital simulations to be an all-to-all qubit connectivity. When running on real devices that enable the digital-analog computing paradigm, qubit interactions 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.