Toponogov approximation
Approximate a unitary with linear optics using Toponogov's theorem¶
In [1]:
Copied!
from qoptcraft.operators import qft
from qoptcraft.toponogov import toponogov
from qoptcraft.operators import qft
from qoptcraft.toponogov import toponogov
We can easily approximate a unitary with a certain error using the function toponogov
In [2]:
Copied!
modes = 3
photons = 2
unitary = qft(6)
approx_unitary, error = toponogov(unitary, modes, photons)
modes = 3
photons = 2
unitary = qft(6)
approx_unitary, error = toponogov(unitary, modes, photons)
We can iterate for different seeds:
In [4]:
Copied!
min_error = 10
for seed in range(30):
approx_unitary, error = toponogov(unitary, modes, photons, seed=seed)
if error < min_error:
min_approx_unitary = approx_unitary
min_error = error
min_error = 10
for seed in range(30):
approx_unitary, error = toponogov(unitary, modes, photons, seed=seed)
if error < min_error:
min_approx_unitary = approx_unitary
min_error = error
In [ ]:
Copied!
min_error
min_error
Out[ ]:
2.1494761713199346