pyQuil  使用Quil进行量子编程的Python库
A Python library for quantum programming using Quil.Announcements
 PyQuil now has a Pull Request Template, which contains a checklist of things that must be completed (if applicable) before a PR can be merged (gh921).
Improvements and Changes

Removed a bunch of logic around creating inverse gates from userdefined gates in
Program.dagger()
in favor of a simpler call toGate.dagger()
(gh887). 
The
RESET
instruction now works correctly withQubitPlaceholder
objects and theaddress_qubits
function (gh910). 
ReferenceDensitySimulator
can now have a state that is persistent between rounds ofrun
orrun_and_measure
(gh920).
Bugfixes

Small negative probabilities were causing
ReferenceDensitySimulator
to fail (gh908). 
The
dagger
function was incorrectly dropping gate modifiers likeCONTROLLED
(gh914). 
Negative numbers in classical instruction arguments were not being parsed (gh917).

Inline math rendering was not working correctly in
intro.rst
(gh927).
Thanks to community member jclapis for the contributions to this release!
Assets
2
Bugfixes
 An additional backwardsincompatible change from gh870 snuck through 2.7.1, and is
addressed in this patch release.
Assets
2
Improvements and Changes

Added a CODEOWNERS file for default reviewers (gh855).

Bifurcated the
QPUCompiler
endpoint parameter into two quilc_endpoint
and
qpu_compiler_endpoint
 to reflect changes in Quantum Cloud Services (gh856). 
Clarified documentation around the DELAY pragma (gh862).

Added information about the
local_qvm
context manager to the
getting started documentation (gh851).
Bugfixes

Added a nonNone default timeout to the
QVMCompiler
object (gh850) and
theget_benchmarker
function (gh854). 
Fixed the docstring for the
apply_clifford_to_pauli
function (gh836). 
Allowed the
apply_clifford_to_pauli
function to now work with the Identity
as input (gh849). 
Updated a stale link to the Rigetti Forest Slack workspace (gh860).

Fixed a notation typo in the documentation for noise (gh861).
Special thanks to @willzeng for all the contributions this release!
Assets
2
ecprigetti released this
This is a bugfix release, repairing a bug in the serialization of ExperimentResults objects.
Assets
2
ecprigetti released this
This is a bugfix release that corrects some errors found in the operator expectation code.
Assets
2
Improvements and Changes:
 PyQuil's Gate objects now expose
.controlled(q)
and.dagger()
modifiers, which turn a gate respectively into its controlled variant, conditional on the qubitq
, or into its inverse.  The operator estimation suite's
measure_observables
method now exposes areadout_symmetrize
argument, which helps mitigate a machine's fidelity asymmetry between recognizing a qubit in the ground state versus the excited state.  The
MEASURE
instruction in pyQuil now has a mandatory second argument. Previously, the second argument could be omitted to induce "measurement for effect", without storing the readout result to a classical register, but users found this to be a common source of accidental error and a generally rude surprise. To ensure the user really intends to measure only for effect, we now require that they supply an explicitNone
as the second argument.
Bugfixes:
 Some stale tests have been brought into the modern era.
Assets
2
Announcements
 The Quil Compiler (
quilc
) and the Quantum Virtual Machine (qvm
), which are part of the Forest SDK, have been open sourced! In addition to downloading the binaries, you can now build these applications locally from source, or run them via the Docker imagesrigetti/quilc
andrigetti/qvm
. These Docker images are now used as theservices
in the GitLab CI build plan YAML (gh792, gh794, gh795).
Improvements and Changes

The
WavefunctionSimulator
now supports the use of parametric Quil programs, via thememory_map
parameter for its various methods (gh787). 
Operator estimation data structures introduced in v2.2 have changed. Previously,
ExperimentSettings
had two members:in_operator
andout_operator
. Theout_operator
is unchanged, butin_operator
has been renamed toin_state
and its data type is nowTensorProductState
instead ofPauliTerm
. It was always an abuse of notation to interpret pauli operators as defining initial states. Analogous to the Pauli helper functions sI, sX, sY, and sZ,TensorProductState
objects are constructed by multiplying together terms generated by the helper functions plusX, minusX, plusY, minusY, plusZ, and minusZ. This functionality enables process tomography and process DFE (gh770). 
Operator estimation now offers a "greedy" method for grouping tomographylike experiments that share a natural tensor product basis (ntpb), as an alternative to the clique cover version (gh754).

The
quilc
endpoint for rewriting Quil parameter arithmetic has been changed fromresolve_gate_parameter_arithmetic
torewrite_arithmetic
(gh802). 
The difference between ProtoQuil and QPUsupported Quil is now better defined (gh798).
Bugfixes
Assets
2
mpharrigan released this
Assets
2
PyQuil 2.3 is the latest release of pyQuil, Rigetti's toolkit for constructing and running
quantum programs. A major new feature is the release of a new suite of simulators:

We're proud to introduce the first iteration of a Pythonbased quantum virtual machine (QVM) called PyQVM. This QVM is completely contained within pyQuil and does not need any external dependencies. Try using it with
get_qc("9qsquarepyqvm")
or explore thepyquil.pyqvm.PyQVM
object directly. Underthehood, there are three quantum simulator backends:ReferenceWavefunctionSimulator
uses standard matrixvector multiplication to evolve a statevector. This includes a suite of tools inpyquil.unitary_tools
for dealing with unitary matrices.NumpyWavefunctionSimulator
uses numpy's tensordot functionality to efficiently evolve a statevector. For most simulations, performance is quite good.ReferenceDensitySimulator
uses matrixmatrix multiplication to evolve a density matrix.

Matrix representations of Quil standard gates are included in
pyquil.gate_matrices
(gh552). 
The density simulator has extremely limited support for Krausoperator based noise models. Let us know if you're interested in contributing more robust noisemodel support.

This functionality should be considered experimental and may undergo minor API changes.
Important changes to note:
 Quil math functions (like COS, SIN, ...) used to be ambiguous with respect to case sensitivity. They are now casesensitive and should be uppercase (gh774).
 In the next release of pyQuil, communication with quilc will happen exclusively via the rpcq protocol.
LocalQVMCompiler
andLocalBenchmarkConnection
will be removed in favor of a unifiedQVMCompiler
andBenchmarkConnection
. This change should be transparent if you useget_qc
andget_benchmarker
, respectively. In anticipation of this change we recommend that you upgrade your version of quilc to 1.3, released Jan 30, 2019 (gh730).  When using a paramaterized gate, the QPU control electronics only allowed multiplying parameters by powers of two. If you only ever multiply a parameter by the same constant, this isn't too much of a problem because you can fold the multiplicative constant into the definition of the parameter. However, if you are multiplying the same variable (e.g.
gamma
in QAOA) by different constants (e.g. weighted maxcut edge weights) it doesn't work. PyQuil will now transparently handle the latter case by expanding to a vector of parameters with the constants folded in, allowing you to multiply variables by whatever you want (gh707).
As always, this release contains bug fixes and improvements:
 The CZ gate fidelity metric available in the Specs object now has its associated standard error, which is accessible from the method
Specs.fCZ_std_errs
(gh751).  Operator estimation code now correctly handles identity terms with coefficients. Previously, it would always estimate these terms as 1.0 (gh758).
 Operator estimation results include the total number of counts (shots) taken.
 Operator estimation JSON serialization uses utf8. Please let us know if this causes problems (gh769).
 The example quantum die program now can roll dice that are not powers of two (gh749).
 The teleportation and Meyer penny game examples had a syntax error (gh778, gh772).
 When running on the QPU, you could get into trouble if the QPU name passed to
get_qc
did not match the lattice you booked. This is now validated (gh771).
We extend thanks to community member estamm12 for their contribution to this release.
mpharrigan released this
Assets
2
PyQuil 2.2 is the latest release of pyQuil, Rigetti's toolkit for constructing and running quantum programs. Bug fixes and improvements include:
pauli.is_zero
andpaulis.is_identity
would sometimes return erroneous answers (gh710). Parameter expressions involving addition and subtraction are now converted to Quil with spaces around the operators, e.g.
theta + 2
instead oftheta+2
. This disambiguates subtracting two parameters, e.g.alpha  beta
is not one variable namedalphabeta
(gh743).  T1 is accounted for in T2 noise models (gh745).
 Documentation improvements (gh723, gh719, gh720, gh728, gh732, gh742).
 Support for PNG generation of circuit diagrams via LaTeX (gh745).
 We've started transitioning to using Gitlab as our continuous integration provider for pyQuil (gh741, gh752).
This release includes a new module for facilitating the estimation of quantum observables/operators (gh682). Firstclass support for estimating observables should make it easier to express nearterm algorithms. This release includes:
 data structures for expressing tomographylike experiments and their results
 grouping of experiment settings that can be simultaneously estimated
 functionality to executing a tomographylike experiment on a quantum computer
Please look forward to more features and polish in future releases. Don't hesitate to submit feedback or suggestions as GitHub issues.
We extend thanks to community member petterwittek for their contribution to this release.
mpharrigan released this
Assets
2
PyQuil 2.1 is an incremental release of pyQuil, Rigetti's toolkit for constructing and running quantum programs. Changes include:
 Major documentation improvements.
QuantumComputer.run()
accepts an optionalmemory_map
parameter to facilitate running parametric executables (gh657).QuantumComputer.reset()
will reset the state of a QAM to recover from an error condition (gh703). Bug fixes (gh674, gh696).
 Quil parser improvements (gh689, gh685).
 Optional interleaver argument when generating RB sequences (gh673).
 Our GitHub organization name has changed from
rigetticomputing
torigetti
(gh713).
mpharrigan released this
Assets
2
PyQuil 2.0 is a major release of pyQuil, Rigetti's toolkit for constructing and running quantum
programs. This release contains many major changes including:
 The introduction of Quantum Cloud Services. Access
Rigetti's QPUs from colocated classical compute resources for minimal latency. The
web API for running QVM and QPU jobs has been deprecated and cannot be accessed with
pyQuil 2.0  Advances in classical control systems and compilation allowing the precompilation of
parametric binary executables for rapid hybrid algorithm iteration.  Changes to Quilour quantum instruction languageto provide easier ways of
interacting with classical memory.
The new QCS access model and features will allow you to execute hybrid quantum algorithms
several orders of magnitude (!) faster than the previous web endpoint. However, to fully
exploit these speed increases you must update your programs to use the latest pyQuil features
and APIs.
An incomplete list of significant changes:
 Python 2 is no longer supported. Please use Python 3.6+
 Parametric gates are now normal functions. You can no longer write
RX(pi/2)(0)
to get a
QuilRX(pi/2) 0
instruction. Just useRX(pi/2, 0)
.  Gates support keyword arguments, so you can write
RX(angle=pi/2, qubit=0)
.  All
async
methods have been removed fromQVMConnection
andQVMConnection
is
deprecated.QPUConnection
has been removed in accordance with the QCS access model.
Usepyquil.get_qc
as the primary means of interacting with the QVM or QPU. WavefunctionSimulator
allows unfettered access to wavefunction properties and routines.
These methods and properties previously lived onQVMConnection
and have been deprecated
there. Classical memory in Quil must be declared with a name and type. Please read :ref:
quickstart
for more.  Compilation has changed. There are now different
Compiler
objects that target either the
QPU or QVM. You must explicitly compile your programs to run on a QPU or a realistic QVM.
pyQuil 1.9
mpharrigan released this
We’re happy to announce the release of pyQuil 1.9. PyQuil is Rigetti’s toolkit for constructing and running quantum programs. This release is the latest in our series of regular releases, and it’s filled with convenience features, enhancements, bug fixes, and documentation improvements.
Special thanks to community members sethuiyer, vtomole, rht, akarazeev, ejdanderson, markf94, playadust, and kadora626 for contributing to this release!
Qubit placeholders
One of the focuses of this release is a reworked concept of "Qubit Placeholders". These are logical qubits that can be used to construct programs. Now, a program containing qubit placeholders must be "addressed" prior to running on a QPU or QVM. The addressing stage involves mapping each qubit placeholder to a physical qubit (represented as an integer). For example, if you have a 3 qubit circuit that you want to run on different sections of the Agave chip, you now can prepare one Program and address it to many different subgraphs of the chip topology. Check out the QubitPlaceholder
example notebook for more.
To support this idea, we've refactored parts of pyQuil to remove the assumption that qubits can be "sorted". While true for integer qubit labels, this probably isn't true in general. A notable change can be found in the construction of a PauliSum
: now terms will stay in the order they were constructed.
PauliTerm
now remembers the order of its operations.sX(1)*sZ(2)
will compile to different Quil code thansZ(2)*sX(1)
, although the terms will still be equal according to the__eq__
method. DuringPauliSum
combination of like terms, a warning will be emitted if two terms are combined that have different orders of operation.PauliTerm.id()
takes an optional argumentsort_ops
which defaults to True for backwards compatibility. However, this function should not be used for comparing termtype like it has been used previously. UsePauliTerm.operations_as_set()
instead. In the future,sort_ops
will default to False and will eventually be removed.Program.alloc()
has been deprecated. Please instantiateQubitPlaceholder()
directly or request a "register" (list) ofn
placeholders by using the class constructorQubitPlaceholder.register(n)
. Programs must contain either (1) all instantiated qubits with integer indexes or (2) all placeholder qubits of type
QubitPlaceholder
. We have found that most users use (1) but (2) will become useful with larger and more diverse devices.  Programs that contain qubit placeholders must be explicitly addressed prior to execution. Previously, qubits would be assigned "under the hood" to integers 0...N. Now, you must use
address_qubits
which returns a new program with all qubits indexed depending on thequbit_mapping
argument. The original program is unaffected and can be "readdressed" multiple times. PauliTerm
can now acceptQubitPlaceholder
in addition to integers.QubitPlaceholder
is no longer a subclass ofQubit.
LabelPlaceholder
is no longer a subclass ofLabel.
QuilAtom
subclasses' hash functions have changed.
Randomized benchmarking sequence generation
PyQuil now includes support for performing a simple benchmarking routine  randomized benchmarking. There is a new method in the CompilerConnection
that will return sequences of pyQuil programs, corresponding to elements of the Clifford group. These programs are uniformly randomly sampled, and have the property that they compose to the identity. When concatenated and run as one program, these programs can be used in a procedure called randomized benchmarking to gain insight about the fidelity of operations on a QPU.
In addition, the CompilerConnection
has another new method, apply_clifford_to_pauli
, which conjugates PauliTerms
by Programs
that are composed of Clifford gates. That is to say, given a circuit C, that contains only gates corresponding to elements of the Clifford group, and a tensor product of elements P, from the Pauli group, this method will compute $PCP^{dagger}$. Such a procedure can be used in various ways. An example is predicting the effect a Clifford circuit will have on an input state modeled as a density matrix, which can be written as a sum of Pauli matrices.
Ease of Use
This release includes some qualityoflife improvements such as the ability to initialize programs with generator expressions, sensible defaults for Program.measure_all
, and sensible defaults for classical_addresses
in run
methods.
Program
can be initiated with a generator expression.Program.measure_all
(with no arguments) will measure all qubits in a program.classical_addresses
is now optional in QVM and QPUrun
methods. By default, any classical addresses targeted byMEASURE
will be returned.QVMConnection.pauli_expectation
acceptsPauliSum
as arguments. This offers a more sensible API compared toQVMConnection.expectation
. PyQuil will now retry jobs every 10 seconds if the QPU is retuning.
CompilerConnection.compile
now takes an optional argumentisa
that allows percompilation specification of the target ISA. An empty program will trigger an exception if you try to run it.
Supported versions of Python
We strongly support using Python 3 with pyQuil. Although this release works with Python 2, we are dropping official support for this legacy language and moving to community support for Python 2. The next major release of pyQuil will introduce Python 3.5+ only features and will no longer work without modification for Python 2.
Bug fixes
shift_quantum_gates
has been removed. Users who relied on this functionality should useQubitPlaceholder
andaddress_qubits
to achieve the same result. Users should also doublecheck data resulting from use of this function as there were several edge cases which would cause the shift to be applied incorrectly resulting in badlyaddressed qubits. Slightly perturbed angles when performing RX gates under a Kraus noise model could result in incorrect behavior.
 The quantum die example returned incorrect values when
n = 2^m
.
v1.8.0
pkaralekas released this
Corresponding milestone: https://github.com/rigetticomputing/pyquil/milestone/3
 Added the
CompilerConnection
standalone endpoint to allow users to investigate compiling to different hardware architectures  Enabled the
run
functionality forQPUConnection
, to make it easier to port code between the QVM and QPU  Added the
NoiseModel
class for constructing noise models on the QVM  Enhanced the
Device
class withSpecs
,ISA
(instruction set architecture), andNoiseModel
information regarding the QPU to which the device corresponds  Enabled providing a
Device
as an argument to aQVMConnection
, for easily constructing a QVM with that device's noise model
Grove release v1.6.0
: https://github.com/rigetticomputing/grove/releases/tag/v1.6.0
Watchers：82 
Star：812 
Fork：236 
创建时间： 20170110 05:30:22 
最后Commits： 15天前 
许可协议：Apache2.0 
9180406
karalekas released this
Jun 28, 2019
Bugfixes
QuantumComputer
object only want to do simulation work with aQVM
orpyQVM
backend (gh934).