Skip to content

Results are limited to Pulser v1.3.0

Product news
You are reading Pulser v1.3.0, an older version of this documentation. Go to the latest version (v1.10.0)

Register3D

class pulser.register.Register3D(qubits, **kwargs)

Bases: BaseRegister, RegDrawer

A 3D quantum register containing a set of qubits.

Parameters:

qubits (Mapping[Any, ArrayLike | pm.TensorLike]) – Dictionary with the qubit names as keys and their position coordinates (in μm) as values (e.g. {‘q0’:(2, -1, 0), ‘q1’:(-5, 10, 0), …}).

Attributes

dimensionality

The dimensionality of the coordinates (2 or 3).

layout

The layout used to define the register.

qubit_ids

The qubit IDs of this register.

qubits

Dictionary of the qubit names and their position coordinates.

sorted_coords

The sorted coordinates.

Methods

coords_hex_hash

Returns the idempotent hash of the coordinates.

cubic

Initializes the register with the qubits in a cubic array.

cuboid

Initializes the register with the qubits in a cuboid array.

define_detuning_map

Defines a DetuningMap for some qubits of the register.

draw

Draws the entire register.

find_indices

Computes indices of qubits.

from_abstract_repr

Deserialize a 3D register from an abstract JSON object.

from_coordinates

Creates the register from an array of coordinates.

to_2D

Converts a Register3D into a Register (if possible).

to_abstract_repr

Serializes the register into an abstract JSON object.

Signatures

coords_hex_hash()

Returns the idempotent hash of the coordinates.

Returns:

An hexstring encoding the hash.

Return type:

str

Note

This hash will be returned as an hexstring without the ‘0x’ prefix (unlike what is returned by ‘hex()’).

classmethod cubic(side, spacing=4.0, prefix=None)

Initializes the register with the qubits in a cubic array.

Parameters:
  • side (int) – Side of the cube in number of qubits.

  • spacing (float | TensorLike, default: 4.0) – The distance between neighbouring qubits in μm.

  • prefix (str | None, default: None) – The prefix for the qubit ids. If defined, each qubit id starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …).

Return type:

Register3D

Returns:

A 3D register with qubits placed in a cubic array.

classmethod cuboid(rows, columns, layers, spacing=4.0, prefix=None)

Initializes the register with the qubits in a cuboid array.

Parameters:
  • rows (int) – Number of rows.

  • columns (int) – Number of columns.

  • layers (int) – Number of layers.

  • spacing (float | TensorLike, default: 4.0) – The distance between neighbouring qubits in μm.

  • prefix (str | None, default: None) – The prefix for the qubit ids. If defined, each qubit id starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …)

Return type:

Register3D

Returns:

A 3D register with qubits placed in a cuboid array.

define_detuning_map(detuning_weights, slug=None)

Defines a DetuningMap for some qubits of the register.

Parameters:
  • detuning_weights (Mapping[str, float]) – A mapping between the IDs of the targeted qubits and detuning weights (between 0 and 1).

  • slug (str | None, default: None) – An optional identifier for the detuning map.

Return type:

DetuningMap

Returns:

A DetuningMap associating detuning weights to the trap coordinates of the targeted qubits.

draw(with_labels=False, blockade_radius=None, draw_graph=True, draw_half_radius=False, qubit_colors={}, projection=False, fig_name=None, kwargs_savefig={})

Draws the entire register.

Parameters:
  • with_labels (bool, default: False) – If True, writes the qubit ID’s next to each qubit.

  • blockade_radius (float | None, default: None) – The distance (in μm) between atoms below the Rydberg blockade effect occurs.

  • draw_half_radius (bool, default: False) – Whether or not to draw the half the blockade radius surrounding each atoms. If True, requires blockade_radius to be defined.

  • draw_graph (bool, default: True) – Whether or not to draw the interaction between atoms as edges in a graph. Will only draw if the blockade_radius is defined.

  • qubit_colors (Mapping[str, str], default: {}) – By default, atoms are drawn with a common default color. If this parameter is present, it replaces the colors for the specified atoms. Non-specified ones are stilled colored with the default value.

  • projection (bool, default: False) – Whether to draw a 2D projection instead of a perspective view.

  • fig_name (str | None, default: None) – The name on which to save the figure. If None the figure will not be saved.

  • kwargs_savefig (dict, default: {}) – Keywords arguments for matplotlib.pyplot.savefig. Not applicable if fig_name is None.

Return type:

None

Note

When drawing half the blockade radius, we say there is a blockade effect between atoms whenever their respective circles overlap. This representation is preferred over drawing the full Rydberg radius because it helps in seeing the interactions between atoms.

find_indices(id_list)

Computes indices of qubits.

This can especially be useful when building a Pulser Sequence with a parameter denoting qubits.

Example

Let reg be a register with qubit Ids “a”, “b” and “c”:

>>> reg.find_indices(["a", "b", "c", "a"])

It returns [0, 1, 2, 0], following the qubit order of the register.

Then, it is possible to use these indices when building a sequence, typically by assigning them to an array of variables that can be provided as an argument to target_index and phase_shift_index.

Parameters:

id_list (Sequence[str]) – IDs of the qubits to find.

Return type:

list[int]

Returns:

Indices of the qubits to denote, only valid for the given mapping.

static from_abstract_repr(obj_str)

Deserialize a 3D register from an abstract JSON object.

Parameters:

obj_str (str) – the JSON string representing the register encoded in the abstract JSON format.

Return type:

Register3D

classmethod from_coordinates(coords, center=True, prefix=None, labels=None, **kwargs)

Creates the register from an array of coordinates.

Parameters:
  • coords (ArrayLike | pm.TensorLike) – The coordinates of each qubit to include in the register.

  • center (bool, default: True) – Whether or not to center the entire array around the origin.

  • prefix (Optional[str], default: None) – The prefix for the qubit ids. If defined, each qubit id starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …).

  • labels (Optional[abcSequence[QubitId]], default: None) – The list of qubit ids. If defined, each qubit id will be set to the corresponding value.

Return type:

T

Returns:

A register with qubits placed on the given coordinates.

to_2D(tol_width=0.0)

Converts a Register3D into a Register (if possible).

Parameters:

tol_width (float, default: 0.0) – The allowed transverse width of the register to be projected.

Return type:

Register

Returns:

Returns a 2D register with the coordinates of the atoms in a plane, if they are coplanar.

Raises:

ValueError – If the atoms are not coplanar.

to_abstract_repr()

Serializes the register into an abstract JSON object.

Return type:

str

property dimensionality: int

The dimensionality of the coordinates (2 or 3).

property layout: RegisterLayout | None

The layout used to define the register.

property qubit_ids: tuple[str, ...]

The qubit IDs of this register.

property qubits: dict[str, AbstractArray]

Dictionary of the qubit names and their position coordinates.

property sorted_coords: ndarray

The sorted coordinates.