Help coding max sum of capacity (max sum log_det)


(Tom) #1

I want to solve:
%%%%

H(:,:,1) = randn(4,4)+1i*randn(4,4);
H(:,:,2) = randn(4,4)+1i*randn(4,4);
H(:,:,3) = .. "and so forth", more entries same as last two lines.
n = size(H,1);
l = -1*ones(n,1);
u = ones(n,1);

cvx_begin
    variable x(n)
    maximize( sum(log_det(eye(n) + H*diag(x)*H')) )
    subject to
        l <= x <= u
cvx_end

x

%%%
but, sum(log_det(eye(n) + H*diag(x)H’)) is not a valid function. log_det(eye(n) + Hdiag(x)*H’) is fine, with H a 2D complex matrix.
I’m trying to encode something like this… basically I am working on a communications system, and need to take the sum of log_det’s, and maximize that. Cannot find the right commands to do that…
Help ?


(Mark L. Stone) #2

What are you trying to sum over? If you have a separate objective function term (to be summed over terms) for each slice of H, you can build up the objective in a for loop, as follows:

cvx_begin
variable x(n)
Objective = 0
for i = 1:number_of_slices_of_H
  Objective = Objective + log_det(eye(n) + H(:,:,i) * diag(x) * H(:,:,i)')
end
maximize(Objective)
subject to
l <= x <= u
cvx_end

You can fix this up if is not exactly what you want.

Edit: I corrected the last multiplicative term in the Objective update to be
H(:,:,i) * diag(x) * H(:,:,i)' . Specifically, the 'for transpose should follow, not precede,(:,:,i)


(Tom) #3

Thanks, it worked!. I didn’\t realize I could build objective functions in a loop like that, powerful!