Skip to content

Instantly share code, notes, and snippets.

@guenp
Last active October 15, 2021 07:21
Show Gist options
  • Save guenp/a21b7dc64165a520b7b49a5cfdf1cd2b to your computer and use it in GitHub Desktop.
Save guenp/a21b7dc64165a520b7b49a5cfdf1cd2b to your computer and use it in GitHub Desktop.
Teleport: Simple example with classical feedback
{
"qubits": [
{
"id": 0,
"numChildren": 1
},
{
"id": 1,
"numChildren": 1
},
{
"id": 2
}
],
"operations": [
{
"gate": "Teleport",
"children": [
{
"gate": "Entangle",
"children": [
{
"gate": "H",
"targets": [
{
"qId": 1
}
]
},
{
"gate": "X",
"isControlled": true,
"controls": [
{
"qId": 1
}
],
"targets": [
{
"qId": 2
}
]
}
],
"targets": [
{
"qId": 1
},
{
"qId": 2
}
]
},
{
"gate": "PrepareMessage",
"children": [
{
"gate": "Random",
"displayArgs": "([0.5, 0.5])",
"children": [
{
"gate": "DrawCategorical",
"displayArgs": "([0.5, 0.5])",
"children": [
{
"gate": "DrawRandomDouble",
"displayArgs": "(0, 1)",
"targets": []
}
],
"targets": []
}
],
"targets": []
},
{
"gate": "SetPlus",
"children": [
{
"gate": "H",
"targets": [
{
"qId": 0
}
]
}
],
"targets": [
{
"qId": 0
}
]
}
],
"targets": [
{
"qId": 0
}
]
},
{
"gate": "Encode",
"children": [
{
"gate": "X",
"isControlled": true,
"controls": [
{
"qId": 0
}
],
"targets": [
{
"qId": 1
}
]
},
{
"gate": "H",
"targets": [
{
"qId": 0
}
]
}
],
"targets": [
{
"qId": 0
},
{
"qId": 1
}
]
},
{
"gate": "M",
"isMeasurement": true,
"controls": [
{
"qId": 0
}
],
"targets": [
{
"type": 1,
"qId": 0,
"cId": 0
}
]
},
{
"gate": "measure",
"isMeasurement": true,
"controls": [
{
"qId": 1
}
],
"targets": [
{
"type": 1,
"qId": 1,
"cId": 0
}
]
},
{
"gate": "Decode",
"children": [
{
"gate": "ApplyIfElseR",
"isConditional": true,
"controls": [
{
"type": 1,
"qId": 1,
"cId": 0
}
],
"targets": [],
"children": [
{
"gate": "X",
"controls": [
{
"type": 1,
"qId": 1,
"cId": 0
}
],
"targets": [
{
"qId": 2
}
],
"conditionalRender": 2
}
]
},
{
"gate": "ApplyIfElseR",
"isConditional": true,
"controls": [
{
"type": 1,
"qId": 0,
"cId": 0
}
],
"targets": [],
"children": [
{
"gate": "Z",
"controls": [
{
"type": 1,
"qId": 0,
"cId": 0
}
],
"targets": [
{
"qId": 2
}
],
"conditionalRender": 2
}
]
}
],
"controls": [
{
"type": 1,
"qId": 0,
"cId": 0
},
{
"type": 1,
"qId": 1,
"cId": 0
}
],
"targets": [
{
"qId": 2
}
]
}
],
"targets": [
{
"qId": 1
},
{
"qId": 2
},
{
"qId": 0
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment