Abstract analog register
RegisterResolver
An object to hold common functionalities for registers and resolving their layouts, transformations and checks.
resolve_from_model(model, device_settings, grid_scale_fn, grid_type_fn, directives_fn, register_transform_fn)
classmethod
Resolves the model's register data into actual platform appropriate and
validated data through platform's own functions. It is a generic and
modular helper function to be called by register.from_model
function.
PARAMETER | DESCRIPTION |
---|---|
model
|
The model to use and resolve its data
TYPE:
|
device_settings
|
The device settings instance
TYPE:
|
grid_scale_fn
|
Function used to check the grid scale against the device's
TYPE:
|
grid_type_fn
|
Function used to check the grid type against the device's
TYPE:
|
directives_fn
|
Function used to check the directives against the device's
TYPE:
|
register_transform_fn
|
Function used to transform coordinates into register on appropriate layout
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RegisterLayout
|
A register data with appropriate layout |
Source code in qadence2_platforms/backends/_base_analog/register.py
RegisterTransform(device_settings, grid_transform, grid_scale=1.0, coords=None, num_qubits=None)
Transforms register data according to the grid_type
in the qadence2_ir.types.Model
PARAMETER | DESCRIPTION |
---|---|
grid_transform
|
literal str to choose which grid transform to use. Accepted values are "linear", "triangular" or "square". If None is provided, it will default to "triangular"
TYPE:
|
grid_scale
|
scale of the grid. Default is
TYPE:
|
coords
|
list of coordinates as qubit positions in an int
grid, e.g.
TYPE:
|
num_qubits
|
number of qubits as integer. Default is
TYPE:
|
device_settings
|
Device settings object
TYPE:
|
Source code in qadence2_platforms/backends/_base_analog/register.py
get_calibrated_layout(layout_name)
classmethod
Gets the calibrated layout for the given layout_name
according to AnalogDevice
specifications.
PARAMETER | DESCRIPTION |
---|---|
layout_name
|
the name of the layout.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RegisterLayout
|
The |
Source code in qadence2_platforms/backends/_base_analog/register.py
invalid_grid_value()
classmethod
Fallback function for invalid grid_transform
value.
linear_coords()
Transforms coordinates into linear coordinates.
RETURNS | DESCRIPTION |
---|---|
ndarray
|
np.ndarray of transformed coordinates. |
square_coords()
Transforms coordinates into square coordinates.
RETURNS | DESCRIPTION |
---|---|
ndarray
|
np.ndarray of transformed coordinates |
Source code in qadence2_platforms/backends/_base_analog/register.py
triangular_coords()
Transforms coordinates into triangular coordinates.
RETURNS | DESCRIPTION |
---|---|
ndarray
|
np.ndarray of transformed coordinates |