Giter Site home page Giter Site logo

indisoluble / amazon-braket-default-simulator-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amazon-braket/amazon-braket-default-simulator-python

0.0 1.0 0.0 254 KB

A library that provides an implementation of a quantum simulator that you can run locally.

Home Page: https://amazon-braket-default-simulator-python.readthedocs.io/

License: Apache License 2.0

Python 99.12% Shell 0.88%

amazon-braket-default-simulator-python's Introduction

Amazon Braket Default Simulator

Latest Version Supported Python Versions Build Status codecov Documentation Status Code Style: Black

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.

amazon-braket-default-simulator-python's People

Contributors

amazon-auto avatar amazon-braket-ci-bot avatar avawang1 avatar floralph avatar kshitijc avatar licedric avatar speller26 avatar xiaosi-xu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.