Forcing CVX to work with VPA

(ata) #1

Hello,

I want to make CVX to work with at least 32 digits. This is done by vpa() in MATLAB. However, I cannot feed it into my cvx routine. I get the following error:

Undefined function ‘sparse’ for input arguments of type ‘sym’.

Error in cvx_reshape (line59)
x = sparse(x);

What can be done?

(ata) #2

My matrix (K) is sparse by the way.

I cannot feed double(K) into the routine as it yields wrong output.

(Mark L. Stone) #3

Anything which goes into a CVX expression must be a MATLAB double, not something such as VPA. sym is not allowed in CVX. CVX and the solvers it calls use double precision, and can not do 32 digit calculations.

Using VPA for some preliminary calculations is o.k. as long as whatever is provided to CVX has been converted to a double before doing so. If you have issues with converting vpa to double, I suggest you seek help at https://www.mathworks.com/matlabcentral/answers/index .

(ata) #4

Alright, thank you! I’ll find a way eventually.