Skip to content

Commit

Permalink
(#217) fix qu discord for diag rho
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Jan 24, 2024
1 parent 71b82c8 commit 95b4473
Show file tree
Hide file tree
Showing 2 changed files with 216 additions and 147 deletions.
15 changes: 13 additions & 2 deletions quimb/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,14 @@ def gen_paj():


@zeroify
def quantum_discord(p, dims=(2, 2), sysa=0, sysb=1):
def quantum_discord(
p,
dims=(2, 2),
sysa=0,
sysb=1,
method="COBYLA",
tol=1e-12,
):
"""Quantum Discord for two qubit density operator.
If ``len(dims) > 2``, then the non-target dimensions will be traced out
Expand Down Expand Up @@ -984,7 +991,11 @@ def trial_qd(a):
return iab - owci((prja, prjb))

opt = minimize(
trial_qd, (pi / 2, pi), method="SLSQP", bounds=((0, pi), (0, 2 * pi))
trial_qd,
(pi / 2, pi),
method=method,
bounds=((0, pi), (0, 2 * pi)),
tol=tol,
)
if opt.success:
return opt.fun
Expand Down
Loading

0 comments on commit 95b4473

Please sign in to comment.