How to express log(trace(AX)+b) in CVX

Hi Mark, how to express log(trace(AX)+b) in CVX. I am expression it directly in cvx, but not sure whether it violet the cvx rule.

1 Like

As I know, if you express it directly in cvx, the cvx may give some warings. It doesn’t mean you are wrong.
You can use the ‘rel_entr’ function.
You can check this:

so, I should use like this rel_entr(trace(A*X)+b) ? I am not sure.

Replace
log(cvx_expression)
with
-rel_entr(1,cvx_expresion)

Nice, thank you very much .

You can enter it in CVX directly as
log(trace(A*X)+b)

If you, use CVX 2.2 and have available Mosek as solver, this suffices. In such case, you can use -rel_entr(1,trace(A*X)+b) instead of log(trace(A*X)+b), but it is just an unnecessary reduction in the understandability of the code.

If you do not have Mosek available as solver, then you should use -rel_entr(1,trace(A*X)+b) and install CVXQUAD’s exponential.m replacement as described in the link provided by @NWPU_Xiu

Thank you very much Mark.