Release 0.17.0
New features since last release
-
TDMProgram
objects can now be compiled and submitted via the API. (#476) -
Wigner functions can be plotted directly via Strawberry Fields using Plot.ly. (#495)
prog = sf.Program(1) eng = sf.Engine('fock', backend_options={"cutoff_dim": 10}) with prog.context as q: gamma = 2 Vgate(gamma) | q[0] state = eng.run(prog).state xvec = np.arange(-4, 4, 0.01) pvec = np.arange(-4, 4, 0.01) mode = 0 sf.plot_wigner(state, mode, xvec, pvec, renderer="browser")
-
Fock state marginal probabilities can be plotted directly via Strawberry Fields using Plot.ly. (#510)
prog = sf.Program(1) eng = sf.Engine('fock', backend_options={"cutoff_dim":5}) with prog.context as q: Sgate(0.5) | q[0] state = eng.run(prog).state state.all_fock_probs() modes = [0] sf.plot_fock(state, modes, cutoff=5, renderer="browser")
-
Position and momentum quadrature probabilities can be plotted directly via Strawberry Fields using Plot.ly. (#510)
prog = sf.Program(1) eng = sf.Engine('fock', backend_options={"cutoff_dim":5}) with prog.context as q: Sgate(0.5) | q[0] state = eng.run(prog).state modes = [0] xvec = np.arange(-4, 4, 0.1) pvec = np.arange(-4, 4, 0.1) sf.plot_quad(state, modes, xvec, pvec, renderer="browser")
-
Strawberry Fields code can be generated from a program (and an engine) by calling
sf.io.generate_code(program, eng=engine)
. (#496)
Improvements
-
Connection
objects now send versioned requests to the platform API. (#512) -
TDMProgram
allows application of gates with more than one symbolic parameter. #492 -
The
copies
option, when constructing aTDMProgram
, has been removed. Instead, the number of copies of a TDM algorithm can now be set by passing theshots
keyword argument to theeng.run()
method. (#489)>>> with prog.context([1, 2], [3, 4]) as (p, q): ... ops.Sgate(0.7, 0) | q[1] ... ops.BSgate(p[0]) | (q[0], q[1]) ... ops.MeasureHomodyne(p[1]) | q[0] >>> eng = sf.Engine("gaussian") >>> results = eng.run(prog, shots=3)
Furthermore, the
TDMProgram.unrolled_circuit
attribute now only contains the single-shot unrolled circuit. Unrolling with multiple shots can still be specified via theunroll
method:TDMProgram.unroll(shots=60)
. -
The
Result.samples
returned by TDM programs has been updated to return samples of shape(shots, spatial modes, timebins)
instead of(shots, spatial modes * timebins)
. (#489) -
A sample post-processing function is added that allows users to move vacuum mode measurements from the first shots to the last shots, and potentially crop out the final shots containing these measurements. (#489)
-
pytest-randomly
is added to the SF tests. (#480) -
TDMProgram
objects can now be serialized into Blackbird scripts, and vice versa. (#476)
Breaking Changes
- Jobs are submitted to the Xanadu Quantum Cloud through a new OAuth based authentication flow using offline refresh tokens and access tokens. (#520)
Bug fixes
-
Fixes a bug where
Dgate
,Coherent
, andDisplacedSqueezed
do not support TensorFlow tensors if the tensor has an added dimension due to the existence of batching. (#507) -
Fixes an issue with
reshape_samples
where the samples were sometimes reshaped in the wrong way. (#489) -
The list of modes is now correctly added to the Blackbird program when using the
io.to_blackbird
function. (#476) -
Fixes a bug where printing the
Result
object containing samples from a time-domain job would result in an error. Printing the result object now correctly displays information about the results. (#493) -
Removes the
antlr4
requirement due to version conflicts. (#494) -
TDMProgram.run_options
is now correctly used when running a TDM program. (#500) -
Fixes a bug where a single parameter list passed to the
TDMProgram
context results in an error. (#503)
Documentation
-
TDMProgram
docstring is updated to make it clear that only Gaussian programs are allowed. (#519) -
Clarifies special cases for the
MZgate
in the docstring. (#479)
Contributors
This release contains contributions from (in alphabetical order):
Tom Bromley, Jack Brown, Theodor Isacsson, Josh Izaac, Fabian Laudenbach, Tim Leisti, Nicolas Quesada, Antal Száva.