New features since last release
* PennyLane-Lightning now provides a high-performance
[adjoint Jacobian](http://arxiv.org/abs/2009.02823) method for differentiating quantum circuits.
[(136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)
The adjoint method operates after a forward pass by iteratively applying inverse gates to scan
backwards through the circuit. The method is already available in PennyLane's
`default.qubit` device, but the version provided by `lightning.qubit` integrates with the C++
backend and is more performant, as shown in the plot below:
<img src="https://raw.githubusercontent.com/PennyLaneAI/pennylane-lightning/master/doc/_static/lightning_adjoint.png" width=70%/>
The plot compares the average runtime of `lightning.qubit` and `default.qubit` for calculating the
Jacobian of a circuit using the adjoint method for a range of qubit numbers. The circuit
consists of ten `BasicEntanglerLayers` with a `PauliZ` expectation value calculated on each wire,
repeated over ten runs. We see that `lightning.qubit` provides a speedup of around two to eight
times, depending on the number of qubits.
The adjoint method can be accessed using the standard interface. Consider the following circuit:
python
import pennylane as qml
wires = 3
layers = 2
dev = qml.device("lightning.qubit", wires=wires)
qml.qnode(dev, diff_method="adjoint")
def circuit(weights):
qml.templates.StronglyEntanglingLayers(weights, wires=range(wires))
return qml.expval(qml.PauliZ(0))
weights = qml.init.strong_ent_layers_normal(layers, wires, seed=1967)
The circuit can be executed and its gradient calculated using:
pycon
>>> print(f"Circuit evaluated: {circuit(weights)}")
Circuit evaluated: 0.9801286266677633
>>> print(f"Circuit gradient:\n{qml.grad(circuit)(weights)}")
Circuit gradient:
[[[-1.11022302e-16 -1.63051504e-01 -4.14810501e-04]
[ 1.11022302e-16 -1.50136528e-04 -1.77922957e-04]
[ 0.00000000e+00 -3.92874550e-02 8.14523075e-05]]
[[-1.14472273e-04 3.85963953e-02 0.00000000e+00]
[-5.76791765e-05 -9.78478343e-02 0.00000000e+00]
[-5.55111512e-17 0.00000000e+00 -1.11022302e-16]]]
* PennyLane-Lightning now supports all of the operations and observables of `default.qubit`.
[(124)](https://github.com/PennyLaneAI/pennylane-lightning/pull/124)
Improvements
* A new state-vector class `StateVectorManaged` was added, enabling memory use to be bound to
statevector lifetime.
[(136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)
* The repository now has a well-defined component hierarchy, allowing each indepedent unit to be
compiled and linked separately.
[(136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)
* PennyLane-Lightning can now be installed without compiling its C++ binaries and will fall back
to using the `default.qubit` implementation. Skipping compilation is achieved by setting the
`SKIP_COMPILATION` environment variable, e.g., Linux/MacOS: `export SKIP_COMPILATION=True`,
Windows: `set SKIP_COMPILATION=True`. This feature is intended for building a pure-Python wheel of
PennyLane-Lightning as a backup for platforms without a dedicated wheel.
[(129)](https://github.com/PennyLaneAI/pennylane-lightning/pull/129)
* The C++-backed Python bound methods can now be directly called with wires and supplied parameters.
[(125)](https://github.com/PennyLaneAI/pennylane-lightning/pull/125)
* Lightning supports arbitrary unitary and non-unitary gate-calls from Python to C++ layer.
[(121)](https://github.com/PennyLaneAI/pennylane-lightning/pull/121)
Documentation
* Added preliminary architecture diagram for package.
[(131)](https://github.com/PennyLaneAI/pennylane-lightning/pull/131)
* C++ API built as part of docs generation.
[(131)](https://github.com/PennyLaneAI/pennylane-lightning/pull/131)
Breaking changes
* Wheels for MacOS <= 10.13 will no longer be provided due to XCode SDK C++17 support requirements.
[(149)](https://github.com/PennyLaneAI/pennylane-lightning/pull/149)
Bug fixes
* An indexing error in the CRY gate is fixed. [(136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)
* Column-major data in numpy is now correctly converted to row-major upon pass to the C++ layer.
[(126)](https://github.com/PennyLaneAI/pennylane-lightning/pull/126)
Contributors
This release contains contributions from (in alphabetical order):
Thomas Bromley, Lee James O'Riordan