Skip to main content

An open source quantum program simulator to be run locally with the Amazon Braket SDK

Project description

Amazon Braket Default Simulator

Latest Version Supported Python Versions Build status codecov Documentation Status

The Amazon Braket Default Simulator is a Python open source library that provides an implementation of a quantum simulator that you can run locally. You can use the simulator to test quantum tasks that you construct for the Amazon Braket SDK before you submit them to the Amazon Braket service for execution.

Setting up Amazon Braket Default Simulator Python

You must have the Amazon Braket SDK installed to use the local simulator. Follow the instructions in the README for setup.

Checking the version of the default simulator

You can check your currently installed version of amazon-braket-default-simulator with pip show:

pip show amazon-braket-default-simulator

or alternatively from within Python:

>>> from braket import default_simulator
>>> default_simulator.__version__

Usage

The quantum simulator implementations StateVectorSimulator and DensityMatrixSimulator plug into the LocalSimulator interface in Amazon Braket SDK, with the backend parameters as "braket_sv" and "braket_dm", respectively. Alternatively, to use StateVectorSimulator, you can instantiate LocalSimulator with no arguments or with backend="default":

Executing a circuit using the default simulator

from braket.circuits import Circuit
from braket.devices import LocalSimulator

device = LocalSimulator()

bell = Circuit().h(0).cnot(0, 1)
print(device.run(bell, shots=100).result().measurement_counts)

Documentation

Detailed documentation, including the API reference, can be found on Read the Docs

To generate the API Reference HTML in your local environment

First, install tox:

pip install tox

To generate the HTML, first change directories (cd) to position the cursor in the amazon-braket-default-simulator-python directory. Then, run the following command to generate the HTML documentation files:

tox -e docs

To view the generated documentation, open the following file in a browser: ../amazon-braket-default-simulator-python/build/documentation/html/index.html

Testing

If you want to contribute to the project, be sure to run unit tests and get a successful result before you submit a pull request. To run the unit tests, first install the test dependencies using the following command:

pip install -e "amazon-braket-default-simulator-python[test]"

To run the unit tests:

tox -e unit-tests

You can also pass in various pytest arguments to run selected tests:

tox -e unit-tests -- your-arguments

For more information, please see pytest usage.

To run linters and doc generators and unit tests:

tox

To run the performance tests:

tox -e performance-tests

These tests will compare the performance of a series of simulator executions for your changes against the latest commit on the main branch. Note: The execution times for the performance tests are affected by the other processes running on the system. In order to get stable results, stop other applications when running these tests.

License

This project is licensed under the Apache-2.0 License.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amazon_braket_default_simulator-1.38.1.tar.gz (200.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amazon_braket_default_simulator-1.38.1-py3-none-any.whl (242.4 kB view details)

Uploaded Python 3

File details

Details for the file amazon_braket_default_simulator-1.38.1.tar.gz.

File metadata

File hashes

Hashes for amazon_braket_default_simulator-1.38.1.tar.gz
Algorithm Hash digest
SHA256 17b62229a768c92e503b2d9e14d29bdea846a68cc74fcf5bf262d1a380ecb00b
MD5 86ac1c71fa71e0a78b804cbf8549d8cb
BLAKE2b-256 0fdc8e967337196fa9bd16d23742d9cfc5d7fae8b2b22d227d62bc24fe5b0388

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_default_simulator-1.38.1.tar.gz:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-default-simulator-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file amazon_braket_default_simulator-1.38.1-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_default_simulator-1.38.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33e0dd3096022295b531f9bdc1c2a87760be2655c657eb9851604ed4d31fdb44
MD5 8fc5d699d40bc878b57c9f9d8509e3c1
BLAKE2b-256 6eeb9c66f3c0d5f949d0de1cdb15fe65bf1e77a11e6ae15377e67290ff826b15

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_default_simulator-1.38.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-default-simulator-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page