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

[Tutorial Major issue] BBPSSW Protocol in Tutorial Chapter 3 Seems Wrong #171

Open
caitaozhan opened this issue Oct 29, 2023 · 2 comments
Open
Assignees

Comments

@caitaozhan
Copy link
Contributor

caitaozhan commented Oct 29, 2023

Hi SeQUeNCe team,

I tried tutorial/chapter3/example2.py about entanglement purification BBPSSW protocol. The outcome of the program is very confusing to me and doesn't seem correct. What is wrong is that when running example2.py, the purification is always successful, which in theory shouldn't be (The tutorial itself also says there are two possible outcomes, success or failure).

By looking into the code, what I figured wrong is that the initial state is not prepared correctly. According to BBPSSW protocol, the initial state should be a Werner State. But the tutorial prepared the initial state as |0>.

Moreover, tests/entanglement_management/test_purification.py also didn't prepare the initial state in Werner State, instead, it prepared in pure Bell States.

I think preparing the initial state of the system is a crucial step of the protocol and needs to be fixed.

Also, tutorial/chapter3/example3.py about entanglement swapping also incorrectly prepared the initial state of the system. The system should be prepared in an entangled Bell State such as phi_plus. But the system is prepared in an unentangled state of |0>

Thank you for your time,
Caitao

@caitaozhan caitaozhan changed the title [Totorial Major issue] BBPSSW Protocol in Tutorial Seems Not Right [Totorial Major issue] BBPSSW Protocol in Tutorial Seems Wrong Oct 29, 2023
@caitaozhan caitaozhan changed the title [Totorial Major issue] BBPSSW Protocol in Tutorial Seems Wrong [Totorial Major issue] BBPSSW Protocol in Tutorial Chapter 3 Seems Wrong Oct 29, 2023
@caitaozhan caitaozhan changed the title [Totorial Major issue] BBPSSW Protocol in Tutorial Chapter 3 Seems Wrong [Tutorial Major issue] BBPSSW Protocol in Tutorial Chapter 3 Seems Wrong Oct 29, 2023
@Alex-Kolar Alex-Kolar self-assigned this Oct 31, 2023
@Alex-Kolar
Copy link
Contributor

Hi Caitao,

Thanks for pointing this out. You are indeed correct in noting that the state should be properly initialized to the Werner state before running the protocol. The tutorial code was written for an older version of the source code that explicitly calculated the success probability using the fidelity, but this has since been changed.

I started a branch linked to this issue to fix this, and it looks like the example2.py code is running properly there. I will continue to fix the rest of the code/update the documentation.

Thanks,
Alex

@caitaozhan
Copy link
Contributor Author

caitaozhan commented Oct 31, 2023

Hi Alex,

Thanks for the clarification on chapter3/example2.py about the BBPSSW protocol.

For chapter3/example3.py about entanglement swapping, I will give some more clarification. What example3.py is printing is correct. But if you print the following in the end, you will find out that there is no Bell pair between node left and node right.

print(tl.quantum_manager.states[0])
print(tl.quantum_manager.states[1])
print(tl.quantum_manager.states[2])
print(tl.quantum_manager.states[3])

That is because the following function sets the initial state in |0> in the following function:

def entangle_memory(memo1: Memory, memo2: Memory, fidelity: float):
    memo1.reset()
    memo2.reset()

    memo1.entangled_memory['node_id'] = memo2.owner.name
    memo1.entangled_memory['memo_id'] = memo2.name
    memo2.entangled_memory['node_id'] = memo1.owner.name
    memo2.entangled_memory['memo_id'] = memo1.name

    memo1.fidelity = memo2.fidelity = fidelity

It is easy to fix, just add the following to the function:

    SQRT_HALF = 0.5 ** 0.5
    phi_plus = [SQRT_HALF, 0, 0, SQRT_HALF]
    tl.quantum_manager.set([memo1.qstate_key, memo2.qstate_key], phi_plus)

Thanks,
Caitao

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

When branches are created from issues, their pull requests are automatically linked.

2 participants