Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement two-mode summing unitary #52

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

Fe-r-oz
Copy link
Contributor

@Fe-r-oz Fe-r-oz commented Feb 22, 2025

This PR aims to fix #38 by implementing two-mode summing unitary.

Hi, Andrew! Thank you for your help and guidance! I am not sure why I landed to page 123 😅 of https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.88.09790. As you suggestion, I need to follow the information given much earlier in the paper!

The SUM gate can be realized using beamsplitter and squeeze, following the Bloch-Messiah decomposition:

$$\begin{align} \text{SUM}(\lambda) &= \text{BS}(\pi + 2\theta, -\pi/2) \left[ s(r) \otimes s(-r) \right] \text{BS}(2\theta, -\pi/2), \tag{209} \\\ \sinh r &= \frac{\lambda}{2}, \tag{210} \\\ \cos(2\theta) &= \tanh(r), \tag{211} \\\ \sin(2\theta) &= -\text{sech}(r). \tag{212} \end{align}$$

Therefore, we can use the already implemented operators squeeze and beamsplitter and use them to implement the twosumgate. The name follows the convention of similar to twosqueeze. I hope that this attempt is better than the previous attempt at least 😅 beamsplitter appears to not have the parameter to extra phase shift to I have excluded $-\pi/2$

julia> using Gabs;  using Gabs: twosumgate

julia> basis = QuadBlockBasis(2)
QuadBlockBasis(2)

julia> lambda = 1.0
1.0

julia> twosumgate(basis, lambda)
GaussianUnitary for 2 modes.
  symplectic basis: QuadBlockBasis
displacement: 4-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
symplectic: 4×4 Matrix{Float64}:
  0.17082   0.894427   0.0       0.0
 -0.894427  1.17082    0.0       0.0
  0.0       0.0        1.17082   0.894427
  0.0       0.0       -0.894427  0.17082

Edit:

I was wondering whether the following can be implemented as a test to check whether the correctness of approach. It seems that excluding extra phase $\phi$ of $\pi$ in $BS(\theta, \phi)$ changes the symplectic matrix 😅. According to 199, the two mode squeeze can be written after Bloch- Messiah decomposition as

$$TMS(r, \frac{\pi}{2}) = BS\left(\frac{\pi}{2}, 0\right) \left[s(r) \otimes s(r)\right] BS\left(\frac{\pi}{2}, \pi\right)$$

which can be written as excluding extra phase $\phi$ of $\pi$ in $BS(\theta, \phi)$:

function _test_twomode_squeeze(basis, r, theta)
    transmit1 = theta/2
    BS1 = beamsplitter(basis, transmit1)
    S1 = squeeze(QuadPairBasis(basis.nmodes - 1), r, 0.0)
    S2 = squeeze(QuadPairBasis(basis.nmodes - 1), r, 0.0)
    S_tensor = S1  S2
    transmit2 = theta/2
    BS2 = beamsplitter(basis, transmit2)
    final_symplectic = BS2.symplectic * S_tensor.symplectic * BS1.symplectic
    final_disp = BS2.disp + S_tensor.disp + BS1.disp
    return final_disp, final_symplectic
end

julia> r, theta = rand(Float64), rand(Float64)
(0.2695878972298862, 0.38699466312747455)

julia> basis = QuadPairBasis(2)
QuadPairBasis(2)

julia> _test_twomode_squeeze(basis,r,theta)[1]
4-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0

julia> _test_twomode_squeeze(basis,r,theta)[2]
4×4 Matrix{Float64}:
  0.468149   0.0       0.603379  0.0
  0.0        0.802684  0.0       1.03455
 -0.603379   0.0       0.468149  0.0
  0.0       -1.03455   0.0       0.802684

julia> twosqueeze(basis, r, theta)
GaussianUnitary for 2 modes.
  symplectic basis: QuadPairBasis
displacement: 4-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
symplectic: 4×4 Matrix{Float64}:
  1.03656    0.0       -0.252686  -0.102981
  0.0        1.03656   -0.102981   0.252686
 -0.252686  -0.102981   1.03656    0.0
 -0.102981   0.252686   0.0        1.03656

The current approach appears to be incorrect. I initially thought we could use the Bloch-Messiah decomposition for the two-sum gate and then leverage it to implement the gate. 😅

Copy link

codecov bot commented Feb 22, 2025

Codecov Report

Attention: Patch coverage is 36.66667% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/unitaries.jl 36.66% 19 Missing ⚠️
Files with missing lines Coverage Δ
src/Gabs.jl 100.00% <ø> (ø)
src/unitaries.jl 95.51% <36.66%> (-4.25%) ⬇️

@Fe-r-oz
Copy link
Contributor Author

Fe-r-oz commented Feb 23, 2025

Hi, Andrew! This paper provides (equation 14) the symplectic matrix of SUM gate https://arxiv.org/pdf/2502.07670 which in Gabs convention is in QuadBlockBasis :) I hope this is more relevant than my previous message 😅

The symplectic matrix of the SUM gate in the quadrature basis $(\hat{q}_1,, \hat{q}_2,, \hat{p}_1,, \hat{p})$

$$\mathrm{SUM} = \begin{pmatrix} 1 & 0 & 0 & 0\\[1mm] 1 & 1 & 0 & 0\\[1mm] 0 & 0 & 1 & -1\\[1mm] 0 & 0 & 0 & 1 \end{pmatrix}\, \tag{14}$$

The aforementioned paper cited this paper when providing the symplectic representation in quadrature basis.

@Fe-r-oz Fe-r-oz changed the title fix #38 - Implement two-mode summing unitary Implement two-mode summing unitary Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement two-mode summing unitary
1 participant