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 mostnum_samples
unique weights.- Parameters:
- Return type:
- 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
, eitherEXACT
orSAMPLED
.