Skip to content

Commit

Permalink
Bosonic backend nongaussian (#541)
Browse files Browse the repository at this point in the history
* Adds bosonic compiler

Co-Authored-By: ilan-tz <57886357+ilan-tz@users.noreply.github.com>
Co-Authored-By: Nicolas Quesada <991946+nquesada@users.noreply.github.com>

* Adds non-Gaussian state prep to bosonic backend

- Adds preparation methods for GKP, cat and Fock states
- Adds the run_prog and init_circuit methods which are the engines for running sf Programs in the bosonic backend
- Adds the frontend ops for calling these methods

Co-Authored-By: ilan-tz <57886357+ilan-tz@users.noreply.github.com>
Co-Authored-By: Nicolas Quesada <991946+nquesada@users.noreply.github.com>
Co-Authored-By: GDauphinais <48553380+GDauphinais@users.noreply.github.com>

* Bosonic backend tests

Tests for the bosonic backend

* ran black

* Tidying docstrings

* Codefactor changes

* Ran black and tidied test

* codefactor changes

* minor bug fixes

* codefactor and docstrings

* Change importing

* ran black + pylint disable

* docstrings and pytest marking

* ran black

* Fix hbar in test

* Fix add new mode and noninitial state prep

- Ensures that new modes can be added in program contexts, and that state preparation for the new mode can still be run
- Adds an error if more than one non-Gaussian state prep is attempted in the same mode
- Adds unit tests for the changes

* Disable too many branches for init_circuit

* Apply suggestions from code review

Co-authored-by: Theodor <theodor@xanadu.ai>

* Ran black

* Apply suggestions from code review

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* ran black

* Minor changes based on code review

* Fixes circular import

* Minor updates based on code review

* Docstring and comment tidying

* Minor edit for array construction

* Modifying code readability

* rename MSgate in compiler

* Fix heterodyne return shape

* Add MSgate to list of channels

* Apply suggestions from code review

Co-authored-by: antalszava <antalszava@gmail.com>

Co-authored-by: ilan-tz <57886357+ilan-tz@users.noreply.github.com>
Co-authored-by: Nicolas Quesada <991946+nquesada@users.noreply.github.com>
Co-authored-by: GDauphinais <48553380+GDauphinais@users.noreply.github.com>
Co-authored-by: Theodor <theodor@xanadu.ai>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
  • Loading branch information
7 people committed Feb 23, 2021
1 parent 3bd5318 commit 9ee646f
Show file tree
Hide file tree
Showing 7 changed files with 1,348 additions and 31 deletions.
2 changes: 1 addition & 1 deletion strawberryfields/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ class BaseBosonic(BaseGaussian):
"""Abstract base class for backends that are only capable of manipulating states
represented as linear combinations of Gaussian functions in phase space."""

compiler = None
compiler = "bosonic"

def __init__(self):
super().__init__()
Expand Down

0 comments on commit 9ee646f

Please sign in to comment.