Skip to content

dq.displace

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

Returns the displacement operator of complex amplitude α\alpha.

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

Parameters

  • dim

    Dimension of the Hilbert space.

  • alpha (array-like of shape (...))

    Displacement amplitude.

Returns

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

Examples

>>> dq.displace(4, 0.5)
QArray: shape=(4, 4), dims=(4,), dtype=complex64, layout=dense
[[ 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]]
>>> dq.displace(4, [0.1, 0.2]).shape
(2, 4, 4)