Skip to content

dq.create

create(*dims: int) -> Array | tuple[Array, ...]

Returns a bosonic creation operator, or a tuple of creation operators in a multi-mode system.

If only a single dimension is provided, create returns the creation operator of corresponding dimension. If instead multiples dimensions are provided, create returns a tuple of each creation operator of given dimension, in the Hilbert space given by the product of all dimensions.

Parameters

  • *dims –

    Variable length argument list of the Hilbert space dimensions.

Returns

(array or tuple of arrays) Creation operator of given dimension, or tuple of creation operators in a multi-mode system.

Examples

>>> dq.create(4)
Array([[0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [1.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 1.414+0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 0.   +0.j, 1.732+0.j, 0.   +0.j]], dtype=complex64)
>>> a, b = dq.create(2, 3)
>>> a
Array([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]], dtype=complex64)
>>> b
Array([[0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [1.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 1.414+0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 0.   +0.j, 0.   +0.j, 1.   +0.j, 0.   +0.j, 0.   +0.j],
       [0.   +0.j, 0.   +0.j, 0.   +0.j, 0.   +0.j, 1.414+0.j, 0.   +0.j]],      dtype=complex64)