Skip to main content

Local simulation of quantum circuits

Project description

Amazon Braket Simulator Version 2

Latest Version Supported Python Versions Build status Documentation Status

This Amazon Braket Simulator is a second generation of our Python open source library that provides an implementation of a quantum simulators 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 this Amazon Braket Simulator

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

Usage

Importing this package for the first time will install additional libraries and precompile the Julia modules, which may take a few additional minutes. This will not be needed for subsequent runs.

The quantum simulator implementations StateVectorSimulatorV2 and DensityMatrixSimulatorV2 plug into the LocalSimulator interface in Amazon Braket SDK, with the backend parameters as "braket_sv_v2" and "braket_dm_v2", respectively.

Executing a circuit using the simulator:

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

device = LocalSimulator("braket_sv_v2")

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-simulator-v2-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-simulator-v2-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 ".[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

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Project details


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_simulator_v2-0.4.0.tar.gz (19.3 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_simulator_v2-0.4.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file amazon_braket_simulator_v2-0.4.0.tar.gz.

File metadata

File hashes

Hashes for amazon_braket_simulator_v2-0.4.0.tar.gz
Algorithm Hash digest
SHA256 23fb3ab72c9e14f9e7e7396d50e784d9cda3a15e524388de8290a9e19da0562b
MD5 3addb94056e2276dd84e996497239ffa
BLAKE2b-256 007e8671ecc4c760d50d4f0c1cc262ef8babd326fba816b0960891c067afbbc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_simulator_v2-0.4.0.tar.gz:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-simulator-v2-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_simulator_v2-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_simulator_v2-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a8ad53dcf3b95b04e9fb65869d4c4ef12b8c15b25015d4a07a91d2d4587e309
MD5 9a8873c87c3c275863bffe77b9bba0d1
BLAKE2b-256 8aebf49af8f498148904ed66076e9d40cdf2a1a05fb6272f8d03955874fd09aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_simulator_v2-0.4.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-simulator-v2-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