# How to implement following function $\sum\limits_i {\sum\limits_k {{y_i}\log (1 + \frac{{x_i^k}}{{{y_i}}})} }$

hi.
I’m trying to use cvx to realize the following function \sum\limits_i {\sum\limits_k {{y_i}\log (1 + \frac{{x_i^k}}{{{y_i}}})} } .
Because the dimension of x and y is mismatched, it seems difficult for me. Any help??

1 Like

Using mcg’s “trick” from x\log(1+1/x) using CVX , each term of the double summation can be expressed as -rel_entr(y(i)+x(i)^k,y(i)) , which is DCP-compliant and convex. So the entire double summation is a sum of DCP-compliant convex terms, and hence is DCP-compliant convex.

Edit: each term should be -rel_entr(y(i),y(i)+x(i)^k)

1 Like

though each term can be describe as -rel_entr( y(i), x(i)^k+y(i) ), yet the double summation is hard to realize how to realize the double summation is the main obstacle due to this function being the objective function.

A brute force, though inelegant way is to declare S an expression (which is automatically initialized to 0), and then incrementally sum the terms in a nested for loop (outer over i, inner over k) into S. Then minimize(S). Alternatively, use sum as appropriate, depending on your data structures.

thank you very much, the original problem is in large scale, a brute search may be inappropriate.

In that case, CVX is probably not your tool anyway, since logarithms and entropy are implemented using the successive approximation approach. For large-scale problems, it’s just not feasible.