Error using gammainc: Inputs must be real, full, and double or single

Uncategorized
Nov 2, 2023
D

Nr=8;
alpha=0.8
g1=sqrt(1/2)(randn(Nr,1)+1irandn(Nr,1));
cvx_begin
variable C(Nr,Nr) complex semidefinite
gammainc(g1’Cg1,1)>=alpha;
cvx_end

Error using gammainc
Inputs must be real, full, and double or single.
Error in run_me (line 53)
gammainc(real(g1’Cg1),1)>=alpha;

C is a covariance matrix, g1’Cg1 is normally real, but cvx don’t accept it in the gammainc function, since the argument of gammainc should be real.

Any help or advice, please?

M

The Incomplete Gamma function gammainc is not supported by CVX, as you would know by not seeing it listed in CVX Built-in functions or CVX New functions .

However, gammainc(x,1) = 1 - exp(-x). Therefore, your constraint can be entered in CVX as
1 - exp(-real(g1'*C*g)) >= alpha

As you can see, High School calculus sometimes comes in useful.

D
Replying to #2

Yes, you’re right. Thank you very much.