How to do matrix inverse in CVX


My MATLAB code is as follows:
w_hat(:,j) = pinv(H_int + N_0 * eye(Nt)) * h(:,j,i);
The variable is addressed to H_int.
However, some errors occured when I ran the code, shown as below:
"Undefined function or method ‘svd’ for input arguments of type ‘cvx’."
I guess it must be illegal to use pinv for a variable in CVX.
So how can I express matrix inverse operation in CVX?

(Mark L. Stone) #2

It depends on what you need to do with the inverse. For instance, matrix_frac is available, and it reformulates behind the scenes to an SDP, via Schur complement as you can see in this code segment from matrix_frac

elseif cvx_isaffine( x ) && cvx_isaffine( Y ),

    n = size( x, 1 );
    z = [];
        epigraph variable z
        [Y x; x' z] == semidefinite( n+1 ); %#ok

If the matrix inverse appears in an inherently non-convex way, you will not be able to formulate it in a manner which CVX will accept.

You can get some ideas from chapters 4 and 5 of .

If matrix_frac does what you need, you can use that. Otherwise, you’ll have to reformualte your problem in a way which does not explicitly involve the inverse of a matrix which is a CVX variable or expression.

(Michael C. Grant) #3

Please, please, please read the FAQ. If you understand its contents, you will know that you should not have even tried to use the pinv function. Here is a list of accepted functions.


I see. Thank you.
I will check my optimization problem