![]() |
Least squares fidelity estimator with observable based on probabilities.
cirq.experiments.least_squares_xeb_fidelity_from_probabilities(
hilbert_space_dimension: int,
observed_probabilities: Sequence[Sequence[float]],
all_probabilities: Sequence[Sequence[float]],
observable_from_probability: Optional[Callable[[float], float]] = None,
normalize_probabilities: bool = True
) -> Tuple[float, List[float]]
Using the notation from the docstring of
least_squares_xeb_fidelity_from_expectations
, this function computes the
least squares fidelity estimate when the observable O_U has eigenvalue
corresponding to the computational basis state |z⟩ given by g(p(z)), where
p(z) = |⟨z|𝜓_U⟩|^2 and g is a function that can be specified. By default,
g is the identity function, but other choices, such as the logarithm, are
useful. By default, the probability p(z) is actually multiplied by the
Hilbert space dimension D, so that the observable is actually g(D * p(z)).
This behavior can be disabled by setting normalize_probabilities
to
False.
Args | |
---|---|
hilbert_space_dimension
|
Dimension of the Hilbert space on which the channel whose fidelity is being estimated is defined. |
observed_probabilities
|
Ideal probabilities of bitstrings observed in experiments. A list of lists, where each inner list contains the probabilities for a single circuit. |
all_probabilities
|
Ideal probabilities of all possible bitstrings.
A list of lists, where each inner list contains the probabilities
for a single circuit, and should have length equal to the Hilbert
space dimension. The order of the lists should correspond to that
of observed_probabilities .
|
observable_from_probability
|
Function that computes the observable from a given probability. |
normalize_probabilities
|
Whether to multiply the probabilities by the Hilbert space dimension before computing the observable. |
Returns | |
---|---|
A tuple of two values. The first value is the estimated fidelity.
The second value is a list of the residuals
f (e_U - u_U) - (m_U - u_U) of the least squares minimization. |