vectorize¶
- vectorize(density_matrix, method='col')[source]¶
Flatten an operator to a vector in a specified basis.
- Parameters
density_matrix (ndarray) – a density matrix.
method (str) –
the method of vectorization. Allowed values are:
’col’ (default) flattens to column-major vector.
’row’ flattens to row-major vector.
’pauli’ flattens in the n-qubit Pauli basis.
- ’pauli-weights’: flattens in the n-qubit Pauli basis ordered by
weight.
- Returns
the resulting vector.
- Return type
ndarray
- Raises
Exception – if input state is not a n-qubit state