vec

forest.benchmarking.operator_tools.superoperator_transformations.vec(matrix: numpy.ndarray) → numpy.ndarray

Vectorize, or “vec”, a matrix by column stacking.

For example the 2 by 2 matrix A:

A = [[a, b]
     [c, d]]

becomes:

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

where |A>> denotes the vec’ed version of A and \(^T\) denotes transpose.

Parameters:matrix – A N (rows) by M (columns) numpy array.
Returns:Returns a column vector with N by M rows.