Skip to content

dq.displace

displace(dim: int, alpha: ArrayLike) -> Array

Returns the displacement operator of complex amplitude \(\alpha\).

It is defined by $$ D(\alpha) = \exp(\alpha a^\dag - \alpha^* a), $$ where \(a\) and \(a^\dag\) are the annihilation and creation operators, respectively.

Parameters

  • dim –

    Dimension of the Hilbert space.

  • alpha (array_like of shape (...)) –

    Displacement amplitude.

Returns

(array of shape (..., dim, dim)) Displacement operator.

Examples

>>> dq.displace(4, 0.5)
Array([[ 0.882+0.j, -0.441+0.j,  0.156+0.j, -0.047+0.j],
       [ 0.441+0.j,  0.662+0.j, -0.542+0.j,  0.27 +0.j],
       [ 0.156+0.j,  0.542+0.j,  0.442+0.j, -0.697+0.j],
       [ 0.047+0.j,  0.27 +0.j,  0.697+0.j,  0.662+0.j]], dtype=complex64)
>>> dq.displace(4, [0.1, 0.2]).shape
(2, 4, 4)