Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bell decomp #584

Merged
merged 68 commits into from
May 25, 2021
Merged

Bell decomp #584

merged 68 commits into from
May 25, 2021

Conversation

jakeffbulmer
Copy link
Contributor

@jakeffbulmer jakeffbulmer commented May 18, 2021

This is the residency demo project by myself and Yuan @sylviemonet. We are implementing the decomposition in https://arxiv.org/abs/2104.07561


Context:
There are several ways to decompose a linear optical unitary transformation into 2x2 unitary elements. Here, we implement a new decomposition by Bell and Walmsley (https://arxiv.org/abs/2104.07561). This decomposition is lower in depth than e.g. 'rectangular' mesh in strawberryfields, as many of the phases are applied in parallel, resulting in just N+2 layers of phase shifters for an NxN unitary, instead of the 2N+1 layers of phase-shifters needed for the standard 'rectangular' decomposition.

Description of the Change:
We add a new gate: sMZgate, which has a phase shifter (Rgate) on each arm of the interferometer. We add functions to strawberryfields.decompositions: rectangular_compact and triangular_compact. These implement the rectangular/triangular decompositions described in https://arxiv.org/abs/2104.07561. We also add this functionality to the Interferometer operation, which can be accessed using the options mesh='rectangular_compact' and mesh='triangular_compact'.

Benefits:
Future devices may wish to use this decomposition instead of the conventional rectangular scheme, as it allows for a shorter depth, and so could lead to more compact footprint and lower loss. Therefore, having the decomposition available through strawberryfields could be useful for programming these future devices.

Possible Drawbacks:
We have used a different datastructure to store the phases as compared to the existing strawberryfields decompositions. This means that how the decomposition is handled inside Interferometer is different to the other mesh options.

Related GitHub Issues:

@nquesada nquesada self-requested a review May 20, 2021 13:29
Copy link
Contributor Author

@jakeffbulmer jakeffbulmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've implemented all your changes! Thanks very much for the review @josh146 !!

@jakeffbulmer jakeffbulmer requested a review from josh146 May 21, 2021 14:07
Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jakeffbulmer and @sylviemonet! Looks really nice, happy to approve on my end (conditional on a few suggested changes to improve docstring rendering)

.github/CHANGELOG.md Outdated Show resolved Hide resolved
.github/CHANGELOG.md Outdated Show resolved Hide resolved
.github/CHANGELOG.md Outdated Show resolved Hide resolved
strawberryfields/decompositions.py Outdated Show resolved Hide resolved
strawberryfields/decompositions.py Outdated Show resolved Hide resolved
strawberryfields/decompositions.py Outdated Show resolved Hide resolved
strawberryfields/decompositions.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Show resolved Hide resolved
tests/frontend/test_decompositions.py Outdated Show resolved Hide resolved
tests/frontend/test_decompositions.py Show resolved Hide resolved
@josh146
Copy link
Member

josh146 commented May 21, 2021

Oh, it also looks like there is still one Codecov/pylint warning:
image

You can fix this by adding the comment:

def _decompose(self, reg, **kwargs):
    """docstring"""
    # pylint: disable=too-many-branches

josh146 and others added 12 commits May 22, 2021 01:29
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Josh Izaac <josh146@gmail.com>
@nquesada nquesada merged commit df29b08 into XanaduAI:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants