Package: qcs
pyQuilA library for easily generating Quil programs to be executed using the Rigetti Forest platform.
pyQuil is licensed under theApache 2.0 license.DocumentationDocumentation is hosted athttp://pyquil.readthedocs.io/en/latest/InstallationYou can install pyQuil as a conda package (recommended):condainstall-crigettipyquilor usingpip:pip install pyquilTo instead install pyQuil from source, clone this repository,cdinto it, and run:pip install -e .Connecting to Rigetti ForestpyQuil can be used to build and manipulate Quil programs without restriction. However, to run
programs (e.g., to get wavefunctions, get multishot experiment data), you will need an API key
forRigetti Forest. This will allow you to run your programs on the
Rigetti Quantum Virtual Machine (QVM) or on a real quantum processor (QPU).Once you have your key, run the following command to automatically set up your config:pyquil-config-setupYou can also create the configuration file manually if you'd like and place it at~/.pyquil_config.
The configuration file is in INI format and should contain all the information required to connect to Forest:[Rigetti Forest]
key: <Rigetti Forest API key>
user_id: <Rigetti User ID>You can change the location of this file by setting thePYQUIL_CONFIGenvironment variable.If you encounter errors or warnings trying to connect to Forest then see the fullGetting Started GuideExamples using the Rigetti QVMHere is how to construct a Bell state program and how to compute the amplitudes of its wavefunction:>>>frompyquil.quilimportProgram>>>frompyquil.apiimportQVMConnection>>>frompyquil.gatesimport*>>>qvm=QVMConnection()>>>p=Program(H(0),CNOT(0,1))<pyquil.pyquil.Programobjectat0x101ebfb50>>>>qvm.wavefunction(p).amplitudesarray([0.7071067811865475+0j,0j,0j,0.7071067811865475+0j])How to do a simulated multishot experiment measuring qubits 0 and 1 of a Bell state. (Of course,
each measurement pair will be00or11.)>>>frompyquil.quilimportProgram>>>frompyquil.apiimportQVMConnection>>>frompyquil.gatesimport*>>>qvm=QVMConnection()>>>p=Program()>>>p.inst(H(0),...CNOT(0,1),...MEASURE(0,0),...MEASURE(1,1))<pyquil.pyquil.Programobjectat0x101ebfc50>>>>print(p)H0CNOT01MEASURE0[0]MEASURE1[1]>>>qvm.run(p,[0,1],10)[[0,0],[1,1],[1,1],[0,0],[0,0],[1,1],[0,0],[0,0],[0,0],[0,0]]CommunityJoin the public Forest Slack channel athttp://slack.rigetti.com.The following projects have been contributed by community members:Syntax Highlighting for Quilcontributed byJames WeaverWeb Based Circuit Simulatorcontributed byRavisankar A VQuil in Javascriptcontributed byNick DoironQuil in Javacontributed byVictory OmoleDeveloping PyQuilTo make changes to PyQuil itself seeDEVELOPMENT.mdfor instructions on development and testing.How to cite pyQuil and ForestIf you use pyQuil, Grove, or other parts of the Rigetti Forest stack in your research, please cite it as follows: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}
}Text:R. Smith, M. J. Curtis and W. J. Zeng, "A Practical Quantum Instruction Set Architecture," (2016), 
  arXiv:1608.03355 [quant-ph], https://arxiv.org/abs/1608.03355