Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantum discord bug #217

Closed
GustavJaeger opened this issue Jan 20, 2024 · 2 comments
Closed

Quantum discord bug #217

GustavJaeger opened this issue Jan 20, 2024 · 2 comments
Labels

Comments

@GustavJaeger
Copy link

GustavJaeger commented Jan 20, 2024

What happened?

The boundaries in the optimization routine of scipy.optimize.minimize are wrong for one of the parameters. Instead of going from 0 to pi it should go to 2 pi. Yes there are two minima, one in the 0 to pi and one in the pi to 2pi region, but the optimization can get stuck on the border, i.e. it returns 0 or pi as the parameter.

What did you expect to happen?

For classical-quantum states, i.e. \sum_i p_i | i X i | x rho_i the quantum discord should be 0. Diagonalized states are part of these, but the function in quimb does not output 0 as the quantum discord.

Minimal Complete Verifiable Example

import quimb as qu
s  = np.random.rand(4)
s /= np.sum(s)
s.sort()
s = np.diag(np.flip(s))
print(s)
print(qu.quantum_discord(s)) # should give the output 0 but does not

Relevant log output

No response

Anything else we need to know?

This can be easily fixed by modifying the boundaries in
opt = scipy.optimize.minimize( trial_qd, (qu.pi / 2 , qu.pi), method="SLSQP", bounds=((0,qu.pi), (0, 2 * qu.pi)) )
to be
opt = scipy.optimize.minimize( trial_qd, (qu.pi , qu.pi), method="SLSQP", bounds=((0, 2 * qu.pi), (0, 2 * qu.pi)) )

I checked the fix and it works.

Environment

with the lates quimb environment

@jcmgray
Copy link
Owner

jcmgray commented Jan 24, 2024

Hi @GustavJaeger, thanks for raising this!

I did try the fix but I still get non zero discords. However changing the optimizer to "COBYLA" seems to fix it. It seems that with "SLSQP" the optimization is unstable (depends on initial conditions) and doesn't converge well for diagonal states.

Also looking more carefully the optimization is over spherical coordinates $\theta$ and $\phi$ so I think the current bounds are right.

jcmgray added a commit that referenced this issue Jan 24, 2024
@jcmgray
Copy link
Owner

jcmgray commented Jan 25, 2024

I think this was fixed by the commit above so closing, but do reopen if you have more problems.

@jcmgray jcmgray closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants