TwoModeSqueezing

Hello! If applicable, put your complete code example down below. Make sure that your code:

  • is 100% self-contained — someone can copy-paste exactly what is here and run it to
    reproduce the behaviour you are observing
  • includes comments
def two_mode_squeezing(r, phi):
    """Two-mode squeezing.

    Args:
        r (float): squeezing magnitude
        phi (float): rotation parameter

    Returns:
        array: symplectic transformation matrix
    """
    cp = math.cos(phi)
    sp = math.sin(phi)
    ch = math.cosh(r)
    sh = math.sinh(r)

    S = np.array(
        [
            [ch, cp * sh, 0, sp * sh],
            [cp * sh, ch, sp * sh, 0],
            [0, sp * sh, ch, -cp * sh],
            [sp * sh, 0, -cp * sh, ch],
        ]
    )

If you want help with diagnosing an error, please put the full error message below:

I'm not sure but this symplectic covariance matrix doesn't match with the cml.TwoModeSqueezing Heisenberg representation matrix. Please let me know, if I'm thinking wrong. I want to learn the reason why you are using this symplectic matrix

And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about().

Hi @mcan06 , welcome to the Forum!

Just to clarify your question, you want to know why the symplectic transformation matrix here and the Heisenberg representation here are different for two-mode squeezing right?

Yes, I couldn’t understand why those matrices different. I thought that they should be the same.

Hello @mcan06,

Those matrices do turn out to be the same, except for two things:

  • The one in the Heisenberg representation accounts for the possibility of a displacement, which is why there is an extra row. But squeezing doesn’t displace, so the first row and column are (1, 0, 0, 0, 0). This stackexchange post has a nice explanation.
  • The other difference, if we forget about the extra row and column, is the order of the rows. This is probably because a difference convention is being used, which does seem to be a problem.

When using the Squeeze operators, please just focus on what the default_gaussian documentation says, since this is how the actual gates are being implemented. Also note that PennyLane does not specialize in continuous variables calculations and default_gaussian hasn’t had updates in a while. I would suggest taking a look at Strawberry Fields or Mr. Mustard for this kind of calculations, which are much more versatile.

Let me know if you have any other questions!

Alvaro

Hi,

Thank you for detailed explanation but I still couldn’t understand why the matrices are different, not mentioning first row and columns.

Thanks.

Hello @mcan06

The reason is that the second one is in the Heisenberg representation, which tells you how to transform the creation and annihilation operators a, a^{\dagger}, b, b^{\dagger}. It is the action of the gate in Fock space. The first matrix tell you how the position and momentum operators are transformed. It’s how the matrix acts in phase space, so it acts on the position and momentum operators of the modes.

Hope this helps!

Alvaro