sf.compilers¶
Warning
Unless you are a Strawberry Fields developer, you likely do not need to use these classes directly.
This subpackage implements the Compiler
class, an abstract base class used to define and
compile families of quantum circuits, e.g., circuits that can be executed on particular hardware or
simulator backends.
The information in the Compiler
instances is used by Program.compile()
to validate and
compile quantum programs. By querying the Compiler
class representing the requested compilation
target, Program.compile()
can
Validate that the Program consists of valid quantum operations in the correct topology for the targeted circuit class.
Compile the Program into an equivalent circuit that has the topology required by the targeted circuit class, decomposing circuit operations as required.
Note that the compilation process is not perfect and can provide false negatives: it can admit
failure by raising a CircuitError
even if the Program theoretically is equivalent to a
circuit that belongs in the target circuit class.
The circuit class database circuit_db
is a dictionary mapping the circuit family
short name to the corresponding Compiler instance.
In particular, for each backend supported by Strawberry Fields the database contains a
corresponding Compiler instance with the same short name, used to validate Programs to be
executed on that backend.
Classes¶
Abstract base class for describing circuit compilation. |
|
|
Lightweight class for representing a set of ranges of floats. |
Compiler for general Fock backends. |
|
Compiler for general Gaussian backends. |
|
Compiler for general Bosonic backends. |
|
Compiler for the general GBS class of circuits. |
|
Compiler to arrange a Gaussian quantum circuit into the canonical Symplectic form. |
|
General state compiler for the X class of circuits. |
|
Strict compiler for the X class of circuits. |
|
General interferometer or unitary compiler for the X class of circuits. |
|
Compiler that merges adjacent Gaussian operations into a single symplectic transformation, to reduce the depth of non-Gaussian programs. |
|
Compiler to write a sequence of passive operations as a single passive operation |
|
General compiler for Time-Domain Multiplexing (TDM) circuits. |
|
Compiler for 2-loop time-domain circuits with homodyne measurements. |
|
Compiler for 3-loop time-domain circuits with Fock measurements. |
Variables¶
Map from compiler name to the corresponding class. |
Class Inheritance Diagram¶
