In the paper Maximum Likelihood, Minimum Effort, given an orthonormal Hermitian operator basis $\{\sigma_i\}_{i=1}^{d^2}$ of $d \times d$ matrices and a set of measured values $m_{ij}$ corresponding to the $j$th measurement of the expectation value $\sigma_i$ applied to the true state $\rho_0$, the authors give the definition of a matrix $\mu$ as $$ \mu = \frac{1}{d}\sum_i m_i\sigma_i, $$ where $m_i = \sum_{j=1}^n \frac{m_{ij}}{n}$ and $n$ is the number of measurements. After defining this matrix, further optimization is done to approximate the density matrix of the true state.

I'm trying to implement this procedure for a single qubit as follows.

  1. To get $m_i$, I am first measuring the true state in the $X$, $Y$, $Z$ bases. With the counts for each circuit, I'm running the following code:
m = 0
    m += count['0'] # measurement of |0> has eigenvalue of +1
    m -= count['1'] # measurement of |1> has eigenvalue of -1
m /= shots
  1. Using the respective $m_i$, I'm calculating the matrix $\mu$ according to the formula as (where ms is a list with the three values calculated in step 1):
mu = (ms[0] * Z + ms[1] * X + ms[2] * Y) / 3.

However, after inputing the resulting matrix through the Fast algorithm for Subproblem 1 described later on in the paper, I'm not getting the expected results as I always get all the eigenvalues $\lambda_i$ set to $0$. I don't think there is any problem in my implementation of the Fast algorithm for Subproblem 1 as I tested it with the values given in Figure 1 of the same paper and I got the expected results.

Therefore, I suspect there is something wrong in my calculation of the matrix $\mu$. Is there something I'm missing or interpreted incorrectly?


1 Answer 1


A quick thing before answering to the actual question: your first code snippet can be replaced by

m = (count.get('0', 0) - count.get('1', 0)) / shots

Now, if we follow the formulas you wrote, in $2$ dimensions (which is $1$ qubit), you should have $2\times 2 = 4$ projectors. So you are missing one projector. In fact, you are missing the identity. The set of matrices you should consider is given in the equation between equations 4 and 5 in the paper you linked:

$$ \left\{ \sigma_0, \sigma_1, \sigma_2, \sigma_3 \right\} = \left\{ I, X, Y, Z \right\}. $$

In your point 2., in the formula, the dimension $d$ is $2$. Adding the identity and fixing this typo gives:

mu = (I + ms[0] * Z + ms[1] * X + ms[2] * Y) / 2

Note that the factor in front of the identity is always $1$.

PS: when I learned about state tomography, I found this PDF to be quite useful to start.

  • $\begingroup$ Thanks for the help! The code now works as expected. My misunderstanding was that I did considered to include the identity in mu but didn't figure out what should be the factor, thanks! And just one note, I think you meant to change 3 for 2 in the last codeblock (at least that way it works for me). $\endgroup$
    – epelaez
    Aug 10, 2021 at 13:00
  • 1
    $\begingroup$ Right, I just fixed the issue, I copy-pasted your code and forgot to change the 3 to 2, thank you! $\endgroup$ Aug 10, 2021 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.