Hi Quantum People,

I have a question about the *expval()* function that is used in the class *MeasureAll*. The line of code that I don’t understand is shown in the following figure.

Let’s ignore the batch size. So, *probs* is a vector [p0, p1] where p0 is the marginal probability of 0 and p1 is the marginal probability of 1. And *observable.eigenvals* is [1, -1] for PauliZ. Thus, **res = [p0, p1] * [1, -1] = p0 - p1**.

**Question**: what is the math meaning of doing *probs.mv(observable.eigvals)*? And what is the physical meaning?

Thanks for your time,

Caitao Zhan