Hi Dear Friends,
I am using the " log_det " built-in function of CVX, but I have noticed it uses “e” as the base of the logarithm, is there anyway to change this base?
Thank you a lot.
Ashkan
Hi Dear Friends,
I am using the " log_det " built-in function of CVX, but I have noticed it uses “e” as the base of the logarithm, is there anyway to change this base?
Thank you a lot.
Ashkan
\log_b\text{det}(X)=\frac{\text{logdet}(X)}{\log(b)}. That is, if you divide log_det(X)
by the positive constant log(b)
, you’re done.
Bien is absolutely right. However, let me interject something else: if you can reformulate your problem to avoid the use of log_det
, you should. The reason is that anything involving logarithms requires CVX’s successive approximation heuristic, which is slower and less reliable.
So, for example, if your objective function is
maximize(log_det(X))
then it is exactly equivalent to change the objective to this:
maximize(det_rootn(X))
and then, when the optimization is over, simply compute log_det(X)
by hand to get the objective value for the original problem (or compute n*log(cvx_optval)
).
Of course, there are times when you simply cannot make the substitution. For instance,
maximize(trace(C*X)+log_det(X))
cannot be rewritten in a way that avoids the logarithm.
Good to know.