Skip to content

dq.tensor

tensor(*args: ArrayLike) -> Array

Returns the tensor product of multiple kets, bras, density matrices or operators.

The returned array shape is:

  • \((..., n, 1)\) with \(n=\prod_k n_k\) if all input arrays are kets with shape \((..., n_k, 1)\),
  • \((..., 1, n)\) with \(n=\prod_k n_k\) if all input arrays are bras with shape \((..., 1, n_k)\),
  • \((..., n, n)\) with \(n=\prod_k n_k\) if all input arrays are density matrices or operators with shape \((..., n_k, n_k)\).

Parameters

  • *args (array_like of shape (..., n_k, 1) or (..., 1, n_k) or (..., n_k, n_k)) –

    Variable length argument list of kets, bras, density matrices or operators.

Returns

(array of shape (..., n, 1) or (..., 1, n) or (..., n, n)) Tensor product of the input arrays.

Examples

>>> psi = dq.tensor(dq.fock(3, 0), dq.fock(4, 2), dq.fock(5, 1))
>>> psi.shape
(60, 1)