pygsti.tools.basistools.vec_to_stdmx

Contents

pygsti.tools.basistools.vec_to_stdmx#

vec_to_stdmx(v, basis, keep_complex=False)#

Convert a vector in this basis to a matrix in the standard basis.

Parameters:
  • v (numpy array) – The vector length 4 or 16 respectively.

  • basis ({'std', 'gm', 'pp', 'qt'} or Basis) – The basis type. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt). If a Basis object, then the basis matrices are contained therein, and its dimension is checked to match v.

  • keep_complex (bool, optional) – If True, leave the final (output) array elements as complex numbers when v is complex. Usually, the final elements are real (even though v is complex) and so when keep_complex=False the elements are forced to be real and the returned array is float (not complex) valued.

Returns:

The matrix, 2x2 or 4x4 depending on nqubits

Return type:

numpy array