qit.utils.inv_vec

qit.utils.inv_vec(v, dim=None)

Reshapes a vector into a matrix.

Reshapes vector v into a matrix \(\rho\) (shape == dim), using column-major ordering. If dim is not given, \(\rho\) is assumed to be square.

Used e.g. to convert state operators from superoperator representation to standard matrix representation.

Parameters
  • v (array) – vector to be reshaped, len == m*n

  • dim (Sequence[int]) – (m, n) == shape of the matrix