cirq.mixture
Return a sequence of tuples representing a probabilistic unitary.
cirq.mixture(
val: Any, default: Any = RaiseTypeErrorIfNotProvided
) -> Sequence[Tuple[float, np.ndarray]]
Used in the notebooks
A mixture is described by an iterable of tuples of the form
(probability of unitary, unitary as numpy array)
The probability components of the tuples must sum to 1.0 and be
non-negative.
Args |
val
|
The value to decompose into a mixture of unitaries.
|
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.
|
Raises |
TypeError
|
If val has no _mixture_ or _unitary_ mehod, or if it
does and this method returned NotImplemented .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]