pygsti.extras.paritybenchmarking.disturbancecalc.ResidualTVD

pygsti.extras.paritybenchmarking.disturbancecalc.ResidualTVD#

class ResidualTVD(weight, n_bits, initial_treg_factor=0.001, solver='CLARABEL')#

Bases: object

Computes the “weight-X residual TVD”: the TVD between two probability distributions up to weight-X transformations.

This corresponds to optimizing abs(Q - T*P) where P and Q are the two probability distributions and T is a transition matrix.

Create a ResidualTVD function object.

Parameters:
  • weight (int) – The weight: all stochastic errors of this weight or below are considered “free”, i.e. contribute nothing, to this residual TVD.

  • n_bits (int) – The number of bits (qubits).

  • initial_treg_factor (float, optional) – The magnitude of an internal penalty factor on the off-diagonals of the transition matrix (T), intended to eliminate unnecessarily-large T matrices which move a large proportion of probability between near-zero elements of both P and Q. You should only adjust this if you know what you’re doing.

  • solver (str, optional) – The name of the solver to used (see cvxpy.installed_solvers())

Methods

__init__(weight, n_bits[, ...])

Create a ResidualTVD function object.

build_transfer_mx([t_params, apply_abs])

Builds transition matrix from a vector of parameters

__call__(p, q, verbosity=1, warn=True)#

Compute the residual TVD.

Parameters:
  • p (numpy array) – The reference and test probability distributions, respectively, given as an array of probabilities, one for each 2**n_bits bit string.

  • q (numpy array) – The reference and test probability distributions, respectively, given as an array of probabilities, one for each 2**n_bits bit string.

  • verbosity (int, optional) – Sets the level of detail for messages printed to the console (higher = more detail).

  • warn (bool, optional) – Whether warning messages should be issued if problems are encountered.

Return type:

float

build_transfer_mx(t_params=None, apply_abs=True)#

Builds transition matrix from a vector of parameters