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 Quantum Teleportation to examples. #1449

Merged
merged 9 commits into from
Mar 20, 2019
Merged

Add Quantum Teleportation to examples. #1449

merged 9 commits into from
Mar 20, 2019

Conversation

davemc84
Copy link
Collaborator

Very simplistic Quantum Teleporation example that might serve as an instructive file.

Very simplistic Quantum Teleportation example that might serve as an instructive file.
Add Quantum Teleportation to examples_perf_test.py
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Mar 19, 2019
@davemc84 davemc84 changed the title Add Quantum Teleporation to examples. Add Quantum Teleportation to examples. Mar 19, 2019
@davemc84
Copy link
Collaborator Author

As a heads-up, although the following line in quantum_teleportation.py passes the Travis CI tests:

(cirq.bloch_vector_from_state_vector(step.state_vector(), 0))

That line needs to be revised to the following for it to run correctly:

(cirq.bloch_vector_from_state_vector(step.state(), 0))

@Strilanc
Copy link
Contributor

What do you mean it needs to be revised? Why isn't it revised already?

examples/quantum_teleportation.py Outdated Show resolved Hide resolved
examples/quantum_teleportation.py Outdated Show resolved Hide resolved
examples/quantum_teleportation.py Outdated Show resolved Hide resolved
examples/quantum_teleportation.py Outdated Show resolved Hide resolved


def make_quantum_teleportation_circuit():
circuit = cirq.Circuit()
Copy link
Contributor

Choose a reason for hiding this comment

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

cirq.Circuit.from_ops would avoid a lot of append boilerplate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks very much for this feedback. Please let me know if I misunderstood your comment, but I have amended the code to be as follows: message = sim.simulate(cirq.Circuit.from_ops([cirq.X(0)**ranX, cirq.Y(0)**ranY])) which avoids the append boilerplate to get the bloch sphere of the message.

Again, please do let me know if I misunderstood what you were looking for here and thanks so much for this suggestion!

examples/quantum_teleportation.py Outdated Show resolved Hide resolved
Updated the circuit slightly, changed some nomenclature for key variables, changed the manner in which the message is generated and initially read, and revised the descriptive commentary accordingly.
Removed a stray variable that was no longer used.
@davemc84
Copy link
Collaborator Author

What do you mean it needs to be revised? Why isn't it revised already?

My apologies that my earlier comment was unclear. This code has been removed in the latest version, so this is no longer an issue.

In case it is helpful, the point I was trying to make is that Travis CI liked step.state_vector(), but that did not seem to work when I tried to run the code, with this working for me instead: step.state(). As such, I was unsure which I should use. That said, as I mentioned above, this has been entirely rewritten, so is no longer an issue in the actual code.

Thanks again for all of your help - I really do appreciate it!

Copy link
Contributor

@Strilanc Strilanc left a comment

Choose a reason for hiding this comment

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

LGTM

Will revisit when classical postprocessing is added.

@Strilanc Strilanc merged commit e8cbb2b into quantumlib:master Mar 20, 2019
@vtomole
Copy link
Collaborator

vtomole commented Mar 20, 2019

Tagging: #887

@davemc84 davemc84 deleted the patch-1 branch March 25, 2019 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants