unvec

forest.benchmarking.operator_tools.superoperator_transformations.unvec(vector: numpy.ndarray, shape: Tuple[int, int] = None) → numpy.ndarray

Take a column vector and turn it into a matrix.

By default, the unvec’ed matrix is assumed to be square. Specifying shape = [N, M] will produce a N by M matrix where N is the number of rows and M is the number of columns.

Consider:

|A>> := vec(A) = (a, c, b, d)^T

unvec(|A>>) should return:

A = [[a, b]
     [c, d]]
Parameters:
  • vector – A (N*M) by 1 numpy array.
  • shape – The shape of the output matrix; by default, the matrix is assumed to be square.
Returns:

Returns a N by M matrix.