Local simulation of quantum circuits
Project description
Amazon Simulator Version 2
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
Running this simulator for the first time will install additional libraries and 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
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
File details
Details for the file amazon_braket_simulator_v2-0.1.1.post0.tar.gz
.
File metadata
- Download URL: amazon_braket_simulator_v2-0.1.1.post0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b4769165e83e63143c99c51fc0992f0ca59502c6035dad052048b21936da5f2 |
|
MD5 | 46f5b53e259ee287fe980b8c1b90a40d |
|
BLAKE2b-256 | d494349ca30e03656fccf3fcba0dec1ab3c133429ae07e67fc3cb41d23934f76 |
File details
Details for the file amazon_braket_simulator_v2-0.1.1.post0-py3-none-any.whl
.
File metadata
- Download URL: amazon_braket_simulator_v2-0.1.1.post0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca2420842780a2fc4993b209360babaa0c3967d6aaf3f587bfbfde850ed84cbb |
|
MD5 | b4f4186c33804d3fca9818f983a69575 |
|
BLAKE2b-256 | a172d444c784f3bedb96e0bb2825ee5f576cf75b98734ce8f15a1c7dfb148ef8 |