sf.circuitspecs

Warning

Unless you are a Strawberry Fields developer, you likely do not need to use these classes directly.

This subpackage implements the CircuitSpecs class, an abstract base class used to define classes or families of quantum circuits, e.g., circuits that can be executed on particular hardware or simulator backends.

The information in the CircuitSpecs instances is used by Program.compile() to validate and compile quantum programs. By querying the CircuitSpecs class representing the requested compilation target, Program.compile() can

  1. Validate that the Program has the correct number of modes, and consists of valid quantum operations in the correct topology for the targeted circuit class.

  2. 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 CircuitSpecs instance. In particular, for each backend supported by Strawberry Fields the database contains a corresponding CircuitSpecs instance with the same short name, used to validate Programs to be executed on that backend.

Classes

CircuitSpecs

Abstract base class for describing circuit classes.

Chip0Specs

Circuit specifications for the chip0 class of circuits.

FockSpecs

Circuit specifications for the Fock backend.

GaussianSpecs

Circuit specifications for the Gaussian backend.

GBSSpecs

Circuit specifications for the general GBS class of circuits.

TFSpecs

Circuit specifications for the TensorFlow backend.

GaussianUnitary

Compiler to arrange a Gaussian quantum circuit into the canonical Symplectic form.

Variables

circuit_db

Map from circuit family short name to the corresponding class.

Class Inheritance Diagram

Inheritance diagram of strawberryfields.circuitspecs.circuit_specs.CircuitSpecs, strawberryfields.circuitspecs.chip0.Chip0Specs, strawberryfields.circuitspecs.fock.FockSpecs, strawberryfields.circuitspecs.gaussian.GaussianSpecs, strawberryfields.circuitspecs.gbs.GBSSpecs, strawberryfields.circuitspecs.tensorflow.TFSpecs, strawberryfields.circuitspecs.gaussian_unitary.GaussianUnitary