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

ForceByEdge(edges)

Forcer whose error subsets are distinguished by the weight of each of the 13 edge types.

ForceByPair(edges)

Forcer whose error subsets are distinguished by the weight of each of the 4 pair types.

ForceByPairBalanced(edges)

Same as ForceByPair but aggregating the last 3 pair subsets.

class localuf.noise.forcers.ForceByPair(edges)[source]

Bases: _BaseForceByPair

Forcer whose error subsets are distinguished by the weight of each of the 4 pair types.

Extends _BaseForceByPair. Use when parametrization != '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: _BaseForceByPair

Same as ForceByPair but aggregating the last 3 pair subsets.

Extends _BaseForceByPair. Use when parametrization == '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: _BaseForcer

Forcer whose error subsets are distinguished by the weight of each of the 13 edge types.

Slower than ForceByPair as 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 k is weight[k].

Parameters:

weight (tuple[int, ...])

property ALL_WEIGHTS: tuple[tuple[int, ...], ...]

All possible force_error inputs.

subset_probability(weights, pi)[source]

Compute probability of each subset characterized by weight in weights.

See Noise.subset_probability.

Parameters:
  • weights – a tuple of inputs to force_error.

  • pi – a 4-tuple of probabilities.

Returns:

probs an iterable of probabilities where each corresponds to a weight in weights.

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), )