localuf.noise.forcers¶
Classes for noise.CircuitLevel.force_error.
This method samples an error from the set of all errors of a given weight where weight can be an integer or a vector of integers depending on the noise model.
Classes
|
Forcer whose error subsets are distinguished by the weight of each of the 13 edge types. |
|
Forcer whose error subsets are distinguished by the weight of each of the 4 pair types. |
|
Same as |
- class localuf.noise.forcers.ForceByPair(edges)[source]¶
Bases:
_BaseForceByPairForcer whose error subsets are distinguished by the weight of each of the 4 pair types.
Extends
_BaseForceByPair. Use whenparametrization != 'balanced'. In this class, each weight is a 4-tuple of integers.- Parameters:
edges (dict[tuple[int, int, int, int], list[tuple[tuple[int, ...], tuple[int, ...]]]])
- property PAIR_POPULATIONS¶
- class localuf.noise.forcers.ForceByPairBalanced(edges)[source]¶
Bases:
_BaseForceByPairSame as
ForceByPairbut aggregating the last 3 pair subsets.Extends
_BaseForceByPair. Use whenparametrization == 'balanced'. In this class, each weight is a 2-tuple of integers.- Parameters:
edges (dict[tuple[int, int, int, int], list[tuple[tuple[int, ...], tuple[int, ...]]]])
- property PAIR_POPULATIONS¶
- class localuf.noise.forcers.ForceByEdge(edges)[source]¶
Bases:
_BaseForcerForcer whose error subsets are distinguished by the weight of each of the 13 edge types.
Slower than
ForceByPairas there are 13 edge types but only 4 pair types. Hence, use is discouraged.- Parameters:
edges (dict[tuple[int, int, int, int], list[tuple[tuple[int, ...], tuple[int, ...]]]])
- force_error(weight)[source]¶
Make error whose weight in edge subset
kisweight[k].- Parameters:
weight (tuple[int, ...])
- property ALL_WEIGHTS: tuple[tuple[int, ...], ...]¶
All possible
force_errorinputs.
- subset_probability(weights, pi)[source]¶
Compute probability of each subset characterized by
weightinweights.See
Noise.subset_probability.- Parameters:
weights – a tuple of inputs to
force_error.pi – a 4-tuple of probabilities.
- Returns:
probsan iterable of probabilities where each corresponds to aweightinweights.- Return type:
Iterable[float]
Example for
ForceByPairBalanced:weights = ((0, 0), (0, 1), (1, 0), (1, 1))B_k = B(n=len(self.PAIR_POPULATIONS[k]), p=pi[k])probs= (
B_0(0) * B_1(0),B_0(0) * B_1(1),B_0(1) * B_1(0),B_0(1) * B_1(1), )