pygsti.tools.optools.diamonddist

Contents

pygsti.tools.optools.diamonddist#

diamonddist(a, b, mx_basis='pp', return_x=False)#

Returns the approximate diamond norm describing the difference between gate matrices.

This is given by :

D = ||a - b ||_diamond = sup_rho || AxI(rho) - BxI(rho) ||_1

Parameters:
  • a (numpy array) – First matrix.

  • b (numpy array) – Second matrix.

  • mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

  • return_x (bool, optional) – Whether to return a numpy array encoding the state (rho) at which the maximal trace distance occurs.

Returns:

  • dm (float) – Diamond norm

  • W (numpy array) – Only returned if return_x = True. Encodes the state rho, such that dm = trace( |(J(a)-J(b)).T * W| ).