I have a variable defined as A(100\times 5) which is complex

```
variable A(100,5) complex
```

Then I define as expression as

```
expressions B(5,1) nonegative
B=[norm(A(:,1)) norm(A(:,2)) norm(A(:,3)) norm(A(:,4)) norm(A(:,5))];
```

Now my objective is to minimize the L0 norm of vector B, i.e., minimize the number of non-zero elements in vector B

\min ||B||_0

Can it be done in CVX?

Paul Rubin’s answer can be implemented in CVX.

1 Like

Let,

C=5;

U=10;

N=4;

bigM=1000;

I have done the following

```
variable Z(C,1) binary
variable A(N*C,U) complex
expressions b(C,1) nonegative
cvx_begin
for c=1:C
b(c)=norm(vec(A((c-1)*N+1:c*N,:)));
end
minimize sum(Z)
subject to
for indx=1:C
b(indx) >= 0;
b(indx) <= bigM*Z(indx);
end
```

is nor working as we have DCP error!

This

```
b(indx) >= 0;
```

is not needed and even cannot be used. A norm is always nonnegative.

Isn’t the whole loop just

```
b <= bigM*Z
```

?

This I tried and I do not get any error.