Skip to content

dq.vector_to_operator

vector_to_operator(x: ArrayLike) -> Array

Returns the operator version of a vectorized operator.

The matrix \(A\) (shape \(n\times n\)) is obtained by stacking horizontally next to each other each group of \(n\) elements of the vectorized column vector \(\kett{A}\) (shape \(n^2\times 1\)): $$ \kett{A} = \begin{pmatrix} a \\ b \\ c \\ d \end{pmatrix} \to A = \begin{pmatrix} a & c \\ b & d \end{pmatrix}. $$

Parameters

  • x (array_like of shape (..., n^2, 1)) –

    Vectorized operator.

Returns

(array of shape (..., n, n)) Operator.

Examples

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