I tried following equation to get sum of square of norm of n-d matrix in CVX:
size(w) = 6 1 2 7
using inner loop
for i = 1:2
for j = 1:6
a = a + square_pos(norm(w(:,:,i,j)))
In Matlab it works, but in CVX it is not able to do the outer sum. While applying loop (w(:,:,i,j)) also, inner sum was only done but unable to do the outer sum. Please guide me on this. Thank you for your help.
Either of the formulations in my previous post should work. If you want a formulation which perhaps seems to correspond more closely to your image, you could use the also equivalent formula, sum(sum(sum(square_pos(norms(w))))).
My guess is that sum(sum(sum(sum_square(w)))) is the fastest executing of the formulations in terms of CVX processing time.
If your 2nd dimension is always 1, as you have indicated, you could make formulas simpler by eliminating that dimension in the variable declaration, and using one less sum() in the formula.