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

Add n-mode gaussian transformation gate in TFbackend #599

Merged
merged 151 commits into from
Nov 3, 2021

Conversation

sylviemonet
Copy link
Contributor

@sylviemonet sylviemonet commented Jun 23, 2021

This is the work to add an n-mode gaussian transformation gate (class Ggate) basing on TFbackend, with my supervisor @ziofil and with the help of @nquesada.

The main idea is to create the n-mode gaussian gate from its (S,d) parameters [Symplectic matrix and displacement vector] to its (C, mu, Sigma) parameters and then get the matrix of gate recursively.

[Warning:]
This gate has a special optimizer.

This gate haven't finished the decomposition part.

@ziofil ziofil self-requested a review June 23, 2021 16:06
@ziofil ziofil added the WIP label Jun 23, 2021
@sylviemonet
Copy link
Contributor Author

Can not pass the tests because it can not import the function from TW for now.

requirements.txt Outdated Show resolved Hide resolved
.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/ops.py Outdated Show resolved Hide resolved
idl = tf.eye(2 * m, dtype=dtype)
Rot = tf.cast(tf.math.sqrt(0.5), dtype=dtype) * tf.concat(
[tf.concat([idl, 1j * idl], 1), tf.concat([idl, -1j * idl], 1)], 0
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the Rot matrix should be available in TW somewhere (@nquesada). Also, perhaps we can avoid creating a new one each time?

)
sigma = Rot @ choi_cov @ tf.transpose(tf.math.conj(Rot))
zh = tf.zeros([2 * m, 2 * m], dtype=dtype)
X = tf.concat([tf.concat([zh, idl], 1), tf.concat([idl, zh], 1)], 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This too I believe is in TW

strawberryfields/backends/tfbackend/ops.py Outdated Show resolved Hide resolved
strawberryfields/ops.py Outdated Show resolved Hide resolved
@josh146 josh146 merged commit b446075 into XanaduAI:master Nov 3, 2021
Mandrenkov added a commit that referenced this pull request Nov 3, 2021
Mandrenkov added a commit that referenced this pull request Nov 3, 2021
* Lift TF installation assumption from frontend tests

* Update changelog

* Refactor mock TensorFlow imports

* Run black formatter

* Remove isolated .backend artefact from merge

* Use sf.LocalEngine() in frontend tests and gate TF version tests

* Restore test coverage to incorrect TF version check

* Restore TFBackend import to bottom of file

* Fix TF imports in frontend tests following #599

* Remove release note about TF test fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants