devectorize

devectorize(vectorized_mat, method='col')[source]

Devectorize a vectorized square matrix.

Parameters
  • vectorized_mat (ndarray) – a vectorized density matrix.

  • method (str) –

    the method of devectorization. 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 matrix.

Return type

ndarray

Raises

Exception – if input state is not a n-qubit state