dq.vector_to_operator
vector_to_operator(x: QArrayLike) -> QArray
Returns the operator version of a vectorized operator.
The matrix (shape ) is obtained by stacking horizontally next to each other each group of elements of the vectorized column vector (shape ):
Parameters
-
x
(qarray-like of shape (..., n^2, 1))
–
Vectorized operator.
Returns
(qarray 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)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[1.+1.j 3.+3.j]
[2.+2.j 4.+4.j]]