braket.devices.braket_simulator module

class braket.devices.braket_simulator.BraketSimulator[source]

Bases: abc.ABC

An abstract simulator that locally runs a quantum task.

The task can be either a circuit-based program or an annealing task, specified by the given IR.

For users creating their own simulator: to register a simulator so the Braket SDK recognizes its name, the name and class must added as an entry point for “braket.simulators”. This is done by adding an entry to entry_points in the simulator package’s setup.py:

>>> entry_points = {
>>>     "braket.simulators": [
>>>         "backend_name = <backend_class>"
>>>     ]
>>> }
abstract run(ir: Union[braket.ir.jaqcd.program.Program, braket.ir.annealing.problem.Problem], *args, **kwargs) → Dict[str, Any][source]

Run the task specified by the given IR.

Extra arguments will contain any additional information necessary to run the task, such as number of qubits.

Parameters

ir (Union[Program, Problem]) – The IR representation of the program

Returns

Dict[str, Any] – A dict containing the results of the simulation. In order to work with braket-python-sdk, the format of the JSON dict should match that needed by GateModelQuantumTaskResult or AnnealingQuantumTaskResult from the SDK, depending on the type of task.