Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GHZ quantum circuit in Qiskit.

A GHZ quantum circuit is a quantum computing system that includes 3 entangled qubits.

A Greenberger–Horne–Zeilinger state (GHZ state) is a certain type of entangled quantum state that involves at least three subsystems.

Demo in IBM Quantum Composer.

def ghz():
"""
Create a GHZ (entangled 3-qubit system) quantum circuit.
"""
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0, 1)
qc.cx(0, 2)
qc.measure_all()
job = qiskit.execute(qc, qiskit.BasicAer.get_backend('qasm_simulator'), shots=1000)
print(job.result().get_counts())
{'000': 481, '111': 519}
@primaryobjects

This comment has been minimized.

Copy link
Owner Author

@primaryobjects primaryobjects commented Aug 5, 2021

ghz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment