PennyLane v0.4.0 Released

Hi everyone, we’re excited to announce PennyLane version 0.4.0.

This is a major release, that contains some great new features and improvements. These include:

  • Changes in how we request expectation values.
    qml.expval() is now a top-level function, and is no longer a package of classes. To request an expectation value of an observable, the following syntax is now used:

    import pennylane as qml
    from pennylane import expval
    dev = qml.device("default.qubit", wires=2)
    def circuit(x, y):
      qml.RX(x, wires=0)
      qml.CNOT(wires=(0, 1))
      return expval(qml.PauliZ(0)), expval(qml.PauliX(1))

    For now, the existing qml.expval.Observable interface continues to work, but will raise a deprecation warning.

  • Variance support.
    QNodes can now return the variance of observables, via the top-level qml.var() function. To support this on plugin devices, there is a new Device.var method. We also support analytic gradients on hardware of variance values!

  • Multi-qubit observables
    Adds support for multi-qubit observables using the qml.Hermitian observable.

  • New QML Templates

    • New random initialization functions supporting the templates available in the new submodule qml.init.

    • Added various quantum embedding strategies

  • Faster default.qubit
    The default.qubit plugin now uses np.tensordot when applying quantum operations and evaluating expectations, resulting in significant speedup!

See the full release notes for more details on the latest PennyLane release.

As always, this release would not have been possible without all the help from our contributors:

@quantshah , riveSunder, @AroosaIjaz, @nathan, @Maria_Schuld