toqito icon indicating copy to clipboard operation
toqito copied to clipboard

Enhancement: Maximum confidence state distinguishability

Open vprusso opened this issue 4 years ago • 31 comments

Presently the state_distinguishability function in state_distinguishability.py includes minimum-error and unambiguous quantum state distinguishability using the argument dist_method = "min-error" and dist_method="unambiguous", respectively.

This task should enhance the state_distinguishability function to include the ability to compute the maximum confidence discrimination. Refer to Section 2.5 of arXiv:1707.02571, specifically the SDP below equation (31) in this section.

The formulation of the SDP should look familiar to the other distinguishability methods and should serve as an example for how to include this feature.

vprusso avatar Jan 28 '21 22:01 vprusso

@vprusso can I work on this?

harshvardhan-pandey avatar Mar 17 '25 19:03 harshvardhan-pandey

That would be great, go right ahead, @harshvardhan-pandey !

vprusso avatar Mar 17 '25 20:03 vprusso

@vprusso I have a small question regarding the already implemented strategies. Is it always guaranteed that the optimal measurement operators are hermitian? From what I understand, the measurement port just needs to be a POVM.

harshvardhan-pandey avatar Mar 18 '25 09:03 harshvardhan-pandey

Correct, the optimal measurements are POVMs (i.e. positive semidefinite operators that sum to the identity). But PSD operators are by definition always Hermitian, so yes, if the operators that form the POVM are PSD (which they need to be) they should, by definition also be Hermitian.

Let me know if that clears things up, @harshvardhan-pandey !

vprusso avatar Mar 18 '25 11:03 vprusso

Thanks! That clears it up. One question regarding the SDP

Image

This has simultaneous maximization of N functions p(rho_k|M_k) for k in range 1...N. It is possible that each of these optimization problems have different solutions right?

harshvardhan-pandey avatar Mar 18 '25 15:03 harshvardhan-pandey

To be clear, this is one maximization function that is operating over a choice of $N$ quantum states. The result of this optimization problem should only have one solution (which is the maximization over all such $p(\rho_k|M_k)$ items. Does that make sense?

vprusso avatar Mar 18 '25 15:03 vprusso

I see. So it is essentially maximize the maximum of p(rho_k|M_k)?

harshvardhan-pandey avatar Mar 18 '25 16:03 harshvardhan-pandey

I see. So it is essentially maximize the maximum of p(rho_k|M_k)?

Yes, this is what I take away from it, that's right.

vprusso avatar Mar 18 '25 16:03 vprusso

Interesting. That doesn't seem like a concave objective though. Because even if for each k, p(pho_k|M_k) is a concave function then their maximum is not guaranteed to be.

harshvardhan-pandey avatar Mar 18 '25 17:03 harshvardhan-pandey

Interesting. That doesn't seem like a concave objective though. Because even if for each k, p(pho_k|M_k) is a concave function then their maximum is not guaranteed to be.

Hmm, that is a good point. I would have to delve into their paper to get a handle on things. Maybe I am misinterpreting the optimization problem?

vprusso avatar Mar 18 '25 18:03 vprusso

Yeah. Even I haven't been able to look into the paper properly yet. I'll do that.

harshvardhan-pandey avatar Mar 18 '25 19:03 harshvardhan-pandey

From what it looks like based on section 2.5.2, for a given k, we can maximize p(rho_k|M_k) by just tuning M_k and then adjust M_{N+1} at end accordingly.

harshvardhan-pandey avatar Mar 18 '25 19:03 harshvardhan-pandey

From what it looks like based on section 2.5.2, for a given k, we can maximize p(rho_k|M_k) by just tuning M_k and then adjust M_{N+1} at end accordingly.

Ah, okay, interesting. Yeah, I think that sounds reasonable (at least from a quick glance and from your comment here). It might be good to see if the results from their paper using that approach could be replicated numerically as a sanity check.

vprusso avatar Mar 19 '25 01:03 vprusso

Hi @vprusso! Apologies for not getting back sooner, I was a little busy. I did try the solution mentioned in the paper. It works for the example they have given (three equiprobable symmetric qubit states that lie on the same latitude of the Bloch sphere). However, the result involves rho^(-1) whereas rho isn't always invertible. For example when the vectors are [bell(0), bell(1), bell(2)]. I am not sure how this can be handled. I will look into it further.

harshvardhan-pandey avatar Mar 23 '25 12:03 harshvardhan-pandey

@harshvardhan-pandey No worries! Hmm, I'm not entirely sure how that can be handled either, although I'm definitely interested in hearing about any progress or insights you come up with as you look into it! Happy to stay in the loop and try to help if I am able to. Thanks again for keeping me posted!

vprusso avatar Mar 23 '25 12:03 vprusso

I was considering that we could just abandon the solution framework presented by the paper. In the end, we have N independent optimization problems for M_1, ..., M_N. Those can be converted to SDPs using the Charnes–Cooper transformation.

harshvardhan-pandey avatar Mar 23 '25 16:03 harshvardhan-pandey

@harshvardhan-pandey That's true, and that might be worth going down that road. If you do decide to put some cycles on that, feel free to share any of that here, and I'll do my best to provide guidance and input as I am able to do so!

vprusso avatar Mar 23 '25 20:03 vprusso

Charnes–Cooper transformation

@harshvardhan-pandey I do not know what this is. Can you briefly explain this?

purva-thakre avatar Mar 24 '25 03:03 purva-thakre

@purva-thakre it is just a simple rearrangement. For example in this case, we want to maximize trace(M_k * rho_k)/trace(M_k * rho). I can instead maximize trace(M_k * rho_k) with the constraint that trace(M_k * rho) = 1. Because any positive semidefinite matrix which maximizes the original objective, can be scaled so that it maximizes the new objective and satisfies the new constraint.

harshvardhan-pandey avatar Mar 24 '25 05:03 harshvardhan-pandey

@vprusso I am stuck on a bug that I just can't seem to figure out. I am working on the example provided in the paper. The optimal value for trace(M_k * rho_k)/trace(M_k * rho) = 2 in that case. For some reason whatever I do cvxopt says 1 is the optimal answer.

n = len(vectors)
probs = np.array(probs)
density_matrices = np.array([to_density_matrix(vector) for vector in vectors])
rho = np.sum(probs[:, np.newaxis, np.newaxis] * density_matrices, axis=0) #rho = sum of probs[i] * density_matrices[i]
unscaled_measurement_operators = []

for rho_k in density_matrices:
    problem = picos.Problem()
    M_k = picos.HermitianVariable("M_k", (dim, dim))
    problem.set_objective("max", picos.trace(M_k @ rho_k).real)
    problem.add_constraint(M_k >> 0)
    problem.add_constraint(picos.trace(M_k @ rho) == 1)
    solution = problem.solve(solver=solver, verbosity=True, **kwargs)
    print(solution.value)
    unscaled_measurement_operators.append(M_k.value)
unscaled_measurement_operators = np.array(unscaled_measurement_operators)
states_max_confidence = [
    # Symmetric states on the same latitude of bloch sphere
    ([np.cos(np.pi/6)*e_0+np.sin(np.pi/6)*e_1,
      np.cos(np.pi/6)*e_0+np.exp(2*np.pi*1j/3)*np.sin(np.pi/6)*e_1,
      np.cos(np.pi/6)*e_0+np.exp(-2*np.pi*1j/3)*np.sin(np.pi/6)*e_1],
      [2/3, 2/3, 2/3]),
]

Is there anything obvious that I seem to be missing?

harshvardhan-pandey avatar Mar 29 '25 18:03 harshvardhan-pandey

Hi @harshvardhan-pandey ,

From what I can tell, each iteration of the loop is computing the optimal value of discriminating two states (rho and rho_k) Since these states are orthogonal, it should always be possible to distinguish these two states. Or am I maybe missing something?

vprusso avatar Mar 30 '25 00:03 vprusso

rho is the density matrix of the mixture. So if the states are rho_k, then rho = sum of p_k * rho_k.

harshvardhan-pandey avatar Mar 30 '25 02:03 harshvardhan-pandey

@harshvardhan-pandey Yes, but these are still two states, one is the average state of all of the states in the ensemble, and the other state is just one of the states from the set. At the end of the day, each iteration in the loop is still computing the distinguishability between two states; rho and rho_k, right?

vprusso avatar Mar 30 '25 11:03 vprusso

@vprusso I mean yes. But it is not doing optimal distinguishing. If we use the solution in the paper, this likelihood ratio comes out to be 2. However, this optimization setup computes 1. I was thinking maybe I have made some mistake with the convex optimization formulation. Should I maybe open a draft PR so that you can see the entire thing?

harshvardhan-pandey avatar Mar 30 '25 12:03 harshvardhan-pandey

@harshvardhan-pandey , yes it might be helpful to see the whole thing, so if you'd like to open a PR, that would be helpful!

vprusso avatar Mar 30 '25 12:03 vprusso

@vprusso I realized that even this kind of optimization setup requires rho to be invertible. So I am not sure what to do.

harshvardhan-pandey avatar Apr 04 '25 17:04 harshvardhan-pandey

Hmm, okay. Might be a silly and obvious question, but are there any such requirements on rho for any of the other state discrimination modalities to be invertible?

vprusso avatar Apr 04 '25 19:04 vprusso

I'm not sure. I'll look into it and get back.

harshvardhan-pandey avatar Apr 04 '25 21:04 harshvardhan-pandey

I'm not sure. I'll look into it and get back.

Sounds good, and thank you!

vprusso avatar Apr 04 '25 21:04 vprusso

I think the rest are fine because no explicit division by 0 issues exist. Also, I am applying for GSOC this year. Is it ok if I mention this issue even though it is not completely resolved by then? I have some ideas that may work, but I am a little under time constraints for the next few weeks.

harshvardhan-pandey avatar Apr 05 '25 12:04 harshvardhan-pandey