cirq.mixture

cirq.mixture(val: Any, default: Any = ((0.0, []), )) → Sequence[Tuple[float, Any]][source]

Return a sequence of tuples representing a probabilistic combination.

A mixture is described by an iterable of tuples of the form

(probability of object, object)
The probability components of the tuples must sum to 1.0 and be between
0 and 1 (inclusive).
Parameters:
  • val – The value whose mixture is being computed.
  • default – A default value if val does not support mixture.
Returns:

An iterable of tuples of size 2. The first element of the tuple is a probability (between 0 and 1) and the second is the object that occurs with that probability in the mixture. The probabilities will sum to 1.0.