Device (Architecture)

Header: tweedledum/algorithms/utils/device.hpp

Data structure are essential to several mapping algorithms.

struct device

Data-structure for the architecture of a quantum device.

This data structure encapsulates the most essential properties of a physical quantum device used by our mapping algorithms. These are the number of qubits and an undirected coupling graph describing which pairs of qubits can interact with each other.

Public Functions

void add_edge(uint32_t v, uint32_t w)

Add an edge between two vertices.

Parameters
  • v: Vertice identifier

  • w: Vertice identifier

bit_matrix_rm get_coupling_matrix() const

Returns adjacency matrix of coupling graph.

uint32_t distance(uint32_t v, uint32_t u) const

Returns the distance between nodes v and u.

std::vector<std::vector<uint32_t>> get_distance_matrix() const

Returns distance matrix of coupling graph.

Public Members

std::vector<edge_type> edges

Pairs of qubit connections in the coupling graph.

uint32_t num_vertices_

Number of qubits.

std::vector<std::vector<uint32_t>> distance_matrix

Distance matrix (lazy)

Public Static Functions

static device path(uint32_t num_qubits)

Create a device for a path topology.

Parameters
  • num_qubits: Number of qubits

static device ring(uint32_t num_qubits)

Create a device for a ring topology.

Parameters
  • num_qubits: Number of qubits

static device star(uint32_t num_qubits)

Create a device for a star topology.

Parameters
  • num_qubits: Number of qubits

static device grid(uint32_t width, uint32_t height)

Create a device for a grid topology.

The device has width * height number of qubits.

Parameters
  • width: Width of the grid

  • height: Height of the grid

static device random(uint32_t num_qubits, uint32_t num_edges)

Creates a device with a random topology.

Parameters
  • num_qubits: Number of qubits

  • num_edges: Number of edges in coupling graph