Release 0.13.0
New features since last release
-
Adds initial support for the Xanadu's photonic quantum hardware. (#101) (#148) (#294) (#327) (#328) (#329) (#330) (#334) (#336) (#337) (#339)
Jobs can now be submitted to the Xanadu Quantum Cloud platform to be run on supported hardware using the new
RemoteEngine
: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 and tutorial.
-
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) (#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)
-
-
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) (#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.
-
-
New configuration functions to load configuration from keyword arguments, environment variables, and configuration files. (#298) (#306)
This includes the ability to automatically store Xanadu cloud platform credentials in a configuration file using the new function
sf.store_account("AUTHENTICATION_TOKEN")
as well as from the command line,
$ 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
-
Adds configuration functions for resetting, deleting configurations, as well as displaying available configuration files. (#359)
-
Adds the
x_quad_values
andp_quad_values
methods to thestate
class. This allows calculation of x and p quadrature probability distributions by integrating across the Wigner function. (#270) -
Adds support in the applications layer for node-weighted graphs.
Sample from graphs with node weights using a special-purpose encoding (#295):
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
andsubgraph
modules (#296) (#297):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]
from strawberryfields.apps import subgraph subgraph.search(s, g, min_size=5, max_size=8, node_select=w)
Improvements
-
Moved Fock backend apply-gate functions to
Circuit
class, and removedapply_gate_einsum
andCircuits._apply_gate
, since they were no longer used. (#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)
-
Modified the rectangular decomposition to ensure that identity-like unitaries are implemented with no swaps. (#311)
Bug fixes
-
Symbolic Operation parameters are now compatible with TensorFlow 2.0 objects. (#282)
-
Added
sympy>=1.5
to the list of dependencies. Removed thesympy.functions.atan2
workaround now that SymPy has been fixed. (#280) -
Removed two unnecessary else statements that pylint complained about. (#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 isMZgate(phase_in, phase_ex)
, matching the existingrectangular_symmetric
decomposition. (#301) -
Updated the relevant methods in
RemoteEngine
andConnection
to deriveshots
from the Blackbird script orProgram
if not explicitly specified. (#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)
-
Fixed a bug that caused an exception when printing results with no state. (#367)
-
Improves the Takagi decomposition, by making explicit use of the eigendecomposition of real symmetric matrices. (#352)
Contributors
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.