# Convex optimization with function from exponential family

I am now trying to solve above problem using CVX but it turns out to be really slow and inaccurate since CVX cannot handle the functions from exponential family, (log or exp). They use the successive approximation method. But I found out that logsumexp_sdp function can solve the problem without using this successive approximation method… Can somebody help me with this problem… I really need to solve this in a timely manner.

Following is my code

``````clear all
X = randn(50,50);
[N,N] = size(X); lambda = 1;
a_prime = 0; M_prime = randn(N,N);

cvx_begin
variables M(N,N) a
Obj = -(a/N)*sum(sum(triu(X),1)) - (1/2*N)*trace(transpose(X)*M) + (1/N)*sum(sum(triu(log(1+exp(M)),1))) + ...
1/(2*lambda)*(a - a_prime)^2 + 1/(2*lambda)*square_pos(norm(M-M_prime,'fro'));
minimize (Obj)
cvx_end``````

`logsumexp_sdp` is an approximation.

Thanks for replying Grant. Can you let me know how to write the sum-logarithm (1+exp(a+Mij)) part in CVX term using logsumexp_sdp ?? I am very novice at CVX. Please help me.

You have a sum of logsumexp . I don’t know how well the following will work (from an accuracy standpoint), because it will involve a sum of logsumexp_sdp, not just a single logsumexp_sdp.

I will let you figure out the indexing involved in the arguments of logsumexp_sdp and their summation. I will consider the generic term in the sum: `log(1 + exp(alpha + M(i,j))` Because `1 = exp(0)`, use `logsumexp_sdp([0;alpha+M(i,j)])` . Because logsumexp_sdp performs its calculations for each column of a matrix argument, each term in the summation could have its own column in the argument of logsumexp_sdp. Then use `sum(log_sumexp_sdp(matrix argument))` . You can adjust this to suit your needs.

As I said above, I have no idea how well this will work.