quantify_scheduler.backends.circuit_to_device

Compilation backend for quantum-circuit to quantum-device layer.

Module Contents

Classes

OperationCompilationConfig

A datastructure containing the information required to compile an individual

DeviceCompilationConfig

A datastructure containing the information required to compile a

Functions

compile_circuit_to_device(...)

Adds the information required to represent operations on the quantum-device

set_pulse_and_acquisition_clock(...)

Ensures that each pulse/acquisition-level clock resource has either been added

_compile_multiplexed(operation, qubits, ...)

_compile_single_qubit(operation, qubit, ...)

_compile_two_qubits(operation, qubits, operation_type, ...)

_add_device_repr_from_cfg(operation, operation_cfg)

_add_device_repr_from_cfg_multiplexed(operation, ...)

class OperationCompilationConfig[source]

Bases: quantify_scheduler.structure.DataStructure

A datastructure containing the information required to compile an individual operation to the representation at the device level.

Parameters:
  • factory_func – A callable designating a factory function used to create the representation of the operation at the quantum-device level.

  • factory_kwargs – a dictionary containing the keyword arguments and corresponding values to use when creating the operation by evaluating the factory function.

  • gate_info_factory_kwargs – A list of keyword arguments of the factory function for which the value must be retrieved from the gate_info of the operation.

factory_func: Union[Callable, str][source]
factory_kwargs: Dict[str, Any][source]
gate_info_factory_kwargs: Optional[List[str]][source]
class DeviceCompilationConfig[source]

Bases: quantify_scheduler.structure.DataStructure

A datastructure containing the information required to compile a schedule to the representation at the quantum-device layer.

Parameters:
  • backend – a . separated string specifying the location of the compilation backend this configuration is intended for e.g., compile_circuit_to_device().

  • clocks – a dictionary specifying the clock frequencies available on the device e.g., {"q0.01": 6.123e9}.

  • elements – a dictionary specifying the elements on the device, what operations can be applied to them and how to compile them.

  • edges – a dictionary specifying the edges, links between elements on the device to which operations can be applied, the operations tha can be applied to them and how to compile them.

backend: str[source]
clocks: Dict[str, float][source]
elements: Dict[str, Dict[str, OperationCompilationConfig]][source]
edges: Dict[str, Dict[str, OperationCompilationConfig]][source]
compile_circuit_to_device(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Optional[Union[DeviceCompilationConfig, dict]] = None) quantify_scheduler.schedules.schedule.Schedule[source]

Adds the information required to represent operations on the quantum-device abstraction layer to operations that contain information on how to be represented on the quantum-circuit layer.

Parameters:
  • schedule – The schedule to be compiled.

  • device_cfg – Device specific configuration, defines the compilation step from the quantum-circuit layer to the quantum-device layer description. Note, if a dictionary is passed, it will be parsed to a DeviceCompilationConfig.

set_pulse_and_acquisition_clock(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Optional[Union[DeviceCompilationConfig, dict]] = None) quantify_scheduler.schedules.schedule.Schedule[source]

Ensures that each pulse/acquisition-level clock resource has either been added to the schedule or, if present in device_cfg, adds it to the schedule. A warning is given when a clock resource has conflicting frequency definitions, and an error is raised if the clock resource is unknown.

Parameters:
  • schedule – The schedule to be compiled.

  • device_cfg – Device specific configuration, defines the compilation step from the quantum-circuit layer to the quantum-device layer description. Note, if a dictionary is passed, it will be parsed to a DeviceCompilationConfig.

Warns:

RuntimeWarning – When clock has conflicting frequency definitions.

Raises:
  • RunTimeError – When operation is not at pulse/acquisition-level.

  • ValueError – When clock frequency is unknown.

  • ValueError – When clock frequency is NaN.

_compile_multiplexed(operation, qubits, operation_type, device_cfg)[source]
_compile_single_qubit(operation, qubit, operation_type, device_cfg)[source]
_compile_two_qubits(operation, qubits, operation_type, device_cfg)[source]
_add_device_repr_from_cfg(operation: quantify_scheduler.operations.operation.Operation, operation_cfg: OperationCompilationConfig)[source]
_add_device_repr_from_cfg_multiplexed(operation: quantify_scheduler.operations.operation.Operation, operation_cfg: OperationCompilationConfig, mux_idx: int)[source]
exception ConfigKeyError(kind, missing, allowed)[source]

Bases: KeyError

Custom exception for when a key is missing in a configuration file.

Initialize self. See help(type(self)) for accurate signature.

exception MultipleKeysError(operation, matches)[source]

Bases: KeyError

Custom exception for when symmetric keys are found in a configuration file.

Initialize self. See help(type(self)) for accurate signature.