Coder Social home page Coder Social logo

xanaduai / sfopenboson Goto Github PK

View Code? Open in Web Editor NEW
29.0 12.0 12.0 2.56 MB

A plugin for Strawberry Fields and OpenFermion, providing methods of simulating bosonic Hamiltonians directly in Strawberry Fields

Home Page: https://sfopenboson.readthedocs.io

License: Apache License 2.0

Makefile 1.27% Python 98.73%
quantum quantum-computing quantum-chemistry quantum-algorithms quantum-optics openfermion strawberryfields

sfopenboson's Introduction

SFOpenBoson

Travis Codecov coverage Codacy grade Read the Docs PyPI - Python Version

This Strawberry Fields plugin library allows Strawberry Fields to interface with OpenFermion.

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.

OpenFermion is an open source package for compiling and analyzing quantum algorithms that simulate fermionic systems.

Features

  • Construct bosonic Hamiltonians in OpenFermion, and apply the resulting time propagation using a CV quantum circuit.
  • Calculates the time-evolution unitary exactly for Gaussian Hamiltonians – these can then be decomposed into the base CV gate set of Strawberry Fields using the Bloch-Messiah decomposition.
  • Particular non-Gaussian gate decompositions, using the Trotter formula, are also supported, including Bose-Hubbard Hamiltonians.
  • The Hamiltonians submodule contains important OpenFermion-compatible CV Hamiltonians, including those corresponding to the gate set used in Strawberry Fields.

To get started, please see the online documentation

Installation

Installation of SFOpenBoson, as well as all required Python packages mentioned above, can be done using pip:

$ python -m pip install sfopenboson

Code authors

Josh Izaac.

If you are doing research using Strawberry Fields, please cite our whitepaper:

Nathan Killoran, Josh Izaac, Nicolás Quesada, Ville Bergholm, Matthew Amy, and Christian Weedbrook. Strawberry Fields: A Software Platform for Photonic Quantum Computing. arXiv, 2018. arXiv:1804.03159

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker.

We also have a Strawberry Fields Slack channel - come join the discussion and chat with our Strawberry Fields team.

License

SFOpenBoson is free and open source, released under the Apache License, Version 2.0.

sfopenboson's People

Contributors

josh146 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfopenboson's Issues

No module named 'strawberryfields.circuitspecs'

The sfopenboson plugin in Forced quantum harmonic oscillator tutorial here gives the following error

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-c0d26999d831> in <module>()
      2 import strawberryfields as sf
      3 from strawberryfields.ops import *
----> 4 from sfopenboson.ops import GaussianPropagation

/anaconda3/lib/python3.6/site-packages/sfopenboson/ops.py in <module>()
     95 from strawberryfields.backends.shared_ops import sympmat
     96 
---> 97 from strawberryfields.circuitspecs import GaussianSpecs, FockSpecs, TFSpecs
     98 
     99 from .auxillary import trotter_layer, quadratic_coefficients

ModuleNotFoundError: No module named 'strawberryfields.circuitspecs'

when from sfopenboson.ops import GaussianPropagation is imported.

Multiple test functions assume `hbar = 2`

Currently, a large number of test functions assume that hbar=2, and will fail if the default value of HBAR is changed in conftest.py.

These tests should be fixed to make them hbar dependent, and then HBAR set to an unconventional value such as 1.7 to ensure no hbar assumptions are baked in in future.

VisibleDeprecationWarning from numpy

Note: this is somewhat of a preemptive issue, assuming that the edits from #6 go through

Running:

>>> prog = sf.Program(2)
>>> with prog.context as q:
...     Fock(2) | q[1]
...     BoseHubbardPropagation(H, 1.086, 20) | q

from the Bose Hubbard Demo in the documentation will emit the following warning with numpy v1.21.4

auxillary.py:153: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.

I imagine (naively) that the fix involves inserting that dtype=object argument to the two np.array() calls on line 153:

ladders = np.array(list(np.array(group_list, dtype=object)[:, 1]), dtype=object)[:, :, 1]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.