Photonic homomorphism
Scattering optical matrix to unitary¶
In [1]:
Copied!
from qoptcraft.operators import haar_random_unitary
from qoptcraft.evolution import photon_unitary
from qoptcraft.operators import haar_random_unitary
from qoptcraft.evolution import photon_unitary
In [2]:
Copied!
modes = 2
photons = 2
scattering = haar_random_unitary(modes)
modes = 2
photons = 2
scattering = haar_random_unitary(modes)
In [3]:
Copied!
photon_unitary(scattering, photons, method="heisenberg")
photon_unitary(scattering, photons, method="heisenberg")
Out[3]:
array([[ 0.62224776+0.16736712j, -0.58301157+0.3441163j , 0.08509526-0.3453061j ], [-0.14223473+0.661882j , 0.15926355+0.24082795j, -0.6647399 -0.12821619j], [-0.35106042-0.05686906j, -0.5448796 +0.40177697j, -0.08957428+0.63810694j]], dtype=complex64)
In [4]:
Copied!
photon_unitary(scattering, photons, method="hamiltonian")
photon_unitary(scattering, photons, method="hamiltonian")
Out[4]:
array([[ 0.62224773+0.16736712j, -0.58301156+0.34411631j, 0.08509526-0.3453061j ], [-0.14223473+0.66188201j, 0.15926355+0.24082795j, -0.66473989-0.12821619j], [-0.35106041-0.05686905j, -0.5448796 +0.40177697j, -0.08957428+0.63810692j]])
In [5]:
Copied!
photon_unitary(scattering, photons, method="permanent glynn")
photon_unitary(scattering, photons, method="permanent glynn")
Out[5]:
array([[ 0.62224773+0.16736712j, -0.58301156+0.34411631j, 0.08509526-0.3453061j ], [-0.14223473+0.66188201j, 0.15926355+0.24082795j, -0.66473989-0.12821619j], [-0.35106041-0.05686905j, -0.5448796 +0.40177697j, -0.08957428+0.63810692j]])
In [6]:
Copied!
photon_unitary(scattering, photons, method="permanent ryser")
photon_unitary(scattering, photons, method="permanent ryser")
Out[6]:
array([[ 0.62224773+0.16736712j, -0.58301156+0.34411631j, 0.08509526-0.3453061j ], [-0.14223473+0.66188201j, 0.15926355+0.24082795j, -0.66473989-0.12821619j], [-0.35106041-0.05686905j, -0.5448796 +0.40177697j, -0.08957428+0.63810692j]])
Unitary matrix to scattering optical matrix¶
In [7]:
Copied!
from qoptcraft import haar_random_unitary, photon_unitary, scattering_from_unitary
from qoptcraft import haar_random_unitary, photon_unitary, scattering_from_unitary
In [8]:
Copied!
modes = 2
photons = 2
S = haar_random_unitary(modes)
print(S)
modes = 2
photons = 2
S = haar_random_unitary(modes)
print(S)
[[ 0.73218165-0.14579358j -0.3330695 +0.5759505j ] [ 0.26699816-0.60939827j -0.31595657-0.67640016j]]
In [9]:
Copied!
U = photon_unitary(S, photons)
S_rebuilt = scattering_from_unitary(U, modes, photons)
print(S_rebuilt)
U = photon_unitary(S, photons)
S_rebuilt = scattering_from_unitary(U, modes, photons)
print(S_rebuilt)
[[ 0.74655592+0.j -0.4391329 +0.49981653j] [ 0.38086566-0.54552325j -0.17778012-0.72507928j]]
We can check that both matrices are proportional:
In [10]:
Copied!
S.conj().T @ S_rebuilt
S.conj().T @ S_rebuilt
Out[10]:
array([[ 9.80745894e-01+1.95288227e-01j, -2.22044605e-16-2.22044605e-16j], [-2.22044605e-16+1.38777878e-16j, 9.80745894e-01+1.95288227e-01j]])