braket.devices.local_simulator module¶
-
class
braket.devices.local_simulator.
LocalSimulator
(backend: Union[str, braket.devices.braket_simulator.BraketSimulator] = 'default')[source]¶ Bases:
braket.devices.device.Device
A simulator meant to run directly on the user’s machine.
This class wraps a BraketSimulator object so that it can be run and returns results using constructs from the SDK rather than Braket IR.
- Parameters
backend (Union[str, BraketSimulator]) – The name of the simulator backend or the actual simulator instance to use for simulation. Defaults to the “default” simulator backend name.
-
run
(task_specification: Union[braket.circuits.circuit.Circuit, braket.annealing.problem.Problem], shots: int = 0, *args, **kwargs) → braket.tasks.local_quantum_task.LocalQuantumTask[source]¶ Runs the given task with the wrapped local simulator.
- Parameters
shots (int, optional) – The number of times to run the circuit or annealing problem. Default is 0, which means that the simulator will compute the exact results based on the task specification. Sampling is not supported for shots=0.
*args – Positional args to pass to the IR simulator
**kwargs – Keyword arguments to pass to the IR simulator
- Returns
LocalQuantumTask – A LocalQuantumTask object containing the results of the simulation
Note
If running a circuit, the number of qubits will be passed to the backend as the argument after the circuit itself.
Examples
>>> circuit = Circuit().h(0).cnot(0, 1) >>> device = LocalSimulator("default") >>> device.run(circuit, shots=1000)
-
property
properties
¶ Properties of the LocalSimulator device
- Type
Dict[str, Any]