Coordinates Conversion#

class chimera_coordinates(m, n=None, t=None)[source]#

Provides coordinate converters for the chimera indexing scheme.

Parameters:
  • m (int) – The number of rows in the Chimera lattice.

  • n (int, optional (default m)) – The number of columns in the Chimera lattice.

  • t (int, optional (default 4)) – The size of the shore within each Chimera tile.

Examples

Convert between Chimera coordinates and linear indices directly

>>> coords = dnx.chimera_coordinates(16, 16, 4)
>>> coords.chimera_to_linear((0, 2, 0, 1))
17
>>> coords.linear_to_chimera(17)
(0, 2, 0, 1)

Construct a new graph with the coordinate labels

>>> C16 = dnx.chimera_graph(16)
>>> coords = dnx.chimera_coordinates(16)
>>> G = nx.Graph()
>>> G.add_nodes_from(coords.iter_linear_to_chimera(C16.nodes))
>>> G.add_edges_from(coords.iter_linear_to_chimera_pairs(C16.edges))

See also

chimera_graph()

Describes the various conventions.

class pegasus_coordinates(m)[source]#

Provides coordinate converters for the Pegasus indexing schemes.

Parameters:

m (int) – Size parameter for the Pegasus lattice.

See also

pegasus_graph()

Describes the various coordinate conventions.

class zephyr_coordinates(m, t=4)[source]#

Provides coordinate converters for the Zephyr indexing schemes.

Parameters:
  • m (int) – Grid parameter for the Zephyr lattice.

  • t (int) – Tile parameter for the Zephyr lattice; must be even.

See also

zephyr_graph()

Describes the various coordinate conventions.