Skip to content

dq.position

position(dim: int) -> Array

Returns the position operator \(x = (a^\dag + a) / 2\).

Parameters

  • dim

    Dimension of the Hilbert space.

Returns

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

Examples

>>> dq.position(3)
Array([[0.   +0.j, 0.5  +0.j, 0.   +0.j],
       [0.5  +0.j, 0.   +0.j, 0.707+0.j],
       [0.   +0.j, 0.707+0.j, 0.   +0.j]], dtype=complex64)