Skip to content

Bell State Preparation

View on GitHub Experiment in the IDE

The prepare_bell_state function creates one of the four Bell states

\[\phi_{+} = \frac{1}{2} \left(|00\rangle + |11\rangle \right)\]
\[\phi_{-} = \frac{1}{2} \left(|00\rangle - |11\rangle \right)\]
\[\psi_{+} = \frac{1}{2} \left(|01\rangle + |10\rangle \right)\]
\[\psi_{-} = \frac{1}{2} \left(|01\rangle - |10\rangle \right)\]

Function: prepare_bell_state

Arguments:

  • state_num: CInt

  • q: Output[QArray[QBit]]

Example

The prepare_bell_state function creates

\[\psi_{+} = \frac{1}{2} \left(|01\rangle + |10\rangle \right)\]

state_num is set to 2

from classiq import *


@qfunc
def main(x: Output[QArray[QBit]]):
    prepare_bell_state(2, x)


qmod = create_model(main, out_file="prepare_bell_state")
qprog = synthesize(qmod)