← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
Google Quantum AI
Cirq starter package
Official source: quantumlib/Cirq
Download ZIP (free)Cirq, Google Quantum AI's Python framework for NISQ circuits: an English guide and a tested three-qubit GHZ state example.
What is Cirq?
Cirq is the Python library Google Quantum AI developed for noisy intermediate-scale quantum (NISQ) computers. It stands out for modelling the placement of qubits on hardware and the timing of gates (moments) explicitly.
When to use it
- When you want to check how a circuit fits the qubit topology of the hardware.
- When working together with Google's other open tools (OpenFermion, qsim, Stim).
- When simulating experiments with noise models (
cirq.depolarizeand so on).
The example in this package
ghz_durumu.py puts three qubits into a GHZ state and measures them 1000
times. The three qubits together give either 000 or 111; mixed results
never appear.
Next steps
- Use
cirq.DensityMatrixSimulatorandcircuit.with_noise(cirq.depolarize(0.01))to see how noise spoils the result. - Try the fast simulator
qsimcirqfor larger circuits.
Installation and running
pip install cirq-core
python ghz_durumu.py
Tested with: cirq-core 1.7.0, Python 3.12.
Official source
- Repository: quantumlib/Cirq
- Latest release: v1.7.0 — 30 June 2026
- Licence: Apache-2.0
- Stars: 5,078
- Default branch commit when the catalogue was built:
f2ee71a2b4fa(13 October 2026)
Links
Package contents
ghz_durumu.pyREADME.en.md— this fileREADME.md— the same guide in TurkishLICENSE— the licence of the files in this packageKAYNAK.json— a machine-readable summary of the official sourceUPSTREAM-LICENSE.txt— the licence text of the official projectCITATION.cff— citation information of the official project
Licence
The example code and the guide in this package were written by the Quantum Store editors and are MIT licensed. The project it uses is subject to its own licence (Apache-2.0).
Quantum Store — https://hakanerdogan.com/en
Example code
The example shipped in the package, run and checked. Comments and printed messages are in Turkish; the code is the same in any language. Everything is in the ZIP.
ghz_durumu.py
"""Cirq ile 3 kübitlik GHZ durumu hazırla ve simüle et.
Çalıştırma:
pip install cirq-core
python ghz_durumu.py
"""
import cirq
q = cirq.LineQubit.range(3)
circuit = cirq.Circuit(
cirq.H(q[0]),
cirq.CNOT(q[0], q[1]),
cirq.CNOT(q[1], q[2]),
cirq.measure(*q, key="m"),
)
print(circuit)
result = cirq.Simulator(seed=7).run(circuit, repetitions=1000)
hist = result.histogram(key="m")
print("Sonuçlar (tamsayı olarak):", dict(sorted(hist.items())))
# GHZ durumunda üç kübit birlikte ya 000 (0) ya da 111 (7) ölçülür.
assert set(hist) <= {0, 7}, hist
print("Tamam: yalnızca 000 ve 111 ölçüldü.")
Related concepts
- Superposition · Superposition is the quantum state in which a qubit, before it is measured, holds the states 0 and 1 together with definite amplitudes.
- Quantum gate · A quantum gate is a basic operation that reversibly changes the state of one or more qubits; quantum programs are sequences of gates.
- Quantum circuit · A quantum circuit is a quantum program made of gates applied to qubits in order, followed by measurements.
- Bell state · A Bell state is one of four special states in which two qubits are entangled in the simplest and strongest way; the best known gives only 00 or 11 when measured.
- Quantum supremacy · Quantum supremacy is the demonstration that a quantum computer performs a specific task that the most powerful classical computers cannot complete in reasonable time.
- Qiskit · Qiskit is IBM’s open-source Python library for quantum programming; it lets you build circuits, run them on simulators and send them to IBM quantum computers.