← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
Quandela
Photonic quantum computing with Perceval: Hong-Ou-Mandel
Official source: Quandela/Perceval
Download ZIP (free)The Hong-Ou-Mandel effect with Perceval, Quandela's open-source framework for photonic quantum computers: a tested example showing that two photons always leave a beam splitter together.
What is Perceval?
Perceval is the open-source Python framework that the French company Quandela develops for its photonic (light-based) quantum computers. It works with optical modes and photons instead of qubits; you build circuits from linear optical components such as beam splitters and phase shifters.
When to use it
- When you want to learn photonic quantum computing and linear optics.
- When simulating photon-specific experiments such as boson sampling.
- When trying your circuit locally before sending jobs to Quandela's real photonic processors in the cloud.
The example in this package
hong_ou_mandel.py sends two identical photons into the two inputs of a 50:50
beam splitter. Classical intuition says the photons should leave through
separate outputs half the time; because of quantum interference the
probability of |1,1> is exactly zero, and the photons always leave together
(|2,0> or |0,2>). This is the Hong-Ou-Mandel effect, measured in 1987.
Licence note
Perceval is MIT licensed with an extra exception clause that allows use
together with Quandela's closed-source exqalibur library (which is why
GitHub cannot recognise the licence automatically). The full text is in
UPSTREAM-LICENSE.txt.
Next steps
- Change the beam splitter ratio with
pcvl.BS(theta=...)and see how the probability of|1,1>comes back. - Build a small boson sampling circuit with three modes and three photons.
Installation and running
pip install perceval-quandela
python hong_ou_mandel.py
Tested with: perceval-quandela 1.3.1, Python 3.12.
Official source
- Repository: Quandela/Perceval
- Latest release: v1.3.1 — 1 October 2026
- Licence: MIT
- Stars: 209
- Default branch commit when the catalogue was built:
64ed82f9c5e6(1 October 2026)
Links
Package contents
hong_ou_mandel.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 (MIT).
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.
hong_ou_mandel.py
"""Perceval ile Hong-Ou-Mandel etkisi: iki özdeş foton 50:50 ışın bölücüde birlikte çıkar.
Çalıştırma:
pip install perceval-quandela
python hong_ou_mandel.py
"""
import perceval as pcvl
devre = pcvl.BS() # 50:50 ışın bölücü, 2 optik mod
giris = pcvl.BasicState([1, 1]) # her girişe birer foton
backend = pcvl.BackendFactory.get_backend("SLOS")
backend.set_circuit(devre)
backend.set_input_state(giris)
dagilim = backend.prob_distribution()
for durum, olasilik in sorted(dagilim.items(), key=lambda kv: str(kv[0])):
print(f"{durum}: {olasilik:.3f}")
birer = dagilim.get(pcvl.BasicState([1, 1]), 0.0)
print(f"Fotonların ayrı çıkışlardan çıkma olasılığı |1,1>: {birer:.3f}")
assert birer < 1e-9, birer
assert abs(dagilim[pcvl.BasicState([2, 0])] - 0.5) < 1e-9
print("Tamam: fotonlar her zaman aynı çıkıştan birlikte çıktı (HOM etkisi).")