Add complex variables #191

Open
SteveDiamond opened this Issue Jun 9, 2015 · 9 comments

Projects

None yet

4 participants

@SteveDiamond
Member

Currently you must embed complex variables in real variables, as shown here:

http://nbviewer.ipython.org/github/cvxgrp/cvxpy/blob/master/examples/notebooks/WWW/fir_chebychev_design.ipynb

@mlubin mlubin referenced this issue in JuliaOpt/Convex.jl Sep 17, 2015
Open

Support for complex variables? #103

@Edenharder

Could cvxopt adds complex variables directly now?

@SteveDiamond
Member

That's a good idea, but the main obstacle to adding complex variables is rewriting all the atoms to handle the complex case. It's not difficult, just time consuming.

@Edenharder

The quantum information theory is complex, where SDP is very useful. It will be great if cvxopt supports the complex case.

@sschnug
sschnug commented Mar 14, 2016

@Edenharder In the meantime, you could try picos, which seems to support a bit more of the tools you need. In my opinion, it is not as beautiful as cvxpy, but maybe it will help for your case.

@Edenharder

@sschnug I'll try. Thanks!

@phfaist
phfaist commented Oct 31, 2016

I second the wish for complex variables, it would be very helpful for SDPs in quantum information theory. In the meantime (for reference), I'm using the code

constraints = [
    A_R == A_R.T,
    A_I == -A_I.T,
    cvxpy.vstack( cvxpy.hstack(A_R, -A_I), cvxpy.hstack(A_I, A_R) ) >> 0
]

to represent a positive semidefinite constraint on a complex Hermitian matrix A = A_R + 1j*A_I. This is because A>>0 if and only if [[Re(A), -Im(A)], [Im(A), Re(A)]] >> 0. Is there a better way to do this?

@SteveDiamond
Member

There isn't really a better way. You could create A_R as a Symmetric variable. That would reduce the number of variables. There's no anti-symmetric variable right now though. You could hack https://github.com/cvxgrp/cvxpy/blob/master/cvxpy/expressions/variables/symmetric.py to add anti-symmetric variables.

@Edenharder

@phfaist @SteveDiamond Thanks! I make use of

 A>>0 if and only if [[Re(A), -Im(A)], [Im(A), Re(A)]] >> 0

currently, but it's not beautiful and convenient to do this transformation for each question.

@phfaist
phfaist commented Nov 1, 2016

@SteveDiamond Ok, thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment