I could manage to produce 3 qubit ghz state in Cirq. But I don't know how I can produce $|GHZ\rangle\langle GHZ|$ in Cirq Here is my code for 3 qubit ghz state Can you help me please for improving my code from $|GHZ\rangle$ to $|GHZ\rangle\langle GHZ|$:
n = 3
qubits = cirq.LineQubit.range ( n )
def circuit ():
circuit = cirq.Circuit ()
circuit.append (cirq.H(qubits[0]))
for i in range (n-1):
circuit.append ( cirq.CNOT ( qubits [i] , qubits [i+1]) )
circuit.append (cirq.measure (* qubits , key ='x') )
print (circuit)
return circuit
def simulation (circuit):
simulator = cirq.Simulator()
results = simulator.run ( circuit , repetitions = 200)
counts = cirq.plot_state_histogram (results)
def main():
simulation (circuit())
if __name__ == "__main__ ":
main ()
cirq.final_density_matrix(your_circuit)
(well.. if you omit the measurement it is). Or do you want a representation of this state to feed into other parts of cirq? Which parts? $\endgroup$