Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Oct 7, 2019. It is now read-only.
/reference-qvmPublic archive

A reference implementation for a quantum virtual machine in Python

License

NotificationsYou must be signed in to change notification settings

rigetti/reference-qvm

Repository files navigation

Build Status

Reference QVM

Thereferenceqvm is the reference implementation of the QVM outlined in thearXiv:1608:03355 by Robert Smith, Spike Curtis, and Will Zeng. It is a research package thatsupports rapid prototyping and development of quantum programs using pyQuil.

Currently, this QVM supports a subset of functionality in the Quil specifications,excepting certain functions (DEFCIRCUIT, WAIT, NOP).

Noise models (dephasing, Kraus operators), parametrization with bits inclassical memory, and other features will be added in future releases.

Installation

You can install reference-qvm directly from the Python package managerpip using:

pip install referenceqvm

To instead install reference-qvm from source, clone this repository,cd into it, and run:

pip install -r requirements.txt -e .

This will install the reference-qvm's dependencies if you do not already have them.

Development and Testing

We use tox and pytest for testing. Tests can be executed from the top-level directory by simplyrunning:

tox

The setup is currently testing Python 2.7 and Python 3.6.

Building the Docs

We use sphinx to build the documentation. To do this, navigate into pyQuil's top-level directory and run:

sphinx-build -b html ./docs/source ./docs/build

To view the docs navigate to the newly-createddocs/build directory and opentheindex.html file in a browser. Note that we use the Read the Docs theme forour documentation, so this may need to be installed usingpip install sphinx_rtd_theme.

Interaction with the referenceqvm

The qvm can be accessed in a similar way to the Forest QVM access.Start by importing the synchronous connection object from thereferenceqvm.api module

fromreferenceqvm.apiimportQVMConnection

and initialize a connection to the reference-qvm

qvm=QVMConnection()

By default, the Connection object uses the wavefunction transition type.

Then call theqvm.wavefunction(prog) method to get back the classical memory and thepyquil.Wavefunction object given a pyquil.quil.Program objectprog.

The reference-qvm has the same functionality as Forest QVM and is useful for testingsmall quantum programs on a local machine. For example, the same code (up to thereferenceqvm.api import) can be used to simulate pyquil programs.

>>>importpyquil.quilaspq>>>importreferenceqvm.apiasapi>>>frompyquil.gatesimport*>>>qvm=api.QVMConnection()>>>p=pq.Program(H(0),CNOT(0,1))<pyquil.pyquil.Programobjectat0x101ebfb50>>>>qvm.wavefunction(p)[0][(0.7071067811865475+0j),0j,0j, (0.7071067811865475+0j)]

QVMConnection can also initialize a QVM that does not return a wavefunction but instead a unitary correspondingto the pyquil program. This can be extremely useful in terms of debugging and understanding gate physics. For example,we can examine the unitary for a CNOT operator.

>>>importpyquil.quilaspq>>>importreferenceqvm.apiasapi>>>frompyquil.gatesimportCNOT>>>qvm=api.QVMConnection(type_trans='unitary')>>>p=pq.Program(CNOT(1,0))>>>u=qvm.unitary(p)>>>print(u)[[1.+0.j0.+0.j0.+0.j0.+0.j] [0.+0.j1.+0.j0.+0.j0.+0.j] [0.+0.j0.+0.j0.+0.j1.+0.j] [0.+0.j0.+0.j1.+0.j0.+0.j]]

How to cite the reference-qvm

If you use the reference-qvm please cite the repository as follows:

bibTex:

@misc{rqvm2017.0.0.1,  author = {Rigetti Computing",  title = {Reference-QVM},  year = {2017},  publisher = {GitHub},  journal = {GitHub repository},  howpublished = {\url{https://github.com/rigetticomputing},  commit = {the commit you used}}

and the paper outlining the Mathematical specification of the quantum-abstract-machine:

bibTeX:

@misc{1608.03355,  title={A Practical Quantum Instruction Set Architecture},  author={Smith, Robert S and Curtis, Michael J and Zeng, William J},  journal={arXiv preprint arXiv:1608.03355},  year={2016}}

About

A reference implementation for a quantum virtual machine in Python

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp