Learn Strawberry-fields - 10 Code Examples & CST Typing Practice Test
Strawberry Fields is a Python library for photonic quantum computing using continuous-variable (CV) quantum systems. It enables the design, simulation, and execution of quantum circuits on photonic platforms.
View all 10 Strawberry-fields code examples →
Learn STRAWBERRY-FIELDS with Real Code Examples
Updated Nov 25, 2025
Explain
Strawberry Fields allows developers to construct and simulate quantum circuits using continuous-variable quantum computation, unlike qubit-based systems.
It supports both Gaussian and non-Gaussian states, making it suitable for photonic quantum algorithms.
The library abstracts complex quantum photonic operations and integrates with simulators and hardware backends for experimentation.
Core Features
High-level circuit construction using Python API
Built-in simulators (Fock, Gaussian, and TF backends)
Gate and measurement operations for CV systems
Support for quantum state tomography and analysis
Integration with TensorFlow and PyTorch for quantum ML
Basic Concepts Overview
Mode: the photonic equivalent of a qubit in CV systems
Gate: operations on modes (e.g., displacement, squeezing)
Circuit: sequence of gates applied to quantum modes
Measurement: extracting classical information from quantum modes
Backend: simulator or real photonic device executing the circuit
Project Structure
notebooks/ - interactive experiments and tutorials
circuits/ - custom CV quantum circuit definitions
simulations/ - backend simulation results
data/ - measurement outcomes and analyses
scripts/ - automation and utility functions
Building Workflow
Import Strawberry Fields and initialize a program
Add photonic modes to the circuit
Apply Gaussian and non-Gaussian gates
Measure modes to obtain classical outcomes
Simulate or execute on supported hardware backends
Difficulty Use Cases
Beginner: simulate simple Gaussian circuits
Intermediate: implement non-Gaussian operations
Advanced: quantum machine learning experiments
Expert: optimize large photonic circuits
Enterprise: integrate hybrid quantum-classical pipelines
Comparisons
Strawberry Fields vs Qiskit: SF targets CV photonic systems; Qiskit targets qubits on IBM hardware
Strawberry Fields vs Cirq: SF is photonic and CV; Cirq targets qubits on Google hardware
Strawberry Fields vs Pennylane: SF can integrate with Pennylane for hybrid ML
Strawberry Fields vs PyQuil: SF focuses on CV photonics; PyQuil targets Rigetti qubits
Strawberry Fields vs Braket: SF is specialized for CV photonics; Braket is multi-hardware qubit platform
Versioning Timeline
2018 - Initial release of Strawberry Fields by Xanadu
2019 - Fock and Gaussian backends added
2020 - Integration with PennyLane for quantum ML
2021 - TensorFlow backend with automatic differentiation
2023 - Support for multi-mode Gaussian boson sampling and photonic hardware backends
Glossary
Mode: photonic analog of a qubit
Gate: quantum operation on a mode
Circuit: sequence of gate operations
Gaussian state: quantum state with Gaussian statistics
Non-Gaussian state: quantum state with non-Gaussian properties
Frequently Asked Questions about Strawberry-fields
What is Strawberry-fields?
Strawberry Fields is a Python library for photonic quantum computing using continuous-variable (CV) quantum systems. It enables the design, simulation, and execution of quantum circuits on photonic platforms.
What are the primary use cases for Strawberry-fields?
Design and simulation of photonic quantum circuits. Quantum machine learning with CV systems. Hybrid classical-quantum algorithm development. Experimentation on photonic hardware backends. Research in Gaussian and non-Gaussian quantum states
What are the strengths of Strawberry-fields?
Specialized for photonic and CV quantum computing. Supports hybrid quantum-classical workflows. Python-based and easy to integrate with ML libraries. Rich simulation options for Gaussian and Fock circuits. Well-documented with tutorials and examples
What are the limitations of Strawberry-fields?
No direct access to general qubit-based quantum hardware. Steep learning curve for those unfamiliar with CV systems. Simulation complexity grows quickly with number of modes. Primarily research-oriented with fewer industrial applications. Requires understanding of quantum optics concepts
How can I practice Strawberry-fields typing speed?
CodeSpeedTest offers 10+ real Strawberry-fields code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.