← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe

Quandela

Photonic quantum computing with Perceval: Hong-Ou-Mandel

SoftwareQuantum hardwareLicence: MITVersion: 1.3.15.6 KB

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

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

  1. Change the beam splitter ratio with pcvl.BS(theta=...) and see how the probability of |1,1> comes back.
  2. 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

Links

Package contents

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).")

← All packages

Share: X · LinkedIn