# Cholinc in quad_form.m has been removed in MATLAB 13

When I tried to run cvx in MATLAB 13 using the quad_form function the program has returned an error stating that `cholinc` has been removed and `ichol` should be used instead.
And so I wonder if we can replace the following line (line 148 in quad_form.m):

``````R = cholinc( Q( prm, prm ), 'inf' );
``````

by

``````R = ichol( Q( prm, prm ));
``````

Thx!

I am working on a fix. I do not believe the `ichol` replacement is sufficient, I’m afraid.

EDIT: If you would like to edit cvx/functions/@cvx yourself, you can replace lines 145-166 with this code. This is my candidate for the new quad_form.m … it hasn’t been fully tested yet but it has checked out so far.

EDIT: Here’s a new version, that does better with certain types of rank deficiency. Still being tested.

``````    if cvx_use_sparse( Q ),
Q = sparse( Q );
[ R, p, prm ] = chol( Q, 'upper', 'vector' );
else
Q = full( Q );
[ R, p ] = chol( Q, 'upper' );
prm = [];
end
if p ~= 0,
[ R, DD, prm ] = ldl( Q, 'upper', 'vector' );
tt = diag(DD,1) == 0;
tt = [ tt ; true ] & [ true ; tt ] & diag(DD) > tolLDL * trQ;
DD = diag(DD);
R  = bsxfun( @times, sqrt( DD(tt,:) ), R(tt,:) );
end
if ~isempty(prm) && any( diff(prm) ~= 1 ),
R( :, prm ) = R;
end
valid = size( R, 1 ) == size( R, 2 );
if ~valid,
valid = norm( Q - R' * R, 'fro' ) < tol * norm( Q, 'fro' );
end``````

I’ve updated the CVX distribution to include a fix, although the code specifically listed above is still being tested.

I obtain different solutions on a QP when using the old version of CVX (with `cholinc`) and the new CVX version 2.0 (beta). The old CVX version was giving solutions identical to the CPLEX QP solver `cplexqp`. The inconsistent results between `cplexqp` and CVX 2.0 (beta) are observed with the default CVX solvers as well as `gurobi`.

Is it possible for you to send me a bug report? I would like to fix this ASAP. I’ve run a number of numerical tests on `quad_form` though, through each possible “branch” of the code, so I’d definitely need a concrete example (with data) that reproduces your error.

Actually, I did find a potential source of the problem, and I have uploaded a fix. You may want to try this latest build of the package.

It seems to work fine now.

Question:

I have corrected quad_form as @mcg suggested:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

``````if cvx_use_sparse( Q ),
Q = sparse( Q );
[ R, p, prm ] = chol( Q, 'upper', 'vector' );
else
Q = full( Q );
[ R, p ] = chol( Q, 'upper' );
prm = [];
end
if p ~= 0,
[ R, DD, prm ] = ldl( Q, 'upper', 'vector' );
tt = diag(DD,1) == 0;
tt = [ tt ; true ] & [ true ; tt ] & diag(DD) > tolLDL * trQ;
DD = diag(DD);
R  = bsxfun( @times, sqrt( DD(tt,:) ), R(tt,:) );
end
if ~isempty(prm) && any( diff(prm) ~= 1 ),
R( :, prm ) = R;
end
valid = size( R, 1 ) == size( R, 2 );
if ~valid,
valid = norm( Q - R' * R, 'fro' ) < tol * norm( Q, 'fro' );
end
``````

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

but Matlab ask me what is “tolLDL”:
“Undefined function or variable ‘tolLDL’.”