[390c2f]: / Cobiveco / functions / ichol_autocomp.m

Download this file

18 lines (14 with data), 305 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
function M = ichol_autocomp(A, opts)
opts.diagcomp = 1e-3*(max(sum(abs(A),2)./diag(A))-2);
for i = 1:50
try
M = ichol(A, opts);
break;
catch
opts.diagcomp = 2*opts.diagcomp;
end
end
if ~exist('M', 'var')
error('Diagonal compensation for ichol failed.');
end
end