Log( {complex affine} )

Assume I have a variable v \in \mathbb{C}^{N\times N}, defined as variable v(N,N) complex. Now, when I do log(1+v), in constraint/optimization problem, CVX says,

Disciplined convex programming error:
Illegal operation: log( {complex affine} ).

What is the possible cause of errors?

v is comlex affine, which is what you defined.

even if I try with real(LHS)==real(RHS) in the constraint, the problem still exists, any suggestion, how to use log( {complex affine} ).

Does it mean that CVX cannot support log( {complex affine} )?

yes. please read CVX users’ guide

Further to @jackfsuia 's point:

help cvx\log

Disciplined convex programming information:
log(X) is concave and nondecreasing in X. When used in CVX
expressions, X must be concave.

Disciplined geometric programming information:
    log(X) is typically not used in geometric programs. Technically it
    possible to do so in certain advanced cases, because monomials and
    posynomials are treated by CVX as log-affine and log-convex
    constructs, respectively. However, such usage is undocumented and
    will not be officially supported.

A complex argument can’t be concave (or convex).

Thanks, I have solved the complex affine issue.

(Although it is not related to the original question) Now it shows, Illegal operation: log( {convex} ).

I am trying to reformulate the constraint, do you think that 5.2.6 Log-sum-exp in https://docs.mosek.com/modeling-cookbook/expo.html would be an alternative?

You haven’t shown us the mathematical formulation of the optimization problem you want to solve.

here it goes:

variable v(N,N) complex
variable t

subject to
log(1+trace(abs(a*v))) >= inv_pos(t-b);

a and b are constant.

log(1+trace(abs(a*v))) is neither convex nor convave, so it can’t be expressed by cvx

By the way, could you please see this? Log( {convex} )

The problem in the link is different than yours.

So, in your eyes, is this log(1+a*v) >= inv_pos(t-b) a non-convex?

Consider the real scalar case, with a = 1.

log(1+abs(v)) is not concave, as it would need to be in order for that constraint to be convex

The following example shown the non-concavity of log(1+abs(v)).

Let v1 = -1, v2 = 1. v3 = 0.5*(v1+v2).

Then log(1+abs(v3)) = log(1) = 0

0.5*log(1+abs(v1)) + 0.5*log(1+abs(v2)) = log(2) > log(1+abs(v3))

which shows log(1+abs(v)) is not concave.

does it hold even if v is >=0 and \text{rank(v)} = 1?

If v is real and >= 0, then abs(v) can be replaced by v, and the LHS would be concave, making the constraint convex. The is because log(affne) is concave.

yes, you are right. So, do you have any suggestion on how to express this?

log(1+a*v) >= inv_pos(t-b)

where v and t are real cvx variable and >=0.

CVX should accept that as is.

I got the error as follows:

Error using cvx/log (line xx)
Disciplined convex programming error:
    Illegal operation: log( {convex} ).

if a is a double precision real number, and v is a CVX variable, CVX should accept log(1+a*v). It will not accept log(1+a*abs(v)) because abs(v) is convex.