Overview

../_images/sfcomponents.svg

The Strawberry Fields codebase includes a number of complementary components. These can be separated into frontend components (engine.py, ops.py, and utils.py) and backend components (all found within the strawberryfields.backends submodule).

Software components

Frontend:

Backend:

Top-level functions

Engine(num_subsystems, **kwargs) Helper function for creating an engine and associated quantum register.
convert(func) Decorator for converting user defined functions to a RegRefTransform.
version() Version number of Strawberry Fields.

Code details

strawberryfields.version()[source]

Version number of Strawberry Fields.

Returns:package version number
Return type:str
strawberryfields.Engine(num_subsystems, **kwargs)[source]

Helper function for creating an engine and associated quantum register.

Parameters:num_subsystems (int) – number of subsystems in the quantum register
Keyword Arguments:
 hbar (float) – The value of \(\hbar\) to initialise the engine with, depending on the conventions followed. By default, \(\hbar=2\). See Conventions and formulas for more details.
Returns:tuple containing (i) a Strawberry Fields Engine object, and (ii) a tuple of quantum register references
Return type:(strawberryFields.engine.Engine, tuple[RegRef])
strawberryfields.convert(func)

Decorator for converting user defined functions to a RegRefTransform.

This allows classical processing of measured qumodes values.

Example usage:

@convert
def F(x):
    # some classical processing of x
    return f(x)

with eng:
    MeasureX       | q[0]
    Dgate(F(q[0])) | q[1]
Parameters:func (function) – function to be converted to a RegRefTransform.