GHZ State Preparation
Use the prepare_ghz_state
function to create a Greenberger-Horne-Zeilinger (GHZ) state.
i.e., a balanced superposition of all ones and all zeros, on an arbitrary number of qubits.
Syntax
Function: prepare_ghz_state
Arguments:
-
size: CInt
-
q: Output[QArray[QBit]]
Example
prepare_ghz_state
on 5 qubits
from classiq import *
@qfunc
def main(x: Output[QArray[QBit]]):
prepare_ghz_state(5, x)
qmod = create_model(main, out_file="prepare_ghz_state")
qprog = synthesize(qmod)