cirq.least_squares_xeb_fidelity_from_probabilities

THIS FUNCTION IS DEPRECATED.

IT WILL BE REMOVED IN cirq v0.16.

Use cirq.experiments.xeb_fitting (benchmark_2q_xeb_fidelities and fit_exponential_decays) instead.

Least squares fidelity estimator with observable based on probabilities.

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.