Skip to main content

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

Project description

Amazon Braket Default Simulator

Latest Version Supported Python Versions Code Style: Black 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 DefaultSimulator

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 implementation DefaultSimulator plugs into the LocalSimulator interface in Amazon Braket SDK using the backend value as "default".

Executing a circuit using the DefaultSimulator

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

device = LocalSimulator("default")

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

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.

To run selected tests based on a key word in the test name:

tox -- -k 'keyword'

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

Built Distribution

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

File details

Details for the file amazon-braket-default-simulator-1.0.0.post2.tar.gz.

File metadata

  • Download URL: amazon-braket-default-simulator-1.0.0.post2.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for amazon-braket-default-simulator-1.0.0.post2.tar.gz
Algorithm Hash digest
SHA256 50794775e2a0a4322cb4d3e81562ca2fa0ada63128327dc62c0cc74ced47119e
MD5 6d3eda90c79eee65472fe3ac3f65daab
BLAKE2b-256 2de30837d4568e6f1e214ca96a51b46492b91b290e5df0a2f4abda4a15e560e4

See more details on using hashes here.

File details

Details for the file amazon_braket_default_simulator-1.0.0.post2-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_default_simulator-1.0.0.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 bbc28adaff467dc998d5b9d2a22e71eac8d4849ffab2ff5b0ab6151e6f01a5db
MD5 37e85f7787e8882224a4c672134e816a
BLAKE2b-256 4d2b7789ad6b751d2ee8fafeac7bd46cac28e5a757de53678f6bd3bb3685d9fe

See more details on using hashes here.

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