Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
APACHE-2.0 License
Bot releases are visible (Hide)
Published by co9olguy over 5 years ago
This is a significant release, with breaking changes to how quantum programs are constructed and executed. For example, the following Strawberry Fields program, <= version 0.10:
eng, q = sf.Engine(2, hbar=0.5)
with eng:
Sgate(0.5) | q[0]
MeasureFock() | q[0]
state = eng.run("fock", cutoff_dim=5)
ket = state.ket()
print(q[0].val)
would now be written, in v0.11, as follows:
sf.hbar = 0.5
prog = sf.Program(2)
eng = sf.Engine("fock", backend_options={"cutoff_dim": 5})
with prog.context as q:
Sgate(0.5) | q[0]
MeasureFock() | q[0]
results = eng.run(prog)
ket = results.state.ket()
print(results.samples[0])
The functionality of the Engine
class has been divided into two new classes: Program
, which represents a quantum circuit or a fragment thereof, and Engine
, which executes Program
instances.
Introduced the BaseEngine
abstract base class and the LocalEngine
child class. Engine
is kept as an alias for LocalEngine
.
The Engine API has been changed slightly:
The engine is initialized with the required backend, as well as a backend_options
dictionary, which is passed to the backend:
eng = sf.Engine("fock", backend_options={"cutoff_dim": 5}
LocalEngine.run()
now accepts a program to execute, and returns a Result
object that contains both a state object (Result.state
) and measurement samples (Result.samples
):
results = eng.run(prog)
state = results.state
samples = results.samples
compile_options
can be provided when calling LocalEngine.run()
. These are passed to the compile()
method of the program before execution.
run_options
can be provided when calling LocalEngine.run()
. These are used to determine the characteristics of the measurements and state contained in the Results
object returned after the program is finished executing.
shots
keyword argument can be passed to run_options
, enabling multi-shot sampling. Supported only
in the Gaussian backend, and only for Fock measurements.
The Gaussian backend now officially supports Fock-basis measurements (MeasureFock
), but does not update the quantum state after a Fock measurement.
Added the io
module, which is used to save/load standalone Blackbird scripts from/into Strawberry Fields. Note that the Blackbird DSL has been spun off as an independent package and is now a dependency of Strawberry Fields.
Added a new interferometer decomposition mach_zehnder
to the decompositions module.
Added a Configuration
class, which is used to load, store, save, and modify configuration options for Strawberry Fields.
hbar
is now set globally for the entire session, by setting the value of sf.hbar
(default is 2).
Added the ability to generate random real (orthogonal) interferometers and random block diagonal symplectic and covariance matrices.
Added two top-level functions:
about()
, which prints human-readable system info including installed versions of various Python packages.cite()
, which prints a bibtex citation for SF.Added a glossary to the documentation.
Added the circuitspecs
subpackage, containing the CircuitSpecs
class and a quantum circuit database.
The database can be used to
Program
belongs in a specific circuit class.Program
for a desired circuit target, e.g., so that it can be executed on a given backend.The way hbar is handled has been simplified:
hbar=2
internally.hbar
is now a global, frontend-only variable that the user can set at the beginning of the session. It is used at the Operation.apply()
level to scale the inputs and outputs of the backend API calls as needed, and inside the State
objects.Removed TensorFlow as an explicit dependency of Strawberry Fields. Advanced users can still install TensorFlow manually using pip install tensorflow==1.3
and use as before.
The behaviour and function signature of the GraphEmbed
operation has been updated.
Remove the unused Command.decomp
instance attribute.
Better error messages for the New
operation when used outside of a circuit.
Docstrings updated in the decompositions module.
Docstrings for Fock backend reformatted and cleaned up.
Cleaning up of citations and references.bib
file.
Typos in documentation fixed.
New
operation.Gate.merge()
measure_fock
in the TensorFlow backend which caused samples to be evaluated independently and for conditional states to be potentially decoupled from the measurement results.graph_embed
.This release contains contributions from (in alphabetical order):
Ville Bergholm, Tom Bromley, Ish Dhand, Karel Dumon, Xueshi Guo, Josh Izaac, Nathan Killoran, Leonhard Neuhaus, Nicolás Quesada.
Published by josh146 over 5 years ago
Added two new utility functions to extract a numerical representation of a circuit from an Engine object: extract_unitary
and extract_channel
.
Added a LaTeX quantum circuit drawer, that outputs the engine queue or the applied operations as a qcircuit compatible circuit diagram.
Added support for an alternative form of Clements decomposition, where the local phases occur at the end rather than in the middle of the beamsplitter array. This decomposition is more symmetric than the intermediate one, which could make it more robust. This form also makes it easier to implement a tensor-network simulation of linear optics.
Adds the GraphEmbed
quantum operation/decomposition to the Strawberry Fields frontend. This allows the embedding of an arbitrary (complex-valued) weighted adjacency matrix into a Gaussian boson sampler.
Adds support for the Reck decomposition
Added documentation to the Quantum Algorithms section on CV quantum neural networks
Test suite has been ported to pytest
Linting improvements
Made corrections to the Clements decomposition documentation and docstring, and fixed the Clements unit tests to ensure they are deterministic.
This release contains contributions from (in alphabetical order):
Shahnawaz Ahmed, Thomas R. Bromley, Ish Dhand, Marcus Edwards, Christian Gogolin, Josh Izaac, Nathan Killoran, Filippo Miatto, Nicolás Quesada.
Published by co9olguy almost 6 years ago
Updated the Strawberry Fields gallery, featuring community-submitted content (tutorials, notebooks, repositories, blog posts, research papers, etc.) using Strawberry Fields
Added the @operation
decorator, which allows commonly-used algorithms and subroutines to be declared in blackbird code as one-liner operations
Added a ThermalLossChannel
to the Strawberry Fields API (currently supported by the Gaussian backend)
Added a poly_quad_expectation
method to the state
objects for Gaussian and Fock backends
New and improved tests
Fixed typos in code/documentation
This release contains contributions from:
Juan Leni, Arthur Pesah, Brianna Gopaul, Nicolás Quesada, Josh Izaac, and Nathan Killoran.
Published by josh146 about 6 years ago
You can now prepare multimode states in all backends, via the following new quantum operations in strawberryfields.ops
:
Ket
DensityMatrix
Gaussian
Both Ket
and DensityMatrix
work with the Fock backends, while Gaussian
works with all three, applying the Williamson decomposition or, optionally, directly preparing the Gaussian backend with the provided Gaussian state.
Added Gaussian decompositions to the front-end; these can be accessed via the new quantum operations Interferometer
, GaussianTransform
, Gaussian
. These allow you to apply interferometers, Gaussian symplectic transformations, and prepare a state based on a covariance matrix respectively. You can also query the engine to determine the CV gate decompositions applied.
Added the cross-Kerr interaction, accessible via the quantum operation CKgate()
.
Added utilities for creating random covariance, symplectic, and Gaussian unitary matrices in strawberryfields.utils
.
States can now be compared directly for equality - this is defined separately for Gaussian states and Fock basis states.
eng.run()
and eng.reset()
now allow the user to alter parameters such as cutoff_dim
between runs.eng.reset_backend()
has been renamed to eng.reset()
, and now also implicitly resets the queue.eng.print_applied()
keeps track of multiple simulation runs, by using nested lists.This release contains contributions from:
Ville Bergholm, Christian Gogolin, Nicolás Quesada, Josh Izaac, and Nathan Killoran.
Published by josh146 over 6 years ago
Interferometer
, GaussianTransform
, CovarianceState
. These allow you to apply interferometers, Gaussian symplectic transformations, and prepare a state based on a covariance matrix respectively. You can also query the engine to determine the CV gate decompositions applied.strawberryfields.utils
.strawberryfields-gpu
that requires tensorflow-gpu
.fock_prob()
by avoiding inverting a matrix twice.Published by josh146 over 6 years ago
setup.py
, so that installation will now work for versions of tensorflow>=1.3,<1.7Published by josh146 over 6 years ago
First public release of Strawberry Fields