pygsti.tools.mcfetools.hamming_distance_counts

pygsti.tools.mcfetools.hamming_distance_counts#

hamming_distance_counts(dsrow, circ, idealout)#

Utility function for MCFE VBDataFrame creation.

Compute the hamming distance counts for the outcomes of a circuit on n qubits.

Hamming distance is defined as the number of bits that are different between two bitstrings of the same length. E.g., the Hamming distance between 0010 and 1110 is 2.

Parameters:
  • dsrow (pygsti.data.dataset.DataSetRow) – Row in dataset containing outcome information for all mirror circuits.

  • circ (pygsti.circuits.Circuit) – pyGSTi circuit to which the outcome counts in dsrow pertain.

  • idealout (string) – length-n string that defines the target bitstring for the circuit. All Hamming distances are calculated relative to this string.

Returns:

Array whose indices correspond to Hamming distances from idealout, and whose values at each index correspond to the number of counts in dsrow that have that Hamming distance.

Return type:

np.ndarray[float]