<h3>New features since last release</h3>
* Adds initial support for the Xanadu's photonic quantum hardware. [(101)](https://github.com/XanaduAI/strawberryfields/pull/101) [(#148)](https://github.com/XanaduAI/strawberryfields/pull/148) [(#294)](https://github.com/XanaduAI/strawberryfields/pull/294) [(#327)](https://github.com/XanaduAI/strawberryfields/pull/327) [(#328)](https://github.com/XanaduAI/strawberryfields/pull/328) [(#329)](https://github.com/XanaduAI/strawberryfields/pull/329) [(#330)](https://github.com/XanaduAI/strawberryfields/pull/330) [(#334)](https://github.com/XanaduAI/strawberryfields/pull/334) [(#336)](https://github.com/XanaduAI/strawberryfields/pull/336) [(#337)](https://github.com/XanaduAI/strawberryfields/pull/337) [(#339)](https://github.com/XanaduAI/strawberryfields/pull/339)
Jobs can now be submitted to the Xanadu Quantum Cloud platform to be run on supported hardware using the new `RemoteEngine`:
python
import strawberryfields as sf
from strawberryfields import ops
from strawberryfields.utils import random_interferometer
replace AUTH_TOKEN with your Xanadu Quantum Cloud access token
con = sf.api.Connection(token="AUTH_TOKEN")
eng = sf.RemoteEngine("X8", connection=con)
prog = sf.Program(8)
U = random_interferometer(4)
with prog.context as q:
ops.S2gate(1.0) | (q[0], q[4])
ops.S2gate(1.0) | (q[1], q[5])
ops.S2gate(1.0) | (q[2], q[6])
ops.S2gate(1.0) | (q[3], q[7])
ops.Interferometer(U) | q[:4]
ops.Interferometer(U) | q[4:]
ops.MeasureFock() | q
result = eng.run(prog, shots=1000)
For more details, see the [photonic hardware quickstart](https://strawberryfields.readthedocs.io/en/latest/introduction/photonic_hardware.html) and [tutorial](https://strawberryfields.readthedocs.io/en/latest/tutorials/tutorial_X8.html).
* Significantly speeds up the Fock backend of Strawberry Fields, through a variety of changes:
- The Fock backend now uses The Walrus high performance implementations of the displacement, squeezing, two-mode squeezing, and beamsplitter operations. [(287)](https://github.com/XanaduAI/strawberryfields/pull/287) [(#289)](https://github.com/XanaduAI/strawberryfields/pull/289)
- Custom tensor contractions which make use of symmetry relations for the beamsplitter and the two-mode squeeze gate have been added, as well as more efficient contractions for diagonal operations in the Fock basis. [(292)](https://github.com/XanaduAI/strawberryfields/pull/292)
<br>
* New `sf` command line program for configuring Strawberry Fields for access to the Xanadu cloud platform, as well as submitting and executing jobs from the command line. [(146)](https://github.com/XanaduAI/strawberryfields/pull/146) [(#312)](https://github.com/XanaduAI/strawberryfields/pull/312)
The new Strawberry Fields command line program `sf` provides several utilities including:
* `sf configure [--token] [--local]`: configure the connection to the cloud platform
* `sf run input [--output FILE]`: submit and execute quantum programs from the command line
* `sf --ping`: verify your connection to the Xanadu cloud platform
For more details, see the [documentation](https://strawberryfields.readthedocs.io/en/stable/code/sf_cli.html).
* New configuration functions to load configuration from keyword arguments, environment variables, and configuration files. [(298)](https://github.com/XanaduAI/strawberryfields/pull/298) [(#306)](https://github.com/XanaduAI/strawberryfields/pull/306)
This includes the ability to automatically store Xanadu cloud platform credentials in a configuration file using the new function
python
sf.store_account("AUTHENTICATION_TOKEN")
as well as from the command line,
bash
$ sf configure --token AUTHENTICATION_TOKEN
Configuration files can be saved globally, or locally on a per-project basis. For more details, see the [configuration documentation](https://strawberryfields.readthedocs.io/en/stable/introduction/configuration.html)
* Adds configuration functions for resetting, deleting configurations, as well as displaying available configuration files. [(359)](https://github.com/XanaduAI/strawberryfields/pull/359)
* Adds the `x_quad_values` and `p_quad_values` methods to the `state` class. This allows calculation of x and p quadrature probability distributions by integrating across the Wigner function. [(270)](https://github.com/XanaduAI/strawberryfields/pull/270)
* Adds support in the applications layer for node-weighted graphs.
Sample from graphs with node weights using a special-purpose encoding [(295)](https://github.com/XanaduAI/strawberryfields/pull/295):
python
from strawberryfields.apps import sample
generate a random graph
g = nx.erdos_renyi_graph(20, 0.6)
a = nx.to_numpy_array(g)
define node weights
and encode into the adjacency matrix
w = [i for i in range(20)]
a = sample.waw_matrix(a, w)
s = sample.sample(a, n_mean=10, n_samples=10)
s = sample.postselect(s, min_count=4, max_count=20)
s = sample.to_subgraphs(s, g)
Node weights can be input to search algorithms in the `clique` and `subgraph` modules [(296)](https://github.com/XanaduAI/strawberryfields/pull/296) [(#297)](https://github.com/XanaduAI/strawberryfields/pull/297):
python
from strawberryfields.apps import clique
c = [clique.shrink(s_, g, node_select=w) for s_ in s]
[clique.search(c_, g, iterations=10, node_select=w) for c_ in c]
python
from strawberryfields.apps import subgraph
subgraph.search(s, g, min_size=5, max_size=8, node_select=w)
<h3>Improvements</h3>
* Moved Fock backend apply-gate functions to `Circuit` class, and removed `apply_gate_einsum` and `Circuits._apply_gate`, since they were no longer used. [(293)](https://github.com/XanaduAI/strawberryfields/pull/293/)
* Results returned from all backends now have a unified type and shape. In addition, attempting to use batching, post-selection and feed-foward together with multiple shots now raises an error. [(300)](https://github.com/XanaduAI/strawberryfields/pull/300)
* Modified the rectangular decomposition to ensure that identity-like unitaries are implemented with no swaps. [(311)](https://github.com/XanaduAI/strawberryfields/pull/311)
<h3>Bug fixes</h3>
* Symbolic Operation parameters are now compatible with TensorFlow 2.0 objects. [(282)](https://github.com/XanaduAI/strawberryfields/pull/282)
* Added `sympy>=1.5` to the list of dependencies. Removed the `sympy.functions.atan2` workaround now that SymPy has been fixed. [(280)](https://github.com/XanaduAI/strawberryfields/pull/280)
* Removed two unnecessary else statements that pylint complained about. [(290)](https://github.com/XanaduAI/strawberryfields/pull/290)
* Fixed a bug in the `MZgate`, where the internal and external phases were in the wrong order in both the docstring and the argument list. The new signature is `MZgate(phase_in, phase_ex)`, matching the existing `rectangular_symmetric` decomposition. [(301)](https://github.com/XanaduAI/strawberryfields/pull/301)
* Updated the relevant methods in `RemoteEngine` and `Connection` to derive `shots` from the Blackbird script or `Program` if not explicitly specified. [(327)](https://github.com/XanaduAI/strawberryfields/pull/327)
* Fixed a bug in homodyne measurements in the Fock backend, where computed probability values could occasionally include small negative values due to floating point precision error. [(364)](https://github.com/XanaduAI/strawberryfields/pull/364)
* Fixed a bug that caused an exception when printing results with no state. [(367)](https://github.com/XanaduAI/strawberryfields/pull/367)
* Improves the Takagi decomposition, by making explicit use of the eigendecomposition of real symmetric matrices. [(352)](https://github.com/XanaduAI/strawberryfields/pull/352)
<h3>Contributors</h3>
This release contains contributions from (in alphabetical order):
Ville Bergholm, Tom Bromley, Jack Ceroni, Theodor Isacsson, Josh Izaac, Nathan Killoran, Shreya P Kumar,
Leonhard Neuhaus, Nicolás Quesada, Jeremy Swinarton, Antal Száva, Paul Tan, Zeid Zabaneh.