X error correction code in ProjectQ Python

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 960 views
Spark-X
Messages
1
Reaction score
0
I have been trying write a code in for error correction. I am new to programming and am unable to understand what is not alright. Can anyone please suggest some explanation?
from projectq.ops import All, CNOT, H, Measure, Rz, X, Z
from projectq import MainEngine
from projectq.meta import Dagger, Control
def X_correction():
qu1[2] = eng.allocate_qureg(2)
qu2[2] = eng.allocate_qureg(2)
entangle | qu1
entangle | qu2
entqu1 = CNOT | (qu1[0],qu2[0])
H|entqu1
measure | entqu1
H | entqu1
return entqu1
 
Physics news on Phys.org
You haven't really given enough information to help. But I suspect that the problem is how you're initializing entqu1 to be the result of an operator that might not return anything.

If you're just doing little experiments like this, I recommend a drag and drop editor like Quirk ( https://algassert.com/quirk ).