Skip to content

dq.operator_to_vector

operator_to_vector(x: ArrayLike) -> Array

Returns the vectorized version of an operator.

The vectorized column vector \(\kett{A}\) (shape \(n^2\times 1\)) is obtained by stacking the columns of the matrix \(A\) (shape \(n\times n\)) on top of one another: $$ A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \to \kett{A} = \begin{pmatrix} a \\ c \\ b \\ d \end{pmatrix}. $$

Parameters

  • x (array_like of shape (..., n, n)) –

    Operator.

Returns

(array of shape (..., n^2, 1)) Vectorized operator.

Examples

>>> A = jnp.array([[1 + 1j, 2 + 2j], [3 + 3j, 4 + 4j]])
>>> A
Array([[1.+1.j, 2.+2.j],
       [3.+3.j, 4.+4.j]], dtype=complex64)
>>> dq.operator_to_vector(A)
Array([[1.+1.j],
       [3.+3.j],
       [2.+2.j],
       [4.+4.j]], dtype=complex64)