circuit_knitting.cutting.qpd.generate_qpd_weights

generate_qpd_weights(qpd_bases, num_samples=1000)[source]

Generate weights from the joint quasiprobability distribution.

Each weight whose absolute value is above a threshold of 1 / num_samples will be evaluated exactly. The remaining weights – those in the tail of the distribution – will then be sampled from, resulting in at most num_samples unique weights.

Parameters:
  • qpd_bases (Sequence[QPDBasis]) – The QPDBasis objects from which to generate weights

  • num_samples (float) – Controls the number of weights to generate

Return type:

dict[tuple[int, ...], tuple[float, WeightType]]

Returns:

A mapping from a given decomposition to its weight. Keys are tuples of indices – one index per input QPDBasis. The indices correspond to a specific decomposition mapping in the basis.

Values are tuples. The first element is a number corresponding to the weight of the contribution. The second element is the WeightType, either EXACT or SAMPLED.