← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
Technology Innovation Institute (TII) and the Qibo community
Grover search with Qibo
Official source: qiboteam/qibo
Download ZIP (free)A three-qubit Grover search with the open-source Qibo led by TII in Abu Dhabi, finding the target among 8 possibilities with about 95% probability. A tested example with a guide.
What is Qibo?
Qibo is an open-source quantum computing framework developed under the lead of the Technology Innovation Institute (TII) in Abu Dhabi. It aims to run the same Python code on a simulator (numpy and GPU-accelerated backends) or on laboratory hardware (Qibolab).
When to use it
- When you want to develop an algorithm on a simulator and move it to your own hardware with the same code (with the Qibolab and Qibocal tools).
- When you need to simulate large circuits quickly on a GPU.
- When working with variational circuits and hybrid algorithms such as VQE and QAOA.
The example in this package
grover_arama.py searches for the state 101 among 8 possibilities with
Grover's algorithm on 3 qubits. After two iterations (oracle + reflection)
about 950 out of 1000 measurements give the target; random guessing would give
12.5%.
Windows note
Qibo imports compiled packages such as osqp and qdldl through cvxpy. If Python
exits without any error message or with an "access violation", the cause is
usually an old Microsoft Visual C++ runtime on the computer (msvcp140.dll).
First install Microsoft's current "Visual C++ Redistributable" package:
https://aka.ms/vs/17/release/vc_redist.x64.exe
If you cannot update, older versions of these two packages also fixed the problem on our test machine:
pip install "osqp<1" "qdldl<0.1.9"
These steps are not needed on Linux and macOS.
Next steps
- Change the
HEDEF(target) variable to search for another state. - Increase the number of qubits to 4; the best number of iterations becomes
round(pi/4 * sqrt(16)) = 3.
Installation and running
pip install qibo
python grover_arama.py
Tested with: qibo 0.3.5, Python 3.12 (Windows and Linux; for Windows see the note in the guide).
Official source
- Repository: qiboteam/qibo
- Latest release: v0.3.5 — 16 September 2026
- Licence: Apache-2.0
- Stars: 366
- Default branch commit when the catalogue was built:
62579e9045a5(13 October 2026)
Links
Package contents
grover_arama.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 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.
grover_arama.py
"""Qibo ile 3 kübitlik Grover araması: 8 olasılık içinden |101> durumunu bul.
Çalıştırma:
pip install qibo
python grover_arama.py
"""
import numpy as np
from qibo import Circuit, gates, set_backend
set_backend("numpy")
np.random.seed(7)
N = 3
HEDEF = "101"
def oracle(c: Circuit) -> None:
# Hedef durumun fazını -1 yapar: 0 olan bitleri X ile çevir, CCZ uygula, geri çevir.
for i, bit in enumerate(HEDEF):
if bit == "0":
c.add(gates.X(i))
c.add(gates.Z(N - 1).controlled_by(*range(N - 1)))
for i, bit in enumerate(HEDEF):
if bit == "0":
c.add(gates.X(i))
def diffuser(c: Circuit) -> None:
# Ortalamaya göre yansıtma: H, X, CCZ, X, H.
c.add(gates.H(i) for i in range(N))
c.add(gates.X(i) for i in range(N))
c.add(gates.Z(N - 1).controlled_by(*range(N - 1)))
c.add(gates.X(i) for i in range(N))
c.add(gates.H(i) for i in range(N))
c = Circuit(N)
c.add(gates.H(i) for i in range(N))
# 8 eleman için en iyi tekrar sayısı: round(pi/4 * sqrt(8)) = 2
for _ in range(2):
oracle(c)
diffuser(c)
c.add(gates.M(*range(N)))
c.draw()
sonuc = c(nshots=1000)
frekans = dict(sorted(sonuc.frequencies().items()))
print("Ölçüm sonuçları:", frekans)
oran = frekans.get(HEDEF, 0) / 1000
print(f"|{HEDEF}> bulunma oranı: {oran:.1%} (rastgele tahmin: 12.5%)")
assert oran > 0.85, oran
print("Tamam: Grover hedefi yüksek olasılıkla buldu.")