Strawberry Fields v0.16.0 Released

We’re very excited to announce the release of Strawberry Fields version 0.16. :strawberry: :confetti_ball:

This release is focused on supporting time domain algorithms via the new sf.TDMProgram class and extending the apps.qchem module with new functions.


Time Domain :robot: :hourglass:

Highly scalable simulation of Gaussian states is now available with native support for time-domain multiplexing algorithms via the new TDMProgram class.

The following is an example for time domain program with 2 concurrent modes:

Code example
import strawberryfields as sf
from strawberryfields import ops

prog = sf.TDMProgram(N=2)

with prog.context([1, 2], [3, 4], copies=3) 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)

print(results.all_samples)
{0: [array([1.26208025]), array([1.53910032]), array([-1.29648336]),
array([0.75743215]), array([-0.17850101]), array([-1.44751996])]}


For more details see the Time-domain photonic circuits demonstration.


Vibronic Transition :atom_symbol:

The ability to apply the Doktorov operator on a given state is now available by using the VibronicTransition function from the apps.qchem.dynamics module.

Code example
from strawberryfields.apps.qchem.vibronic import VibronicTransition

modes = 2
p = sf.Program(modes)

with p.context as q:
    VibronicTransition(U1, r, U2, alpha) | q


Time evolution :clock8: :clock830: :clock9:

The time evolution operator can be applied on a given state using the TimeEvolution function from the apps.qchem.dynamics module.

Code example
modes = 2
p = sf.Program(modes)

with p.context as q:
    sf.ops.Fock(1) | q[0]
    sf.ops.Interferometer(Ul.T) | q
    TimeEvolution(w, t) | q
    sf.ops.Interferometer(Ul) | q

The full release notes are available at Release notes — Strawberry Fields 0.23.0 documentation.

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

@jmarrazola , @Tom_Bromley, @theodor, @josh, @sjahangiri, @nathan, Fabian Laudenbach, @Nicolas_Quesada, @antalszava, ‪Ilan Tzitrin.

3 Likes

When I try to upgrade sf via https://strawberryfields.readthedocs.io/en/stable/_static/install.html I get Requirement already satisfied: locket in c:\users\risto\appdata\local\programs\python\python39\lib\site-packages (from partd>=0.3.10->dask[delayed]->thewalrus>=0.15.0->strawberryfields) (0.2.1) - > why does it not upgrade to sf 0.16.?
I get same response with Shell & Conda.
After “import strawberryfields as sf” I get "
ModuleNotFoundError: No module named ‘strawberryfields’ "

Hi @_risto,

This seems like a constraint of how pip works. It usually falls back to the lowest compatible version when resolving dependencies. So when you ask for it install strawberryfields, and it finds a version, then it will just leave it.

If you want to force the upgrade, you can type pip install strawberryfields --upgrade. Also, if you want to install a very specific version (that may not be the latest), you can also do pip install strawberryfields==0.18

Your observed issue with ModuleNotFoundError could potentially be a distinct problem though. From your message text, it looks like SF is already installed; but since you are getting the error on import, it is possible that you have multiple virtual environments (e.g., conda), and the one that it is installed in is different from the one that you are using when typing import strawberry fields as sf. This is something that is worth you checking carefully, as it’s hard for us to provide debugging help related to your local environments

After running:
dev = qml.device(“strawberryfields.fock”, wires=1, cutoff_dim=10)
import pennylane as qml

dev = qml.device(‘strawberryfields.fock’, wires=2, cutoff_dim=10)

from https://pennylane.ai/qml/demos/quantum_neural_net.html

I get:
DeviceError Traceback (most recent call last)
in
----> 1 dev = qml.device(“strawberryfields.fock”, wires=1, cutoff_dim=10)
2 import pennylane as qml
3
4 dev = qml.device(‘strawberryfields.fock’, wires=2, cutoff_dim=10)

~\anaconda3\lib\site-packages\pennylane_init_.py in device(name, *args, **kwargs)
253 return plugin_device_class(*args, **options)
254
–> 255 raise DeviceError(“Device does not exist. Make sure the required plugin is installed.”)
256
257

DeviceError: Device does not exist. Make sure the required plugin is installed.

Hi @_risto,

Have you installed the Strawberry Fields plugin to PennyLane in the same environment? pip install pennylane-sf

Hi @nathan

Yes, I did.

Great, than can you please report the about of qml.about() running in the same session as where you received this error message? (remember to import pennylane as qml first :slightly_smiling_face:)

Hi @nathan

The issue has been resolved by an answer I got in another thread. Thank you :slight_smile:

Glad to hear it! :slightly_smiling_face: