Release 0.5
New features since last release
-
Adds a new optimizer,
qml.QNGOptimizer
, which optimizes QNodes using quantum natural gradient descent. See https://arxiv.org/abs/1909.02108 for more details. #295 #311 -
Adds a new QNode method,
QNode.metric_tensor()
, which returns the block-diagonal approximation to the Fubini-Study metric tensor evaluated on the attached device. #295 -
Sampling support: QNodes can now return a specified number of samples from a given observable via the top-level
pennylane.sample()
function. To support this on plugin devices, there is a newDevice.sample
method.Calculating gradients of QNodes that involve sampling is not possible. #256
-
default.qubit
has been updated to provide support for sampling. #256 -
Added controlled rotation gates to PennyLane operations and
default.qubit
plugin. #251
Breaking changes
-
The method
Device.supported
was removed, and replaced with the methodsDevice.supports_observable
andDevice.supports_operation
. Both methods can be called with string arguments (dev.supports_observable('PauliX')
) and class arguments (dev.supports_observable(qml.PauliX)
). #276 -
The following CV observables were renamed to comply with the new Operation/Observable scheme:
MeanPhoton
toNumberOperator
,Homodyne
toQuadOperator
andNumberState
toFockStateProjector
. #243
Improvements
-
The
AmplitudeEmbedding
function now provides options to normalize and pad features to ensure a valid state vector is prepared. #275 -
Operations can now optionally specify generators, either as existing PennyLane operations, or by providing a NumPy array. #295 #313
-
Adds a
Device.parameters
property, so that devices can view a dictionary mapping free parameters to operation parameters. This will allow plugin devices to take advantage of parametric compilation. #283 -
Introduces two enumerations:
Any
andAll
, representing any number of wires and all wires in the system respectively. They can be imported frompennylane.operation
, and can be used when defining theOperation.num_wires
class attribute of operations. #277As part of this change:
-
All
is equivalent to the integer 0, for backwards compatibility with the existing test suite -
Any
is equivalent to the integer -1 to allow numeric comparison operators to continue working -
An additional validation is now added to the
Operation
class, which will alert the user that an operation withnum_wires = All
is being incorrectly.
-
-
The one-qubit rotations in
pennylane.plugins.default_qubit
no longer depend on Scipy'sexpm
. Instead they are calculated with Euler's formula. #292 -
Creates an
ObservableReturnTypes
enumeration class containingSample
,Variance
andExpectation
. These new values can be assigned to thereturn_type
attribute of anObservable
. #290 -
Changed the signature of the
RandomLayer
andRandomLayers
templates to have a fixed seed by default. #258 -
setup.py
has been cleaned up, removing the non-working shebang, and removing unused imports. #262
Documentation
-
A documentation refactor to simplify the tutorials and include Sphinx-Gallery. #291
-
Examples and tutorials previously split across the
examples/
anddoc/tutorials/
directories, in a mixture of ReST and Jupyter notebooks, have been rewritten as Python scripts with ReST comments in a single location, theexamples/
folder. -
Sphinx-Gallery is used to automatically build and run the tutorials. Rendered output is displayed in the Sphinx documentation.
-
Links are provided at the top of every tutorial page for downloading the tutorial as an executable python script, downloading the tutorial as a Jupyter notebook, or viewing the notebook on GitHub.
-
The tutorials table of contents have been moved to a single quick start page.
-
-
Fixed a typo in
QubitStateVector
. #295 -
Fixed a typo in the
default_gaussian.gaussian_state
function. #293 -
Fixed a typo in the gradient recipe within the
RX
,RY
,RZ
operation docstrings. #248 -
Fixed a broken link in the tutorial documentation, as a result of the
qml.expval.Observable
deprecation. #246
Bug fixes
- Fixed a bug where a
PolyXP
observable would fail if applied to subsets of wires ondefault.gaussian
. #277
Contributors
This release contains contributions from (in alphabetical order):
Simon Cross, Aroosa Ijaz, Josh Izaac, Nathan Killoran, Johannes Jakob Meyer, Rohit Midha, Nicolás Quesada, Maria Schuld, Antal Száva, Roeland Wiersema.