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

Change cvxpy solver #11002

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,3 @@ numpy<1.25
# eigensystem code for one of the test cases. See
# https://github.com/Qiskit/qiskit-terra/issues/10345 for current details.
scipy<1.11

# cvxpy 1.4.0 caused an instability in some diamond-norm tests. That's
# likely to be an unreliable measure already given its nature, so this
# pin may be relaxed by modifying the tests slightly to choose known-safe
# operators.
cvxpy==1.3.2
5 changes: 3 additions & 2 deletions qiskit/quantum_info/operators/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def gate_error(
)


def diamond_norm(choi: Choi | QuantumChannel, **kwargs) -> float:
def diamond_norm(choi: Choi | QuantumChannel, solver: str = "SCS", **kwargs) -> float:
r"""Return the diamond norm of the input quantum channel object.

This function computes the completely-bounded trace-norm (often
Expand All @@ -260,6 +260,7 @@ def diamond_norm(choi: Choi | QuantumChannel, **kwargs) -> float:
Args:
choi(Choi or QuantumChannel): a quantum channel object or
Choi-matrix array.
solver (str): The solver to use.
kwargs: optional arguments to pass to CVXPY solver.

Returns:
Expand Down Expand Up @@ -344,7 +345,7 @@ def cvx_bmat(mat_r, mat_i):
# Objective function
obj = cvxpy.Maximize(cvxpy.trace(choi_rt_r @ x_r) + cvxpy.trace(choi_rt_i @ x_i))
prob = cvxpy.Problem(obj, cons)
sol = prob.solve(**kwargs)
sol = prob.solve(solver=solver, **kwargs)
return sol


Expand Down