Skip to content

Add Quantum Teleportation algorithm#186

Open
DDDIGHE wants to merge 1 commit intoamazon-braket:mainfrom
DDDIGHE:feature/quantum-teleportation
Open

Add Quantum Teleportation algorithm#186
DDDIGHE wants to merge 1 commit intoamazon-braket:mainfrom
DDDIGHE:feature/quantum-teleportation

Conversation

@DDDIGHE
Copy link
Copy Markdown

@DDDIGHE DDDIGHE commented Feb 23, 2026

Issue #, if available: amazon-braket/amazon-braket-sdk-python#1194

Description of changes:
Added Quantum Teleportation algorithm implementation and a demonstration notebook. This includes the circuit construction using Bell pairs, qubit measurement, and correction operations, with examples verifying the teleportation fidelity on a local simulator.

Testing done:
Validated on LocalSimulator. Unit tests added covering the circuit construction and result verification.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3c92423) to head (94456fb).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #186   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        32    +2     
  Lines         1220      1244   +24     
  Branches       156       157    +1     
=========================================
+ Hits          1220      1244   +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

circ = Circuit()

# Prepare the state to teleport on qubit 0
if state_prep_circ is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

state_prep_circ must be a circuit for a single qubit. Please add this assumption more explicitly to the docstring, and add a validation here that throws an error if it's not a single-qubit circuit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, add a unit test about the validation.

Dict[str, float]: Probability of Bob's qubit in {"0": P(|0>), "1": P(|1>)}.
"""
probs = task.result().result_types[0].value
probs = np.round(probs, 10)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is the rounding needed?


# S†H maps |+i> to |0>, so successful teleportation => P(|0>) ~= 1
phase_sensitive_circuit = (
Circuit().add(teleportation_circuit.instructions).si(2).h(2).probability([2])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This kind of bypasses quantum_teleportation_circuit circuit by adding more gates. I understand that you add it for easier assertion in the test. Please add comment on the reason why you are doing it.

@@ -0,0 +1,7 @@
Quantum teleportation transfers an arbitrary quantum state from one qubit to another using a shared entangled Bell pair and classical communication. This implementation uses the deferred measurement principle, replacing mid-circuit measurements and classical feedforward with coherent CNOT and CZ corrections, so the circuit runs on any gate-based simulator.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be more complete to mention that the circuit generator is only implemented for a 3 qubit case. And mention your qubit layout

Qubit layout:
    qubit 0: message qubit (Alice's input)
    qubit 1: Alice's half of Bell pair
    qubit 2: Bob's half of Bell pair (receives teleported state)

@yitchen-tim
Copy link
Copy Markdown
Contributor

yitchen-tim commented Feb 24, 2026

@DDDIGHE Thanks again for contributing! It's a nice and elegant demo. After an internal discussion, we found it too restrictive that the algorithm only works with a particular setting of a 3-qubit circuit. Compare to other algorithms, it would be great that it is generalized. Therefore, we decided that, while this is a good PR and a good demo, this PR is qualified for the event if it is generalized:

  1. The algorithms can create a N-qubit teleportation circuit and it can take M-qubit state prep circuit as input. N is likely a function of M.
  2. IQM does support mid-circuit measurement and feedback. Implement the teleportation protocol using IQM's dynamic circuits capability. You can view this doc and this notebook about the capability.

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.

2 participants