Skip to content

dq.squeeze

squeeze(dim: int, z: ArrayLike) -> DenseQArray

Returns the squeezing operator of complex squeezing amplitude \(z\).

It is defined by $$ S(z) = \exp\left(\frac{1}{2}\left(z^* a^2 - z a^{\dag 2}\right)\right), $$ where \(a\) and \(a^\dag\) are the annihilation and creation operators, respectively.

Parameters

  • dim –

    Dimension of the Hilbert space.

  • z (array-like of shape (...)) –

    Squeezing amplitude.

Returns

(qarray of shape (..., dim, dim)) Squeezing operator.

Examples

>>> dq.squeeze(4, 0.5)
QArray: shape=(4, 4), dims=(4,), dtype=complex64, layout=dense
[[ 0.938+0.j  0.   +0.j  0.346+0.j  0.   +0.j]
 [ 0.   +0.j  0.818+0.j  0.   +0.j  0.575+0.j]
 [-0.346+0.j  0.   +0.j  0.938+0.j  0.   +0.j]
 [ 0.   +0.j -0.575+0.j  0.   +0.j  0.818+0.j]]
>>> dq.squeeze(4, [0.1, 0.2]).shape
(2, 4, 4)