pygsti.tools.pdftools.tvd

Contents

pygsti.tools.pdftools.tvd#

tvd(p, q)#

Calculates the total variational distance between two probability distributions.

The distributions must be dictionaries, where keys are events (e.g., bit strings) and values are the probabilities. If an event in the keys of one dictionary isn’t in the keys of the other then that probability is assumed to be zero. There are no checks that the input probability distributions are valid (i.e., that the probabilities sum up to one and are positive).

Parameters:
  • p (dicts) – The distributions to calculate the TVD between.

  • q (dicts) – The distributions to calculate the TVD between.

Return type:

float